/* ==========================================
   QLBH - Quản Lý Bán Hàng
   Modern CSS with Dark Mode Support
   ========================================== */

/* CSS Variables */
:root {
    /* Colors - Light Mode */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-success: #10b981;
    --accent-success-light: #d1fae5;
    --accent-danger: #ef4444;
    --accent-danger-light: #fee2e2;
    --accent-warning: #f59e0b;
    --accent-warning-light: #fef3c7;
    --accent-info: #3b82f6;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-revenue: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-profit: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-orders: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-products: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);

    /* Sizes */
    --header-height: 60px;
    --nav-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(51, 65, 85, 0.5);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* ==========================================
   Login Screen
   ========================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 20px;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 48px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    margin-bottom: 24px;
}

.logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tagline {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-google:hover {
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.note {
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================
   Setup Screen
   ========================================== */
.setup-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 20px;
}

.setup-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 48px;
    max-width: 450px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.5s ease;
}

.setup-card h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.setup-card>p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-success:hover {
    filter: brightness(1.1);
}

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

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-text:hover {
    color: var(--accent-danger);
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-group {
    display: flex;
    gap: 8px;
}

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

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ==========================================
   App Header
   ========================================== */
.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-small {
    font-weight: 700;
    font-size: 1.1rem;
}

.store-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* ==========================================
   App Navigation
   ========================================== */
.app-nav {
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    overflow-x: auto;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.nav-icon {
    font-size: 1.1rem;
}

/* ==========================================
   Main Content
   ========================================== */
.app-main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

.tab-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ==========================================
   Dashboard
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card.revenue .stat-icon {
    background: var(--gradient-revenue);
}

.stat-card.profit .stat-icon {
    background: var(--gradient-profit);
}

.stat-card.orders .stat-icon {
    background: var(--gradient-orders);
}

.stat-card.products .stat-icon {
    background: var(--gradient-products);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.list-container {
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
}

/* ==========================================
   Search Bar
   ========================================== */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ==========================================
   Tables
   ========================================== */
.table-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.action-btn.delete:hover {
    background: var(--accent-danger);
}

/* ==========================================
   Sales Page
   ========================================== */
#tab-sales.active {
    display: flex !important;
    flex-direction: column;
    gap: 24px;
}

.sales-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    min-height: 400px;
}

.sales-history {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.sales-history .tab-header {
    margin-bottom: 16px;
}

.sales-history .tab-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.details-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sales-left {
    display: flex;
    flex-direction: column;
}

.search-results {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow-y: auto;
    padding: 12px;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item .product-info {
    flex: 1;
}

.search-result-item .product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.search-result-item .product-code {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-result-item .product-price {
    font-weight: 600;
    color: var(--accent-primary);
}

.sales-right {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.cart-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    margin-bottom: 8px;
}

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

.cart-item-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cart-item-price-edit {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.price-input {
    width: 100px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    text-align: right;
    transition: all var(--transition-fast);
}

.price-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.price-input.price-changed {
    border-color: var(--accent-warning);
    background: var(--accent-warning-light);
    color: var(--text-primary);
}

.price-original {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px;
}

.cart-item-qty button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cart-item-qty button:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.cart-item-qty span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    font-weight: 600;
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 8px;
    transition: color var(--transition-fast);
}

.cart-item-remove:hover {
    color: var(--accent-danger);
}

.cart-summary {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.cart-note {
    margin-bottom: 16px;
}

.cart-note input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.cart-note input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.cart-note input::placeholder {
    color: var(--text-muted);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1rem;
}

.summary-row.profit {
    color: var(--accent-success);
}

.total-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.profit-value {
    font-weight: 600;
}

/* ==========================================
   Transactions
   ========================================== */
.transactions-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
}

.summary-card .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-card.income .value {
    color: var(--accent-success);
}

.summary-card.expense .value {
    color: var(--accent-danger);
}

.summary-card.balance .value {
    color: var(--accent-primary);
}

.transaction-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.transaction-type.income {
    background: var(--accent-success-light);
    color: var(--accent-success);
}

.transaction-type.expense {
    background: var(--accent-danger-light);
    color: var(--accent-danger);
}

.note-cell {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==========================================
   Filter Buttons
   ========================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius-sm);
}

.filter-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

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

.filter-btn.income.active {
    background: var(--accent-success);
}

.filter-btn.expense.active {
    background: var(--accent-danger);
}

/* ==========================================
   Chart Section
   ========================================== */
.chart-section {
    min-height: 300px;
}

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

.chart-header h3 {
    margin: 0;
}

.chart-header select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.chart-container {
    position: relative;
    height: 250px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ==========================================
   Reports
   ========================================== */
.date-filter select {
    padding: 10px 16px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.report-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
}

.report-card h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 12px;
}

.report-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.top-products {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.top-product-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.top-product-item:last-child {
    border-bottom: none;
}

.top-product-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 12px;
}

.top-product-info {
    flex: 1;
}

.top-product-name {
    font-weight: 500;
}

.top-product-code {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.top-product-sold {
    font-weight: 600;
    color: var(--accent-primary);
}

/* ==========================================
   Modals
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-close:hover {
    background: var(--accent-danger);
    color: white;
}

.modal-content form {
    padding: 24px;
}

/* ==========================================
   Toast
   ========================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 14px 24px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: all var(--transition-normal);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-left: 4px solid var(--accent-success);
}

.toast.error {
    border-left: 4px solid var(--accent-danger);
}

/* ==========================================
   Loading Overlay
   ========================================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 3000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: white;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    .app-nav {
        justify-content: flex-start;
        padding: 0 12px;
    }

    .nav-text {
        display: none;
    }

    .nav-btn {
        padding: 10px 14px;
    }

    .sales-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .sales-right {
        min-height: 400px;
    }

    .transactions-summary {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .header-left .store-name {
        display: none;
    }
}

@media (max-width: 480px) {

    .login-card,
    .setup-card {
        padding: 32px 24px;
    }

    .app-main {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.2rem;
    }
}