* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0066cc;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #343a40;
    --light: #f8f9fa;
    --sidebar-width: 260px;
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f6fa;
    color: #2c3e50;
}

/* Sidebar Overlay (for mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    z-index: 999;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #ffc107;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: #ffc107;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #ffc107;
}

.nav-item i {
    margin-right: 15px;
    font-size: 1.2rem;
    width: 25px;
}

.sidebar-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
    opacity: 0.6;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.user-info i {
    font-size: 1.8rem;
    color: var(--primary);
}

.btn-logout {
    padding: 8px 20px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c82333;
}

/* Page Container */
.page-container {
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
    width: 100%;
    min-height: calc(100vh - var(--header-height) - 60px);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page h1 {
    font-size: 2rem;
    margin: 0 0 30px 0;
    padding: 0;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 15px;
}

.page h2 {
    font-size: 1.8rem;
    margin: 0 0 30px 0;
    padding: 0;
    color: var(--dark);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.green { background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-content p {
    color: #6c757d;
    font-size: 0.95rem;
}

/* Card */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--dark);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,102,204,0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger);
    color: white;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    color: var(--primary);
    font-size: 1rem;
    transition: color 0.3s;
}

.btn-icon:hover {
    color: #0056b3;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 5px;
    padding: 8px 15px;
    gap: 10px;
}

.search-box i {
    color: #6c757d;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 0.95rem;
    width: 250px;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid #dee2e6;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.text-center {
    text-align: center;
}

/* Upload Area */
.upload-actions {
    margin-bottom: 20px;
}

.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: 10px;
    padding: 50px 30px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f8f9fa;
}

.upload-area.dragover {
    border-color: var(--success);
    background: #d4edda;
}

.upload-area i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.upload-area h3 {
    margin-bottom: 10px;
}

.upload-area p {
    color: #6c757d;
}

.file-info {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Progress */
.upload-progress {
    margin-top: 30px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #0056b3);
    transition: width 0.3s ease;
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.upload-results {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 20px;
}

.result-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 4px solid;
}

.result-item.success {
    background: #d4edda;
    border-color: var(--success);
}

.result-item.warning {
    background: #fff3cd;
    border-color: var(--warning);
}

.result-item.error {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.result-item.error strong {
    color: #a71d2a;
    font-weight: 600;
}

.result-item.error small {
    color: #721c24;
    font-weight: 500;
}

.result-item.waiting {
    background: #e7f3ff;
    border-color: #0066cc;
    color: #004085;
}

.result-item.waiting strong {
    color: #0066cc;
}

.result-item.info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.result-item.info strong {
    color: #117a8b;
    font-weight: 600;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.info-group {
    margin-bottom: 20px;
}

.info-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark);
}

.info-group p {
    color: #6c757d;
}

.token-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.token-display:hover {
    background: #e9ecef;
}

.token-display code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    cursor: text;  /* Changed from pointer to text for copy indication */
    user-select: text;  /* Changed from all to text for better copy behavior */
    line-height: 1.5;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: pre-wrap;  /* Preserve formatting */
    -webkit-user-select: text;  /* Safari support */
    -moz-user-select: text;  /* Firefox support */
    -ms-user-select: text;  /* IE/Edge support */
}

/* Visual feedback when token is selected */
.token-display code::selection {
    background: #007bff;
    color: white;
}

.token-display code::-moz-selection {
    background: #007bff;
    color: white;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.account-status {
    padding: 20px;
    border-radius: 5px;
    background: #f8f9fa;
}

.account-status.authenticated {
    background: #d4edda;
    border-left: 4px solid var(--success);
}

.account-status.not-authenticated {
    background: #f8d7da;
    border-left: 4px solid var(--danger);
}

.loading {
    text-align: center;
    color: #6c757d;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal.completed .modal-content {
    border-top: 4px solid #28a745;
}

.modal.failed .modal-content {
    border-top: 4px solid #dc3545;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 1001;
}

.modal-results {
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: -100px;
    right: 30px;
    background: var(--dark);
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transition: bottom 0.3s ease;
    z-index: 3000;
}

.toast.show {
    bottom: 30px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: var(--dark);
}

/* Groups Page */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.group-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 4px solid;
    position: relative;
    overflow: hidden;
}

.group-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.group-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.group-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
}

.group-info {
    flex: 1;
}

.group-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--dark);
}

.group-description {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.group-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.group-member-count {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6c757d;
    font-size: 0.9rem;
}

.group-member-count i {
    color: var(--primary);
}

.group-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.group-card-new {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    border: 2px dashed rgba(255,255,255,0.5);
}

.group-card-new:hover {
    border-color: white;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.group-card-new i {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.group-card-new .group-name {
    color: white;
    opacity: 0.9;
}

/* Group Detail Modal */
.group-detail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    overflow-y: auto;
}

.group-detail-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.group-detail-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.group-detail-header {
    padding: 25px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.group-detail-title {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.group-detail-title i {
    font-size: 2rem;
}

.group-detail-body {
    padding: 25px;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.member-item {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.member-item:hover {
    background: #f8f9fa;
    border-color: var(--primary);
}

.member-item-info {
    flex: 1;
}

.member-item-nik {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 3px;
}

.member-item-nama {
    color: #6c757d;
    font-size: 0.9rem;
}

.member-item-stats {
    display: flex;
    gap: 15px;
    margin-right: 15px;
    font-size: 0.85rem;
}

.member-item-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.member-item-stat-label {
    color: #6c757d;
    font-size: 0.75rem;
}

.member-item-stat-value {
    font-weight: 600;
    color: var(--dark);
}

.loading-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
    opacity: 0.3;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: #495057;
}

.empty-state p {
    margin: 0;
}

/* Transaction Page */
.alert {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.alert i {
    font-size: 2rem;
}

.alert > div {
    flex: 1;
}

.alert strong {
    display: block;
    margin-bottom: 5px;
}

.alert p {
    margin: 0;
    font-size: 0.9rem;
}

.transaction-method {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-card-content {
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.radio-card-content i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}

.radio-card-content span {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark);
}

.radio-card-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.radio-card input[type="radio"]:checked + .radio-card-content {
    border-color: var(--primary);
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.radio-card:hover .radio-card-content {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.target-stock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.target-input label,
.stock-display label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
}

.stock-value {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 700;
}

.stock-value i {
    font-size: 2rem;
}

.transaction-summary {
    display: flex;
    gap: 20px;
    align-items: center;
}

.transaction-summary span {
    color: #6c757d;
}

.transaction-summary strong {
    color: var(--primary);
    font-size: 1.2rem;
}

.card-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    text-align: right;
}

.btn-lg {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* Transaction Table */
#transactionTable tbody tr.disabled {
    opacity: 0.5;
    background: #f8f9fa;
}

#transactionTable tbody tr.disabled input,
#transactionTable tbody tr.disabled select {
    cursor: not-allowed;
}

#transactionTable .qty-input {
    width: 80px;
    padding: 5px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-align: center;
}

#transactionTable .qty-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Transaction Modal */
.modal-large {
    max-width: 800px;
    width: 90%;
}

.log-container {
    margin: 20px 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.log-header {
    background: #2d3436;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.log-content {
    background: #1e272e;
    color: #00ff00;
    padding: 15px;
    margin: 0;
    height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #0f1419;
}

.log-content::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.transaction-results {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.result-stat {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid;
}

.result-stat.success {
    border-color: var(--success);
}

.result-stat.failed {
    border-color: var(--danger);
}

.result-stat.total {
    border-color: var(--primary);
}

.result-stat i {
    font-size: 2rem;
}

.result-stat.success i {
    color: var(--success);
}

.result-stat.failed i {
    color: var(--danger);
}

.result-stat.total i {
    color: var(--primary);
}

.result-stat h4 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.result-stat p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Modal Header with Actions */
.modal-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
}

.modal-header-with-actions h3 {
    margin: 0;
    flex: 1;
}

.btn-minimize {
    background: rgba(108, 117, 125, 0.1);
    border: 1px solid #dee2e6;
    color: #6c757d;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.btn-minimize:hover {
    background: rgba(108, 117, 125, 0.2);
    color: #495057;
    transform: scale(1.05);
}

.btn-minimize i {
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    position: relative;
    z-index: 10;
}

/* Floating Mini Progress Window (Native Mode) */
.floating-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 10000;
    animation: slideInUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.floating-progress-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.floating-progress-header span {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.floating-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    /*color: white;*/
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.floating-progress-body {
    padding: 15px;
}

.mini-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.floating-progress-body p {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
    text-align: center;
}

/* Cancel Confirmation Modal */
.modal-small {
    max-width: 450px;
}

.modal-small h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.modal-small p {
    margin: 10px 0;
}

/* Member Selection Modal - Improved */
.modal-member-selection {
    z-index: 10001 !important;
}

.modal-member-content {
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.modal-member-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 24px;
    border-bottom: 2px solid #e9ecef;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.modal-member-header h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.5rem;
}

.member-filters {
    margin-top: 16px;
}

.filter-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.selection-counter {
    margin-top: 12px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.selection-counter span {
    font-size: 1.3rem;
    font-weight: 700;
}

.niks-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    min-height: 300px;
    max-height: 400px;
}

.nik-item {
    display: flex;
    align-items: center;
    padding: 14px;
    margin-bottom: 10px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
    background: white;
}

.nik-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.nik-item.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.2);
}

.nik-item.disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    background: #f5f5f5;
    pointer-events: none;
}

.nik-item.disabled:hover {
    transform: none;
    border-color: #dee2e6;
    background: #f5f5f5;
    box-shadow: none;
}

.nik-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 14px;
    cursor: pointer;
    accent-color: #667eea;
}

.nik-item-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.nik-info {
    flex: 1;
}

.nik-number {
    font-weight: 600;
    color: #495057;
    font-size: 1rem;
    margin-bottom: 4px;
}

.nik-details {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: #6c757d;
    flex-wrap: wrap;
}

.nik-name {
    font-weight: 500;
}

.nik-province {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #e7f3ff;
    color: #0056b3;
    border-radius: 4px;
    font-size: 0.8rem;
}

.group-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #d63031;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #fdcb6e;
    box-shadow: 0 2px 4px rgba(253, 203, 110, 0.3);
}

.group-badge i {
    font-size: 0.7rem;
}

.nik-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.available {
    background: #d4edda;
    color: #155724;
}

.status-badge.full {
    background: #f8d7da;
    color: #721c24;
}

.sold-info {
    font-size: 0.8rem;
    color: #6c757d;
}

.modal-member-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 24px;
    border-top: 2px solid #e9ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    z-index: 10;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
}

.modal-member-footer .btn {
    min-width: 140px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input {
        width: 100%;
    }
    
    .groups-grid {
        grid-template-columns: 1fr;
    }
    
    .member-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .member-item-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .target-stock-grid {
        grid-template-columns: 1fr;
    }
    
    .result-summary {
        grid-template-columns: 1fr;
    }
    
    .transaction-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .alert {
        flex-direction: column;
    }
    
    .modal-large {
        width: 95%;
        max-width: none;
    }
    
    .log-content {
        height: 200px;
        font-size: 0.75rem;
    }
    
    .floating-progress {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
        bottom: 10px;
    }
}

/* Desktop: Hide overlay completely */
@media (min-width: 769px) {
    .sidebar-overlay {
        display: none !important;
    }
}

/* Database Operation Warning Modal */
.db-operation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.db-operation-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.db-operation-header {
    text-align: center;
    margin-bottom: 20px;
}

.db-operation-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.db-operation-header h3 {
    color: #ff6b00;
    margin: 0;
    font-size: 1.3rem;
}

.db-operation-body {
    text-align: center;
}

.db-operation-body p {
    color: #555;
    margin-bottom: 20px;
    font-size: 1rem;
}

.db-operation-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: #856404;
}

.db-operation-warning i {
    color: #ffc107;
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: block;
}

.db-operation-warning strong {
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

.db-operation-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066cc, #0099ff);
    transition: width 0.3s ease;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    margin-top: 10px;
    font-weight: bold;
    color: #0066cc;
    font-size: 1.1rem;
}

/* Pulse animation for warning */
.db-operation-warning {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Group Badge */
.group-badge {
    display: inline-block;
    padding: 4px 10px;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin: 2px;
}

.group-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.no-group-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e0e0e0;
    color: #757575;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    font-style: italic;
}

/* Form control styling */
.form-control {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* PWA Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    max-width: 400px;
    width: calc(100% - 40px);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.pwa-install-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.pwa-install-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.pwa-install-header i {
    font-size: 24px;
}

.pwa-install-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.pwa-install-content p {
    margin: 0 0 16px 0;
    font-size: 14px;
    opacity: 0.95;
    line-height: 1.5;
}

.pwa-install-actions {
    display: flex;
    gap: 10px;
}

.pwa-install-actions .btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pwa-install-actions .btn-primary {
    background: white;
    color: #667eea;
}

.pwa-install-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.pwa-install-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.pwa-install-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive PWA prompt */
@media (max-width: 768px) {
    .pwa-install-prompt {
        bottom: 10px;
        width: calc(100% - 20px);
    }
    
    .pwa-install-content {
        padding: 16px;
    }
    
    .pwa-install-actions {
        flex-direction: column;
    }
}
