/* ============================================
   TOKO KASIR - MAIN STYLES
   ============================================ */

   * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --light: #f8fafc;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --border-radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0f172a, #1e293b);
    color: white;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 10px;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-header .logo-container {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    max-width: 60px;
    max-height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header .logo-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.sidebar-header .store-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #e2e8f0;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 10px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: background 0.3s ease;
    margin-bottom: 2px;
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 13px;
    padding: 8px 0;
}

.sidebar-footer .user-info i {
    font-size: 20px;
}

.sidebar-footer .logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: #f87171;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: background 0.3s ease;
    font-size: 13px;
    margin-top: 5px;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    height: var(--topbar-height);
    background: white;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .toggle-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: background 0.3s ease;
}

.top-bar .toggle-sidebar:hover {
    background: #f1f5f9;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-right .current-date {
    font-size: 13px;
    color: #64748b;
}

.top-bar-right .user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 13px;
    color: #1e293b;
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    padding: 20px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 24px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: slideInToast 0.3s ease;
    max-width: 400px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-success {
    background: var(--success);
}
.toast-error {
    background: var(--danger);
}
.toast-info {
    background: var(--info);
}
.toast-warning {
    background: var(--warning);
}

@keyframes slideInToast {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9998;
}

.loading-overlay.show {
    display: flex;
}

.loading-overlay .loader {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
}

.loading-overlay .loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}
.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-header .close {
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
    background: none;
    border: none;
    padding: 0 5px;
}

.modal-header .close:hover {
    color: #1e293b;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.table tr:hover td {
    background: #f8fafc;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0 12px;
    }
    
    .top-bar-right .current-date {
        display: none;
    }
    
    .page-content {
        padding: 12px;
    }
    
    .modal-content {
        width: 98%;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .top-bar-right .user-badge span {
        display: none;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
    }
}

/* ============================================
   SCANNER MODAL (GLOBAL - dipakai di Transaksi, Produk, Laporan)
   ============================================ */
/* Scanner Modal */
.scanner-modal .modal-content {
    background: #000;
    color: white;
    max-width: 500px;
}

.scanner-modal .modal-header {
    border-bottom-color: #333;
}

.scanner-modal .modal-header .close {
    color: white;
}

.scanner-modal .scanner-container {
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    position: relative;
    overflow: hidden;
}

.scanner-modal .scanner-container #scannerContainer {
    width: 100%;
    height: 100%;
}

.scanner-modal .scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scanner-modal .scanner-overlay .scan-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
}

.scanner-modal .scanner-overlay .scan-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: #00ff00;
    animation: scanLine 2s infinite linear;
    box-shadow: 0 0 10px #00ff00;
}

@keyframes scanLine {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

.scanner-status {
    padding: 10px 20px;
    background: rgba(0,0,0,0.7);
    color: #9ca3af;
    border-radius: 20px;
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
}

.scanner-status.active {
    background: rgba(37, 99, 235, 0.8);
    color: white;
    animation: pulse 1s infinite;
}

.scanner-status.success {
    background: rgba(34, 197, 94, 0.9);
    color: white;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.scanner-result {
    color: #9ca3af;
    font-size: 14px;
    min-height: 20px;
    text-align: center;
}

.scanner-result.success {
    color: #22c55e;
}


/* ============================================
   RECEIPT MODAL (GLOBAL - dipakai di Transaksi & Laporan)
   ============================================ */
/* Receipt Modal */
.receipt-content {
    max-width: 400px;
}

.receipt-content .modal-body {
    padding: 10px 15px;
    background: white;
}

.receipt-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 10px 0;
    width: 100%;
}

.receipt-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.receipt-actions .btn-print {
    background: var(--success);
    color: white;
}
.receipt-actions .btn-print:hover {
    background: #16a34a;
}

.receipt-actions .btn-done {
    background: #e2e8f0;
    color: #1e293b;
}
.receipt-actions .btn-done:hover {
    background: #cbd5e1;
}

/* ============================================
   SIDEBAR OVERLAY (mobile/tablet drawer backdrop)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 1024px) {
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
}

body.sidebar-open {
    overflow: hidden;
}

/* ============================================
   PWA INSTALL BUTTON
   ============================================ */
.pwa-install-btn {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transition: all 0.3s ease;
}

.pwa-install-btn.show {
    display: flex;
}

.pwa-install-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .pwa-install-btn {
        right: 16px;
        bottom: 16px;
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* Safe-area untuk perangkat dengan notch (iPhone dsb) */
@supports (padding: max(0px)) {
    .top-bar {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    .pwa-install-btn {
        bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Grid halaman backup - otomatis 1 kolom di layar sempit */
.backup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}


