/* ================================================================
   MODERN UI/UX DESIGN SYSTEM 2026
   Glassmorphism + Soft Gradients + Micro-animations
   Fully Responsive with Premium Card-based Mobile View
   ================================================================ */

/* ==================== FONTS ==================== */
@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/fonts/webfonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('./fonts/fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ==================== CSS VARIABLES ==================== */
/* ==================== CSS VARIABLES ==================== */
:root {
    /* --- Base Colors (Palette) --- */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-400: #60a5fa;
    --primary-500: #1e40af;
    --primary-600: #1d4ed8;
    --primary-700: #1e3a8a;

    --accent-orange: #ea580c;
    --accent-green: #15803d;

    --success-400: #4ade80;
    --success-500: #22c55e;
    --success-600: #16a34a;

    --danger-400: #f87171;
    --danger-500: #ef4444;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    /* --- Semantic Theme Variables (Dark Default) --- */
    --bg-body: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #111827 100%);
    --bg-surface: #0f172a;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-strong: rgba(15, 23, 42, 0.6);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);

    --text-primary: var(--gray-100);
    --text-secondary: var(--gray-400);
    --text-muted: var(--gray-500);

    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-strong: rgba(255, 255, 255, 0.15);

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.1);

    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);

    --card-bg-gradient: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    --card-header-bg: linear-gradient(90deg, rgba(30, 64, 175, 0.15) 0%, transparent 100%);
    --card-footer-bg: rgba(16, 185, 129, 0.08);

    --table-header-bg: rgba(30, 64, 175, 0.9);
    --table-row-hover: rgba(255, 255, 255, 0.04);

    --toolbar-bg: rgba(15, 23, 42, 0.6);

    /* Typography */
    --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== LIGHT THEME ==================== */
[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-glass: #ffffff;
    --bg-glass-strong: rgba(255, 255, 255, 0.98);
    --bg-glass-hover: #f1f5f9;

    --text-primary: #0f172a;
    /* Slate 900 */
    --text-secondary: #334155;
    /* Slate 700 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border-glass: #e2e8f0;
    /* Slate 200 */
    --border-glass-strong: #cbd5e1;
    /* Slate 300 */

    --shadow-glass: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);

    --input-bg: #ffffff;
    --input-border: #cbd5e1;

    --card-bg-gradient: #ffffff;
    --card-header-bg: #f8fafc;
    --card-footer-bg: #f0fdf4;
    /* Very light green footer */

    --table-header-bg: #1e3a8a;
    /* Keep dark blue but solid */
    --table-row-hover: #f1f5f9;

    --toolbar-bg: rgba(255, 255, 255, 0.9);

    /* Manual overrides for specific badges/elements that need darker contrast in light mode */
    --success-400: #15803d;
    /* Darken green for visibility */
    --primary-400: #1d4ed8;
    /* Darken blue for visibility */
}

/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none !important;
}

@media (max-width: 900px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: grid !important;
    }
}

/* ==================== MOBILE CARDS ==================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    padding: var(--space-5);
}

.product-card {
    background: var(--card-bg-gradient);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.7rem;
    box-shadow: var(--shadow-card);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-400);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    /* Keep dynamic shadow slightly manual or make variable */
}

.product-card:hover::before {
    opacity: 1;
}

.card-header {
    padding: 6px 8px;
    background: var(--card-header-bg);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 52px;
}

.card-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.card-code {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.65rem;
    color: var(--primary-400);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    background: rgba(99, 102, 241, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    align-self: flex-start;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.card-body {
    padding: 6px 8px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.card-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    background: transparent;
}

.card-field-label {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
}

.card-field-value {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.card-footer {
    padding: 6px 8px;
    background: var(--card-footer-bg);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
}

.final-price-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.final-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--success-400);
}

/* ==================== PAGE SYSTEM ==================== */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
    animation: pageIn 0.4s ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== LOGIN PAGE ==================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

/* Animated Background Blobs */
.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blobFloat 20s ease-in-out infinite;
    transition: opacity var(--transition-slow);
}

[data-theme="light"] .blob {
    opacity: 0.15;
    filter: blur(100px);
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--primary-600), var(--accent-orange));
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--accent-green), var(--primary-500));
    bottom: -100px;
    left: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-green));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes blobFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

/* Login Card */
.login-card {
    position: relative;
    z-index: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-glass);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.logo-wrapper-premium {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(30, 64, 175, 0.3));
    animation: logoFloat 4s ease-in-out infinite;
}

.logo-glow {
    position: absolute;
    inset: -10px;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.4) 0%, rgba(234, 88, 12, 0.2) 50%, transparent 100%);
    filter: blur(20px);
    z-index: 1;
    border-radius: 50%;
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0) scale(1.02);
    }

    50% {
        transform: translateY(-10px) scale(1);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.premium-title {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, var(--primary-600), var(--accent-orange));
    /* Stronger gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.premium-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

/* Form Fields */
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-container {
    position: relative;
}

.input-container svg {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-container input {
    width: 100%;
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-4);
    padding-right: calc(var(--space-4) + 28px);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    outline: none;
}

.input-container input::placeholder {
    color: var(--text-muted);
}

.input-container input:focus {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-container:focus-within svg {
    color: var(--primary-400);
}

/* Login Button */
.form-actions {
    margin: var(--space-4) 0;
    display: flex;
    justify-content: flex-start;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-400);
    user-select: none;
}

.remember-me input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-500);
    cursor: pointer;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
    margin-top: var(--space-2);
}

.btn-login svg {
    width: 20px;
    height: 20px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* Login Footer */
.login-footer {
    margin-top: var(--space-8);
    text-align: center;
}

.btn-settings-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.btn-settings-link svg {
    width: 18px;
    height: 18px;
}

.btn-settings-link:hover {
    color: var(--primary-400);
}

/* ==================== DASHBOARD ==================== */
/* Top Navigation */
.top-nav {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nav-logo-premium {
    height: 80px;
    /* Increased to match text group height */
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    overflow: visible;
}

.nav-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-name {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: var(--text-primary);
    background: none;
    -webkit-text-fill-color: initial;
}

.brand-tagline {
    font-size: 0.75rem !important;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.btn-icon:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-glass-strong);
}

.btn-icon.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-400);
    border-color: rgba(239, 68, 68, 0.2);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
}

.update-action-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.fetch-time {
    position: absolute;
    top: calc(100% + 4px);
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar svg {
    width: 22px;
    height: 22px;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.user-info .user-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-info .user-phone {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* Dashboard Content */
.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-card.stat-primary .stat-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(129, 140, 248, 0.1));
    color: var(--primary-400);
}

.stat-card.stat-success .stat-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(74, 222, 128, 0.1));
    color: var(--success-400);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Toolbar Redesign - Modern Floating Glass */
/* Toolbar Redesign - Modern Floating Glass */
.toolbar {
    margin-bottom: var(--space-6);
    background: var(--toolbar-bg);
    /* Slate-900 with transparency */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-glass);
    z-index: 80;
    position: sticky;
}

#dashboardPage .toolbar {
    top: 90px;
}

.toolbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.controls-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 500px;
    /* Increased slightly */
}

.results-badge {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    /* Force primary for now */
    border: 1px solid var(--border-glass-strong);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    transition: all 0.3s ease;
}

.count-val {
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-400);
}

.count-label {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-weight: 500;
}

.search-box svg {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

@keyframes badgePop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.badge-animate {
    animation: badgePop 0.3s ease-out;
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    padding-right: 52px;
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-box input:focus {
    background: var(--bg-glass-hover);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.results-badge {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass-strong);
    padding: 0 14px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

/* Primary style for the count badge */
#productCount {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    border: none;
    color: white;
}

#productCount .count-val {
    color: white;
}

#productCount .badge-icon {
    color: white;
}

.badge-icon {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
}

.count-val {
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-400);
}

/* Products Section */
.products-section {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    /* Back to hidden to clip the table scrollbar */
}

/* State Overlays */
.state-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10;
}

.state-overlay p {
    color: var(--gray-400);
    font-size: 1rem;
}

/* Loader */
.loader {
    position: relative;
    width: 60px;
    height: 60px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: loaderSpin 1.2s linear infinite;
}

.loader-ring:nth-child(2) {
    inset: 8px;
    border-top-color: var(--primary-400);
    animation-duration: 1s;
    animation-direction: reverse;
}

.loader-ring:nth-child(3) {
    inset: 16px;
    border-top-color: var(--primary-300);
    animation-duration: 0.8s;
}

@keyframes loaderSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-icon {
    width: 80px;
    height: 80px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--primary-400);
}

/* Data Table - Premium Redesign */
.table-wrapper {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    overflow-x: auto;
    background: var(--bg-glass-hover);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    padding: var(--space-4) var(--space-5);
    text-align: right;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-300);
    background: var(--table-header-bg) !important;
    /* Premium Blue */
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent-orange);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: var(--space-4) var(--space-5);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.data-table tbody tr {
    animation: fadeInRow 0.5s ease backwards;
}

.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.data-table tbody tr:hover td {
    color: var(--text-primary);
}

.product-name {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 1rem;
}

.product-code {
    font-size: 0.75rem;
    color: var(--primary-400);
    background: rgba(30, 64, 175, 0.1);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
}

.price-highlight {
    color: var(--success-400) !important;
    font-weight: 800;
    font-size: 1rem;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== PREMIUM CARDS ==================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-6);
    padding: var(--space-2) 0;
}

.product-card {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: cardReveal 0.6s cubic-bezier(0.23, 1, 0.32, 1) backwards;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-400);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(30, 64, 175, 0.15);
}

.card-header {
    padding: var(--space-5);
    background: linear-gradient(90deg, rgba(30, 64, 175, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-glass);
    position: relative;
    /* Fixed reference */
}

.card-header-main {
    padding-left: 40px;
    /* Space for the floating button on the left */
}

.btn-card-details {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-glass-strong);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-card);
    z-index: 5;
    opacity: 0.6;
    /* More minimal until hover */
}

.btn-card-details:hover {
    opacity: 1;
    background: var(--primary-500);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-card-details svg {
    width: 16px;
    height: 16px;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent-orange);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.card-code {
    font-size: 0.75rem;
    color: var(--primary-400);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-body {
    padding: var(--space-5);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-field-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
}

.card-field-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 700;
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: rgba(16, 185, 129, 0.08);
    /* Emerald Tint */
    border-top: 1px solid rgba(16, 185, 129, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.final-price-label {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 500;
}

.final-price {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--success-400);
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.final-price-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ==================== MODAL ==================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 2000;
    /* High index */
    overflow-y: auto;
}

@media (max-width: 768px) {
    .modal-backdrop {
        align-items: flex-start;
        padding: 0;
    }
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    /* Header handles sticky, but we want rounded corners clipping */
}

@media (max-width: 768px) {
    .details-modal-card {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 10;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-close svg {
    width: 20px;
    height: 20px;
}

.btn-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-400);
}

.modal-body {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.api-url-preview {
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.api-url-preview span {
    color: var(--gray-500);
    display: block;
    margin-bottom: var(--space-2);
}

.api-url-preview code {
    color: var(--primary-400);
    word-break: break-all;
}

.modal-footer {
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-strong);
}

/* ==================== PREMIUM NOTIFICATION ==================== */
.premium-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.premium-modal {
    background: linear-gradient(165deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
    animation: premiumModalEntry 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes premiumModalEntry {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(40px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.premium-modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
}

.premium-modal-icon svg {
    width: 48px;
    height: 48px;
}

/* Success Animation: Drawing Checkmark */
.type-success .premium-modal-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.path-success {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawCheck 0.6s ease-in-out 0.3s forwards;
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

/* Error Animation: Shaking Heartbeat */
.type-error .premium-modal-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
    animation: iconShake 0.5s ease-in-out 0.2s;
}

@keyframes iconShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

.premium-modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.premium-modal-desc {
    font-size: 0.95rem;
    color: var(--gray-400);
    margin-bottom: 32px;
    line-height: 1.6;
}

.premium-modal-btn {
    background: white;
    color: #0f172a;
    border: none;
    padding: 12px 48px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-modal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.type-success .premium-modal-btn {
    background: #22c55e;
    color: white;
}

.type-error .premium-modal-btn {
    background: #ef4444;
    color: white;
}

.premium-modal-timer {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    width: 100%;
    opacity: 0.3;
}

.type-success .premium-modal-timer {
    background: #22c55e;
}

.type-error .premium-modal-timer {
    background: #ef4444;
}

.timer-shrink {
    animation: shrinkWidth 5s linear forwards;
}

/* ==================== DETAILS MODAL ==================== */
.details-modal-card {
    max-width: 550px;
}

@media (max-width: 600px) {
    .modal-backdrop {
        padding: 0;
        align-items: flex-end;
        /* Slide up feel */
    }

    .details-modal-card {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .modal-header {
        padding: 12px 16px;
        height: 60px;
        flex-shrink: 0;
    }

    .btn-close {
        width: 44px;
        /* Larger tap target */
        height: 44px;
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 16px;
        gap: 16px;
    }

    .details-name {
        font-size: 1.15rem;
    }

    .details-info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .info-item {
        padding: 10px;
    }

    .info-value {
        font-size: 0.85rem;
    }

    .details-pricing {
        padding: 12px;
    }

    .price-row {
        font-size: 0.85rem;
    }

    .price-val.highlight {
        font-size: 1.2rem;
    }

    .modal-footer {
        padding: 12px 16px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-glass);
        flex-shrink: 0;
    }
}

@media (max-width: 400px) {
    .details-info-grid {
        grid-template-columns: 1fr;
    }
}

.details-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.details-main-info {
    text-align: center;
    padding-bottom: var(--space-4);
    border-bottom: 1px dashed var(--border-glass-strong);
}

.details-name {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.details-badge {
    display: inline-block;
    padding: 4px 16px;
    background: var(--primary-500);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
}

.details-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-glass-hover);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.info-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.details-price-divider {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary-400);
    display: flex;
    align-items: center;
    gap: 12px;
}

.details-price-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass-strong);
}

.details-pricing {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.price-val {
    font-weight: 700;
    font-family: 'Vazirmatn', sans-serif;
}

.discount-val {
    color: var(--danger-400);
}

.total-price-row {
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 2px solid var(--border-glass);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.price-val.highlight {
    color: var(--success-400);
    font-weight: 900;
    font-size: 1.3rem;
}

.btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-sm:hover {
    background: var(--primary-500);
    color: white;
    border-color: var(--primary-500);
}

.btn-icon-sm svg {
    width: 18px;
    height: 18px;
}

/* Dashboard Footer */
.dashboard-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-glass);
    padding: var(--space-6) 0;
    margin-top: var(--space-10);
    opacity: 0.9;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    text-align: center;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
}

.footer-contact {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-contact .divider {
    color: var(--border-glass-strong);
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {

    /* Main Layout Shift */
    .nav-container {
        padding: var(--space-2) var(--space-4);
        flex-direction: column;
        gap: var(--space-2);
        height: auto;
        align-items: stretch;
    }

    /* Top Row: Brand & Logo */
    .nav-brand {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: var(--space-3);
        width: 100%;
        padding-bottom: 0;
        border-bottom: none;
    }

    .nav-logo-premium {
        width: auto;
        height: 60px;
        /* Increased for mobile visibility */
        padding: 0;
        border: none;
        background: transparent;
        flex-shrink: 0;
    }

    .brand-name {
        font-size: 1.15rem !important;
        white-space: nowrap;
        color: var(--text-primary);
        background: none;
        -webkit-text-fill-color: initial;
    }

    .brand-tagline {
        display: none;
        /* Keep hidden on mobile top row */
    }

    /* Bottom Row: User & Actions */
    .nav-actions {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        background: rgba(255, 255, 255, 0.03);
        padding: 4px;
        border-radius: var(--radius-md);
    }

    .user-chip {
        flex: 1;
        justify-content: flex-start;
        padding: 0;
        background: transparent;
        border: none;
        gap: var(--space-3);
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        box-shadow: 0 0 15px rgba(30, 64, 175, 0.3);
    }

    .user-info {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .user-info .user-name {
        font-size: 0.85rem;
        color: var(--text-primary);
        font-weight: 700;
        display: block !important;
    }

    .user-info .user-phone {
        font-size: 0.75rem;
        color: var(--primary-400);
        font-weight: 500;
        display: block !important;
    }

    /* Compact icons for secondary row */
    .btn-icon {
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-md);
    }

    /* Fixed / Frozen Search Panel for Mobile */
    #dashboardPage .toolbar {
        position: sticky;
        top: 120px;
        /* Balanced offset for compact header */
        z-index: 90;
        margin: 4px 0;
        padding: var(--space-3);
        background: var(--bg-surface);
        /* High opacity glass for readability */
        backdrop-filter: blur(15px);
        border: 1px solid var(--border-glass);
        border-radius: var(--radius-md);
        opacity: 0.98;
    }

    /* Adjust main content padding to account for taller header + sticky toolbar */
    .dashboard-content {
        padding-top: var(--space-2);
    }

    .toolbar-content {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
    }

    .controls-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .search-box {
        max-width: 100%;
    }

    .sort-box {
        width: 100%;
    }

    .results-badge {
        height: 38px;
        padding: 0 12px;
        align-self: stretch;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        justify-content: center;
        flex: 1;
        min-width: 0;
        /* Prevent overflow */
    }

    .count-val {
        font-size: 1rem;
    }

    .count-label {
        font-size: 0.75rem;
    }

    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-4);
        padding: var(--space-4);
    }
}

@media (max-width: 400px) {
    .brand-name {
        font-size: 1rem !important;
    }

    .user-info .user-name {
        font-size: 0.75rem;
    }
}

@media (max-width: 400px) {
    .login-card {
        padding: var(--space-6) var(--space-4);
        border-radius: var(--radius-lg);
    }

    .premium-title {
        font-size: 1.5rem;
    }

    .btn-login {
        padding: var(--space-3) var(--space-4);
        font-size: 0.9rem;
    }
}

/* ==================== SORTING & META BADGES ==================== */
.sort-box {
    position: relative;
    width: 240px;
    /* Increased to fix text truncation */
}

.sort-box svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.sort-box select {
    width: 100%;
    padding: 14px 16px;
    padding-right: 42px;
    /* Adjusted for icon */
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sort-box select:focus {
    background: var(--bg-glass-hover);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.sort-box select option {
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 10px;
}

#lastUpdateBadge {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass-strong);
    box-shadow: var(--shadow-card);
}

#lastUpdateBadge .count-label {
    color: var(--text-secondary);
}

#lastUpdateTime {
    color: var(--success-400);
    font-weight: 800;
}

.meta-badges {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .toolbar-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .search-box {
        max-width: 100%;
    }

    .sort-box {
        width: 100%;
    }

    .meta-badges {
        flex-direction: row !important;
        justify-content: center;
        width: 100%;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .results-badge {
        height: 42px;
        padding: 0 12px;
        flex: 1;
        min-width: 0;
        justify-content: center;
    }
}