:root {
    --bg-main: #0B0F19;
    --bg-surface: #1E293B;
    --bg-glass: rgba(17, 24, 39, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --primary: #8B5CF6;
    --primary-hover: #7C3AED;
    --accent: #10B981;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --success: #10B981;
    --danger: #EF4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
}

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

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #111827;
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 8px;
}

.logo-section h2 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #A78BFA, #EC4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 13px;
}

.nav-item i {
    width: 18px;
    height: 18px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: rgba(139, 92, 246, 0.15);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
    background: rgba(139, 92, 246, 0.2);
}

.user-profile {
    border-top: 1px solid var(--border-glass);
    padding-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon i {
    width: 20px;
    height: 20px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

label {
    display: block;
    font-size: 13px;
    color: #9CA3AF;
    margin-bottom: 8px;
    font-weight: 500;
    text-align: left;
}

input, select, textarea {
    width: 100%;
    display: block;
    padding: 12px 16px;
    background: rgba(10, 15, 26, 0.8);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-main);
    outline: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-info p {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}

/* Table Style */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 13.5px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}
.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--accent); }
.badge-info { background: rgba(59, 130, 246, 0.12); color: #3B82F6; }

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* Top Header */
.top-header select {
    outline: none;
    cursor: pointer;
}

/* Login Page khusus */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.15), transparent), var(--bg-main);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
}

/* Modal Overlay & Popups */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-content {
    background: #1E293B;
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    z-index: 1000000;
    position: relative;
}

.password-wrapper {
    position: relative;
    width: 100%;
}
.password-wrapper input {
    padding-right: 48px;
}
.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    padding: 4px;
}
.password-toggle-btn:hover {
    color: var(--text-main);
}

/* Hóa đơn in khổ giấy nhiệt (58/80mm) */
#receipt-print-area {
    display: none;
}
#receipt-print-area .receipt {
    width: 80mm;
    font-family: 'Courier New', monospace;
    color: #000;
    background: #fff;
    font-size: 12px;
    line-height: 1.5;
}
#receipt-print-area .receipt .r-center { text-align: center; }
#receipt-print-area .receipt .r-bold { font-weight: 700; }
#receipt-print-area .receipt .r-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
#receipt-print-area .receipt .r-row { display: flex; justify-content: space-between; gap: 8px; }
#receipt-print-area .receipt .r-sep { border-top: 1px dashed #000; margin: 6px 0; }
#receipt-print-area .receipt .r-item-name { flex: 1; }

@media print {
    body * {
        visibility: hidden;
    }
    #receipt-print-area, #receipt-print-area * {
        visibility: visible;
    }
    #receipt-print-area {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 80mm;
    }
}
