/* RepairCRM Pro - Modern Glassmorphism Styles */

:root {
    /* Default Theme - Soft Ocean */
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --background-start: #0f172a;
    --background-end: #1e293b;
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: rgba(248, 250, 252, 0.85);
    --text-muted: rgba(248, 250, 252, 0.65);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --hover-overlay: rgba(255, 255, 255, 0.05);
    --active-overlay: rgba(255, 255, 255, 0.1);
}

/* Theme: Midnight Ocean */
body[data-theme="midnight"] {
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
    --background-start: #0c1222;
    --background-end: #1a2332;
    --glass-bg: rgba(12, 18, 34, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
}

/* Theme: Forest Green */
body[data-theme="forest"] {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    --background-start: #0f1810;
    --background-end: #1a2618;
    --glass-bg: rgba(15, 24, 16, 0.85);
    --glass-border: rgba(16, 185, 129, 0.25);
}

/* Theme: Sunset */
body[data-theme="sunset"] {
    --primary-gradient: linear-gradient(135deg, #f59e0b 0%, #f97316 50%, #ef4444 100%);
    --background-start: #1a1410;
    --background-end: #2a1f18;
    --glass-bg: rgba(26, 20, 16, 0.85);
    --glass-border: rgba(245, 158, 11, 0.25);
}

/* Theme: Royal Purple */
body[data-theme="royal"] {
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    --background-start: #1a0f2e;
    --background-end: #2a1a3e;
    --glass-bg: rgba(26, 15, 46, 0.85);
    --glass-border: rgba(139, 92, 246, 0.25);
}

/* Theme: Rose Gold */
body[data-theme="rose"] {
    --primary-gradient: linear-gradient(135deg, #ec4899 0%, #db2777 50%, #be185d 100%);
    --background-start: #1f0a14;
    --background-end: #2f1524;
    --glass-bg: rgba(31, 10, 20, 0.85);
    --glass-border: rgba(236, 72, 153, 0.25);
}

/* Theme: Light Mode */
body[data-theme="light"] {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --background-start: #f8fafc;
    --background-end: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: rgba(15, 23, 42, 0.7);
    --text-muted: rgba(15, 23, 42, 0.5);
    --hover-overlay: rgba(0, 0, 0, 0.03);
    --active-overlay: rgba(0, 0, 0, 0.06);
}

/* Theme: Arctic */
body[data-theme="arctic"] {
    --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #0891b2 50%, #0e7490 100%);
    --background-start: #0a1419;
    --background-end: #152229;
    --glass-bg: rgba(10, 20, 25, 0.85);
    --glass-border: rgba(6, 182, 212, 0.25);
}

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

/* 3D Animation Keyframes */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) translateZ(0);
    }
    50% {
        transform: translateY(-10px) translateZ(5px);
    }
}

@keyframes floatSubtle {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

html {
    background-color: var(--background-start);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
    background-color: var(--background-start);
}

.gradient-bg {
    background: linear-gradient(to bottom right, var(--background-start), var(--background-end));
    min-height: 100vh;
    padding: 16px;
    padding-top: 200px;
    transition: background 0.5s ease;
    position: relative;
    z-index: 0;
}

/* Glass morphism effect with enhanced 3D depth */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 10px 15px rgba(0, 0, 0, 0.1),
        0 20px 25px rgba(0, 0, 0, 0.1),
        0 30px 60px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: auto;
    transform: translateZ(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-card:hover {
    transform: translateY(-4px) translateZ(10px);
    box-shadow:
        0 8px 12px rgba(0, 0, 0, 0.1),
        0 16px 24px rgba(0, 0, 0, 0.15),
        0 32px 48px rgba(0, 0, 0, 0.18),
        0 48px 80px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Main content cards should stay below navigation */
.main-content .glass-card {
    z-index: 0;
}

/* Navigation needs to allow dropdown overflow */
.glass-card.navigation {
    overflow: visible !important;
}

/* Unified Header - combines header and navigation with enhanced 3D depth */
.header-unified {
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    border-bottom: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    margin: 16px;
    margin-bottom: 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000 !important;
    overflow: visible;
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.01) 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 4px 8px rgba(0, 0, 0, 0.18),
        0 12px 28px rgba(0, 0, 0, 0.24),
        0 28px 56px rgba(0, 0, 0, 0.22);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--glass-bg);
    border-radius: 16px 16px 0 0;
}

.header-nav {
    border-top: 1px solid var(--glass-border);
    padding: 8px 16px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    background: var(--glass-bg);
    border-radius: 0 0 16px 16px;
}

.header-nav::-webkit-scrollbar {
    height: 6px;
}

.header-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.header-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.header-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Header (legacy fallback) */
.header {
    padding: 16px;
    margin-bottom: 0;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 110 !important;
    margin-left: 16px;
    margin-right: 16px;
}

.app-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
}

/* Navigation */
.navigation {
    padding: 8px !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
    position: fixed !important;
    top: 70px !important;
    left: 16px !important;
    right: 16px !important;
    z-index: 100 !important;
}

/* Mobile navigation scroll indicator */
@media (max-width: 768px) {
    .navigation {
        top: 140px !important;
        left: 8px !important;
        right: 8px !important;
    }

    .navigation::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, var(--glass-bg), transparent);
        pointer-events: none;
        z-index: 1;
    }
}

/* Very narrow screens (Fold outer screen, narrow phones) */
@media (max-width: 480px) {
    .navigation {
        top: 160px !important;
    }
}

/* Extra narrow screens (Portrait mode on very narrow devices) */
@media (max-width: 380px) {
    .navigation {
        top: 180px !important;
    }
}

.nav-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    flex-wrap: nowrap;
    position: relative;
    z-index: 1;
}

/* Custom scrollbar for navigation */
.nav-tabs::-webkit-scrollbar {
    height: 4px;
}

.nav-tabs::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.nav-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-tab {
    padding: 7px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    border-bottom: 2px solid rgba(0, 0, 0, 0.38);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.82);
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.06) 100%);
    transition: all 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.88rem;
    flex-shrink: 0;
    position: relative;
    font-weight: 500;
    z-index: 1;
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.14),
        inset 0 -1px 2px rgba(0, 0, 0, 0.18),
        0 2px 4px rgba(0, 0, 0, 0.22),
        0 4px 10px rgba(0, 0, 0, 0.15);
}

.nav-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    background: transparent;
    transition: all 0.18s ease;
    pointer-events: none;
    z-index: -1;
}

.nav-tab:hover {
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.16) 0%, rgba(0, 0, 0, 0.12) 100%);
    border-top-color: rgba(255, 255, 255, 0.38);
    border-bottom-color: rgba(0, 0, 0, 0.65);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.16),
        inset 0 -1px 2px rgba(0, 0, 0, 0.35),
        0 4px 8px rgba(0, 0, 0, 0.38),
        0 8px 18px rgba(0, 0, 0, 0.28);
}

.nav-tab:hover::before {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
}

.nav-tab:active {
    transform: translateY(1px);
    border-top-color: rgba(255, 255, 255, 0.12);
    border-bottom-width: 1px;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.25),
        0 1px 3px rgba(0, 0, 0, 0.2);
}

.nav-tab.active {
    background: linear-gradient(170deg, rgba(99, 155, 255, 0.22) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: rgba(99, 155, 255, 0.2);
    border-top: 1px solid rgba(139, 185, 255, 0.5);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    color: #e0eeff;
    font-weight: 600;
    box-shadow:
        inset 0 1px 2px rgba(139, 185, 255, 0.18),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.35),
        0 6px 16px rgba(0, 0, 0, 0.25),
        0 0 12px rgba(99, 155, 255, 0.12);
}

.nav-tab.active::before {
    background: linear-gradient(160deg, rgba(139, 185, 255, 0.1) 0%, transparent 55%);
}

/* Navigation Dropdown */
.nav-item {
    position: relative !important;
    display: inline-block;
    z-index: 1 !important;
}

.nav-item:hover {
    z-index: 100 !important;
}

.nav-item .nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Prevent transform on dropdown parent tabs to avoid hover gap */
.nav-item:hover .nav-tab {
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.16) 0%, rgba(0, 0, 0, 0.12) 100%);
    border-top-color: rgba(255, 255, 255, 0.38);
    color: var(--text-primary);
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(30, 41, 59, 0.98) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 2px solid rgba(102, 126, 234, 0.8) !important;
    border-radius: 16px !important;
    min-width: 180px !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.2),
        0 16px 32px rgba(0, 0, 0, 0.25),
        0 24px 48px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0) scale(0.95);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    padding: 8px 0 !important;
    pointer-events: none;
    will-change: opacity, transform;
}

/* Arrow pointing to parent button */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid rgba(102, 126, 234, 0.8);
    z-index: 1;
}

.nav-dropdown::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 22px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(30, 41, 59, 0.98);
    z-index: 2;
}



.nav-item:hover .nav-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    transition-delay: 0s !important;
    pointer-events: auto !important;
}

/* When moved to body, .show class must work standalone */
.nav-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    transition-delay: 0s !important;
    pointer-events: auto !important;
    display: block !important;
}

.nav-dropdown-item {
    display: block !important;
    padding: 12px 20px !important;
    color: rgba(255, 255, 255, 0.95) !important;
    text-decoration: none !important;
    transition: background 0.2s ease;
    font-size: 0.95rem !important;
    white-space: nowrap;
    position: relative;
    line-height: 1.5 !important;
}

.nav-dropdown-item:only-child,
.nav-dropdown-item:first-child:last-child {
    border-radius: 12px;
}

.nav-dropdown-item:first-child:not(:last-child) {
    border-radius: 12px 12px 0 0;
}

.nav-dropdown-item:last-child:not(:first-child) {
    border-radius: 0 0 12px 12px;
}

.nav-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.nav-dropdown-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}


/* Main Content */
.main-content {
    padding: 24px;
    position: relative;
    z-index: 0;
}

/* Buttons with enhanced 3D effects */
.btn {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.1),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    position: relative;
    transform: translateY(0) translateZ(0);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
    z-index: -1;
}

.btn:hover {
    transform: translateY(-4px) translateZ(10px) scale(1.02);
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.15),
        0 12px 24px rgba(0, 0, 0, 0.2),
        0 20px 40px rgba(102, 126, 234, 0.3),
        inset 0 -2px 0 rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn:active {
    transform: translateY(-1px) translateZ(5px) scale(0.98);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

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

.btn-primary {
    background: var(--primary-gradient);
}

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

.btn-success {
    background: var(--rx-success-solid, #22c55e);
}

.btn-warning {
    background: var(--rx-warning-solid, #fbbf24);
}

.btn-danger {
    background: var(--rx-danger-solid, #f87171);
}

.btn-info {
    background: var(--rx-brand, #3b82f6);
}

/* Forms */
.form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 12px 16px;
    width: 100%;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 4px 8px rgba(0, 0, 0, 0.05),
        0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
}

/* Select dropdowns */
select.form-input {
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
}

select.form-input option {
    background: var(--background-end);
    color: var(--text-primary);
    padding: 8px;
}

/* For light theme, ensure options have proper contrast */
body[data-theme="light"] select.form-input option {
    background: var(--rx-raised, #ffffff);
    color: var(--rx-text, #0f172a);
}

.form-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.8);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 4px 8px rgba(0, 0, 0, 0.04),
        0 0 0 4px rgba(102, 126, 234, 0.15),
        0 4px 12px rgba(102, 126, 234, 0.2),
        0 8px 20px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

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

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

/* Grid Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

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

/* Stat Cards with enhanced 3D depth */
.stat-card {
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.14) 0%, var(--glass-bg) 40%, rgba(0, 0, 0, 0.08) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 2px solid rgba(255, 255, 255, 0.65);
    border-bottom: 3px solid rgba(0, 0, 0, 0.7);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 0;
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.12),
        0 4px 6px rgba(0, 0, 0, 0.25),
        0 10px 20px rgba(0, 0, 0, 0.35),
        0 24px 44px rgba(0, 0, 0, 0.3),
        0 40px 60px rgba(0, 0, 0, 0.2);
    transform: translateZ(0);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 14px;
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.12) 0%, transparent 40%, rgba(0, 0, 0, 0.08) 100%);
    pointer-events: none;
    z-index: 0;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.01);
    border-top-color: rgba(255, 255, 255, 0.6);
    border-bottom-color: rgba(0, 0, 0, 0.65);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.15),
        0 6px 10px rgba(0, 0, 0, 0.3),
        0 16px 32px rgba(0, 0, 0, 0.4),
        0 32px 56px rgba(0, 0, 0, 0.32),
        0 52px 72px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.9;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: floatSubtle 6s ease-in-out infinite;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 4px;
}

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

.stat-change {
    font-size: 0.8rem;
    color: var(--success);
}

/* Dashboard Sections with enhanced 3D depth */
.dashboard-section {
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.13) 0%, var(--glass-bg) 40%, rgba(0, 0, 0, 0.08) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid rgba(255, 255, 255, 0.62);
    border-bottom: 3px solid rgba(0, 0, 0, 0.68);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    z-index: 0;
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.1),
        0 4px 6px rgba(0, 0, 0, 0.22),
        0 10px 20px rgba(0, 0, 0, 0.32),
        0 24px 44px rgba(0, 0, 0, 0.28),
        0 40px 60px rgba(0, 0, 0, 0.18);
    transform: translateZ(0);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dashboard-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 14px;
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.1) 0%, transparent 40%, rgba(0, 0, 0, 0.07) 100%);
    pointer-events: none;
    z-index: 0;
}

.dashboard-section:hover {
    transform: translateY(-5px) scale(1.005);
    border-top-color: rgba(255, 255, 255, 0.58);
    border-bottom-color: rgba(0, 0, 0, 0.62);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.13),
        0 6px 10px rgba(0, 0, 0, 0.28),
        0 16px 32px rgba(0, 0, 0, 0.38),
        0 32px 56px rgba(0, 0, 0, 0.3),
        0 52px 72px rgba(0, 0, 0, 0.18);
}

.section-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.section-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.14) 0%, var(--glass-bg) 45%, rgba(0, 0, 0, 0.08) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid rgba(255, 255, 255, 0.62);
    border-bottom: 3px solid rgba(0, 0, 0, 0.68);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.1),
        0 4px 6px rgba(0, 0, 0, 0.25),
        0 10px 18px rgba(0, 0, 0, 0.32),
        0 20px 32px rgba(0, 0, 0, 0.22);
}

.action-btn:hover {
    transform: translateY(-6px) scale(1.04);
    border-top-color: rgba(255, 255, 255, 0.58);
    border-bottom-color: rgba(0, 0, 0, 0.62);
    box-shadow:
        inset 0 2px 3px rgba(255, 255, 255, 0.14),
        0 6px 10px rgba(0, 0, 0, 0.3),
        0 14px 26px rgba(0, 0, 0, 0.38),
        0 28px 46px rgba(0, 0, 0, 0.28);
}

.action-btn:active {
    transform: translateY(1px) scale(0.98);
    border-top-color: rgba(255, 255, 255, 0.2);
    border-bottom-width: 1px;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.2);
}

.action-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.action-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Ticket List */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.ticket-number {
    font-weight: bold;
    font-size: 0.9rem;
}

.ticket-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.ticket-info {
    margin-bottom: 8px;
}

.ticket-customer {
    font-weight: 500;
    margin-bottom: 2px;
}

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

.ticket-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ticket-cost {
    font-weight: 500;
    color: var(--success);
}

/* Status Breakdown */
.status-breakdown {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-count {
    font-size: 1.5rem;
    font-weight: bold;
}

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

.status-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.status-progress {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Low Stock */
.low-stock-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.low-stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.item-info {
    flex: 1;
}

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

.item-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.item-stock {
    text-align: right;
}

.stock-count {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
}

.low-stock {
    background: rgba(251, 191, 36, 0.2);
    color: var(--rx-warning, #fbbf24);
}

.out-of-stock {
    background: rgba(248, 113, 113, 0.2);
    color: var(--rx-danger, #f87171);
}

/* Tables with enhanced 3D depth */
.table-responsive {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 12px;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.08),
        0 6px 12px rgba(0, 0, 0, 0.1),
        0 12px 24px rgba(0, 0, 0, 0.08);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--glass-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

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

.data-table th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: var(--text-primary);
}

.data-table td {
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    box-shadow:
        inset 4px 0 0 rgba(102, 126, 234, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Status and Priority Badges */
.status-badge,
.priority-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge {
    background: rgba(255, 255, 255, 0.1);
}

/* Actions */
.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Z-Index Scale Reference:
 * 0       - Base layers (backgrounds, cards)
 * 1-10    - Relative positioned elements
 * 100     - Navigation bar (fixed)
 * 110     - Header (fixed, above nav)
 * 200     - Dropdowns, selects
 * 1000    - Modal overlays
 * 1010    - Modal content
 * 1020    - Nested modals (modals opened from modals)
 * 2000    - SweetAlert2 container
 * 2100    - SweetAlert2 popup/toast
 */

/* Modals with enhanced 3D depth */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding-top: 80px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 40px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    position: relative;
    z-index: 1010;
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.15),
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 40px 80px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%, rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Nested modals (opened from within another modal) */
.modal-overlay.modal-nested {
    z-index: 1020;
}

.modal-overlay.modal-nested .modal-content {
    z-index: 1030;
}

/* Custom autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.2));
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000020;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary, #fff);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.08));
}

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

.autocomplete-item:hover {
    background: var(--hover-bg, rgba(255,255,255,0.1));
}

/* For small/medium modals, add padding to overlay */
.modal-content.modal-small,
.modal-content.modal-medium {
    margin: 20px;
}

.modal-medium {
    max-width: 600px;
}

.modal-large {
    max-width: 90vw;
    max-height: 95vh;
    width: 90vw;
    height: auto;
    min-height: 50vh;
    margin-top: 2vh;
    margin-bottom: 2vh;
    display: flex;
    flex-direction: column;
}

.modal-large .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* On mobile, make it slightly larger */
@media (max-width: 768px) {
    .modal-large {
        max-width: 95vw;
        max-height: 96vh;
        width: 95vw;
        margin-top: 2vh;
    }
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-secondary);
}

.modal-body {
    color: var(--text-primary);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    transition: opacity 0.3s ease;
}

.alert-success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--rx-success, #22c55e);
}

.alert-error {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--rx-danger, #f87171);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--rx-warning, #fbbf24);
}

.alert-info {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--rx-link, #3b82f6);
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 12px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

/* Page Titles */
.page-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 0;
}

.card:hover {
    transform: translateY(-2px);
}

.card-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-content {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 24px 0;
}

.page-link {
    padding: 8px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.page-link.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.page-dots {
    padding: 8px 4px;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .gradient-bg {
        padding: 12px;
        padding-top: 180px;
    }

    .header {
        margin-left: 8px;
        margin-right: 8px;
    }

    .header-unified {
        margin: 8px;
    }

    .header-top {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-nav {
        padding: 6px 12px;
    }

    .main-content {
        padding: 16px;
    }
}

/* Very narrow screens adjustments */
@media (max-width: 480px) {
    .gradient-bg {
        padding-top: 200px;
    }

    .app-title {
        font-size: 1.1rem !important;
    }

    .header-unified {
        margin: 6px;
    }

    .header-top {
        padding: 10px;
    }
}

/* Extra narrow screens (Fold outer screen) */
@media (max-width: 380px) {
    .gradient-bg {
        padding-top: 220px;
    }

    .app-title {
        font-size: 1rem !important;
    }

    .header {
        padding: 12px !important;
        margin-left: 6px;
        margin-right: 6px;
    }

    .header-unified {
        margin: 4px;
    }

    .header-top {
        padding: 8px;
    }

    .user-button span:first-of-type {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .nav-tabs {
        justify-content: flex-start;
        padding: 4px 0;
    }

    .nav-tab {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .nav-dropdown {
        left: 0;
        right: auto;
        min-width: 160px;
    }

    .nav-dropdown-item {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    .modal-content {
        margin: 10px;
        padding: 20px;
    }
    
    .actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .ticket-header,
    .ticket-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .low-stock-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .item-stock {
        text-align: left;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Focus styles for accessibility */
.btn:focus,
.form-input:focus,
.nav-tab:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* SweetAlert2 z-index - toasts and alerts above modals */
.swal2-container {
    z-index: 2000 !important;
}

.swal2-popup {
    z-index: 2100 !important;
}

/* High z-index class for SweetAlert2 when opened from within modals */
.swal-high-zindex,
.swal2-container.swal-high-zindex,
.swal2-backdrop-show.swal-high-zindex {
    z-index: 2000 !important;
}

.swal2-container.swal-high-zindex .swal2-popup {
    z-index: 2100 !important;
}

/* Toast styling improvements */
.swal2-toast .swal2-close {
    font-size: 1.5em;
    color: inherit;
    opacity: 0.7;
}

.swal2-toast .swal2-close:hover {
    opacity: 1;
}

/* Print styles */
@media print {
    .gradient-bg {
        background: white !important;
        color: black !important;
    }
    
    .glass-card {
        background: white !important;
        border: 1px solid var(--rx-border, #ccc) !important;
        box-shadow: none !important;
    }
    
    .nav-tabs,
    .btn,
    .actions {
        display: none !important;
    }
}
