:root {
    /* Colors */
    --primary: #1a202c;
    --secondary: #2d3748;
    --accent: #3182ce;
    --accent-hover: #2c5aa0;
    --success: #38a169;
    --warning: #d69e2e;
    --danger: #e53e3e;
    --info: #4299e1;

    /* Text */
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --text-on-accent: #ffffff;

    /* Backgrounds */
    --bg-primary: #0f1419;
    --bg-secondary: #1a202c;
    --bg-card: rgba(26, 32, 44, 0.8);
    --bg-hover: rgba(45, 55, 72, 0.6);
    --bg-modal: rgba(15, 20, 25, 0.95);

    /* Borders */
    --border: #2d3748;
    --border-light: #4a5568;
    --border-accent: #3182ce;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 6px 10px -3px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 12px 16px -4px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    --gradient-success: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    --gradient-card: linear-gradient(135deg, rgba(26, 32, 44, 0.9) 0%, rgba(45, 55, 72, 0.9) 100%);

    /* Spacing */
    --space-xs: 0.2rem;
    --space-sm: 0.375rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
    --space-2xl: 1.75rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Typography */
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.4;
    font-weight: 400;
}

.hidden {
    display: none !important;
}

/* ==================== AUTH ==================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(49, 130, 206, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(56, 161, 105, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: var(--space-sm);
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
    font-size: 0.95rem;
}

.auth-tabs {
    display: flex;
    margin-bottom: var(--space-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.auth-tab.active {
    background: var(--gradient-primary);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: var(--space-md);
}

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

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

textarea {
    resize: vertical;
    min-height: 70px;
}

/* Custom select styling */
select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23a0aec0' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    background-size: 10px;
    padding-right: var(--space-xl);
    appearance: none;
    cursor: pointer;
}

select:hover {
    border-color: var(--border-light);
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-on-accent);
}

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

.btn-success {
    background: var(--gradient-success);
    color: var(--text-on-accent);
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
}

.btn-icon {
    padding: var(--space-xs);
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.btn-icon:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

/* ==================== LAYOUT ==================== */
.app-container {
    min-height: 100vh;
    background: var(--bg-primary);
}

.navbar {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: #e2e8f0;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.nav-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
}

/* ==================== STATS ==================== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.3s ease;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-accent);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ==================== CONTROLS ==================== */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.control-group {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 240px;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

.group-filter {
    min-width: 160px;
}

/* Group filter in controls */
.group-filter {
    min-width: 160px;
}

.group-filter select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.group-filter select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

/* ==================== TABLE ==================== */
.list-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

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

.items-table thead {
    background: var(--bg-secondary);
}

.items-table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.items-table td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.items-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease-out;
}

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

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

/* Table sorting */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.sortable-header:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sortable-header::after {
    content: '↕';
    margin-left: var(--space-xs);
    font-size: 0.8rem;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.sortable-header.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--accent);
}

.sortable-header.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--accent);
}

.sortable-header:hover::after {
    opacity: 1;
}

/* Price trends and differences */
.value-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
}

.trend-up { color: var(--success); font-weight: 700; }
.trend-up-medium { color: #85d5bb; font-weight: 700; }
.trend-down { color: var(--danger); font-weight: 700; }
.trend-down-medium { color: #f69b9b; font-weight: 700; }
.trend-neutral { color: var(--text-muted); font-weight: 700; }

.price-difference {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 2px;
}

.price-difference.positive { color: var(--success); }
.price-difference.negative { color: var(--danger); }

.items-table tbody tr.high-difference { border-left: 3px solid var(--accent); }
.items-table tbody tr.positive-change { border-left: 3px solid var(--success); }
.items-table tbody tr.negative-change { border-left: 3px solid var(--danger); }

/* ==================== MENU DROPDOWN ==================== */
.actions-menu {
    position: relative;
    display: inline-block;
}

.menu-toggle {
    padding: var(--space-sm);
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 1;
}

.menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-sm);
    min-width: 140px;
    z-index: 10002;
    display: none;
    margin-top: 4px;
}

.menu-dropdown.show {
    display: block;
    animation: menuSlideIn 0.2s ease-out;
}

.menu-item {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-item.edit:hover {
    background: rgba(49, 130, 206, 0.1);
    color: var(--accent);
}

.menu-item.delete:hover {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger);
}

/* Menu overlay to capture clicks outside */
.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: transparent;
    display: none;
}

/*.menu-overlay.active {*/
/*    display: block;*/
/*}*/

/* Highlight row when menu is open */
.items-table tbody tr.menu-open {
    background: var(--bg-hover);
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==================== BADGES ==================== */
.group-badge {
    display: inline-block;
    background: rgba(49, 130, 206, 0.1);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: var(--space-xs);
    border: 1px solid rgba(49, 130, 206, 0.3);
}

.shop-badge {
    display: inline-block;
    background: rgba(49, 130, 206, 0.1);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: var(--space-xs);
    border: 1px solid rgba(49, 130, 206, 0.3);
}

.status-badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.status-active {
    background: rgba(56, 161, 105, 0.1);
    color: var(--success);
    border: 1px solid rgba(56, 161, 105, 0.3);
}

.status-pending {
    background: rgba(214, 158, 46, 0.1);
    color: var(--warning);
    border: 1px solid rgba(214, 158, 46, 0.3);
}

.status-completed {
    background: rgba(66, 153, 225, 0.1);
    color: var(--info);
    border: 1px solid rgba(66, 153, 225, 0.3);
}

.status-cancelled {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger);
    border: 1px solid rgba(229, 62, 62, 0.3);
}

/* ==================== MODALS ==================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-modal);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    margin: var(--space-lg) auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-content.large {
    max-width: 900px;
    width: 90%;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-body {
    padding: var(--space-lg);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
}

.product-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.price-history {
    margin-top: var(--space-xl);
}

.price-chart {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
    max-height: 300px;
    overflow-y: auto;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

.price-item:hover {
    background: var(--bg-hover);
    margin: 0 calc(-1 * var(--space-md));
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
}

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

.price-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.price-value {
    font-weight: 600;
    color: var(--success);
    font-family: var(--font-mono);
}

/* ==================== TOASTS ==================== */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 350px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    pointer-events: all;
    animation: toastSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
}

.toast-success::before { background: var(--success); }
.toast-error::before { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before { background: var(--info); }

.toast.exiting {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.toast-success .toast-icon {
    background: rgba(56, 161, 105, 0.2);
    color: var(--success);
}

.toast-error .toast-icon {
    background: rgba(229, 62, 62, 0.2);
    color: var(--danger);
}

.toast-warning .toast-icon {
    background: rgba(214, 158, 46, 0.2);
    color: var(--warning);
}

.toast-info .toast-icon {
    background: rgba(66, 153, 225, 0.2);
    color: var(--info);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: all 0.2s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--success);
    width: 100%;
    transform-origin: left;
    animation: toastProgress 5000ms linear forwards;
}

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

/* ==================== GROUPS ==================== */
.groups-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.group-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.group-item:hover {
    border-color: var(--border-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.group-info h4 {
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

.group-info p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.group-stats {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.group-actions {
    display: flex;
    gap: var(--space-xs);
}

/* ==================== LOADING ==================== */
.initial-loading {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.initial-loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.875rem;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-sm);
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

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

/* ==================== ACCESSIBILITY ==================== */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background: rgba(49, 130, 206, 0.3);
    color: var(--text-primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }

    .controls {
        flex-direction: column;
        gap: var(--space-md);
        align-items: stretch;
    }

    .control-group {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .search-box input {
        width: 100%;
    }

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

    .navbar {
        padding: var(--space-sm);
        flex-direction: column;
        gap: var(--space-sm);
    }

    .nav-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .items-table {
        display: block;
        overflow-x: auto;
    }

    .modal-content {
        margin: var(--space-sm);
        width: calc(100% - var(--space-md));
    }

    .product-header {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: flex-start;
    }

    .auth-card {
        padding: var(--space-lg);
        margin: var(--space-sm);
    }

    .toast-container {
        top: var(--space-sm);
        right: var(--space-sm);
        left: var(--space-sm);
        max-width: none;
    }

    @keyframes toastSlideIn {
        from {
            opacity: 0;
            transform: translateY(-15px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    @keyframes toastSlideOut {
        from {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
        to {
            opacity: 0;
            transform: translateY(-15px) scale(0.95);
        }
    }

    .group-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .group-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.value-positive {
    color: var(--success);
    font-weight: 600;
}

.value-negative {
    color: var(--danger);
    font-weight: 600;
}

.actions {
    display: flex;
    gap: var(--space-xs);
}

code {
    font-family: var(--font-mono);
    color: var(--accent);
    background: rgba(49, 130, 206, 0.1);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: var(--space-lg);
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
/* Use will-change for animated elements */
.menu-dropdown,
.toast,
.modal-content {
    will-change: transform, opacity;
}

/* Hardware acceleration for smooth animations */
.btn,
.btn-icon,
.menu-item,
.items-table tbody tr {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduce paint on hover by using transform instead of margin/padding where possible */
.items-table tbody tr:hover {
    transform: translateX(2px) translateZ(0);
}

/* Prevent layout shifts */
.sortable-header::after {
    display: inline-block;
    width: 12px;
    text-align: center;
}

/* Optimize repaints */
.menu-toggle,
.toast-close,
.close {
    contain: layout style paint;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .navbar,
    .controls,
    .actions-menu,
    .toast-container,
    .btn,
    .modal {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .list-container,
    .stat-card {
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .items-table {
        page-break-inside: auto;
    }

    .items-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

.price-chart-container {
    position: relative;
    height: 300px;
    padding: 15px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    margin: var(--space-lg) auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

#priceChart {
    width: 100% !important;
    height: 100% !important;
}

.chart-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.chart-stats .stat {
    text-align: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.chart-stats .stat-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}

.chart-stats .stat-value {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.chart-stats .positive {
    color: #10B981;
}

.chart-stats .negative {
    color: #EF4444;
}

.no-data {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 60px 0;
    font-size: 14px;
}

/* Responsive design for modal chart */
@media (max-width: 768px) {
    .price-chart-container {
        height: 250px;
        padding: 10px;
    }

    .chart-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .modal-content.large {
        margin: 5%;
        width: 90%;
    }
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.toggle-input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: var(--text-on-accent);
}

.toggle-input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.2);
    border-color: var(--accent);
}

.toggle-input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.toggle-input:disabled + .toggle-slider::before {
    background: var(--text-muted);
}

/* Hover effects */
.toggle-input:not(:disabled):hover + .toggle-slider {
    border-color: var(--border-light);
}

.toggle-input:not(:disabled):checked:hover + .toggle-slider {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* With labels */
.toggle-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.toggle-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.toggle-container .toggle-label {
    margin-bottom: 0;
}

/* For use in forms */
.form-group .toggle-container {
    margin-bottom: 0;
}

/* Animation enhancements */
.toggle-slider::before {
    will-change: transform;
    backface-visibility: hidden;
}

.toggle-input:checked + .toggle-slider {
    animation: togglePulse 0.3s ease;
}

@keyframes togglePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(49, 130, 206, 0.4);
    }
    70% {
        box-shadow: 0 0 0 4px rgba(49, 130, 206, 0);
    }
    100% {
        box-shadow: none;
    }
}

.form-group.hidden {
    display: none;
}