/* ============================================
   🔮 2026 CRYSTALLINE GLASS DESIGN SYSTEM
   Frosted glass surfaces • Aurora gradients
   Luminous accents • Spring-physics motion
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES — LIGHT THEME
   ============================================ */
:root, [data-theme="light"], [data-bs-theme="light"] {
    /* Primary palette — Indigo Aurora */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-rgb: 99, 102, 241;
    --primary-light: #a5b4fc;
    --primary-surface: rgba(99, 102, 241, 0.08);

    /* Secondary & accent */
    --secondary-color: #64748b;
    --accent-color: #8b5cf6;
    --accent-rgb: 139, 92, 246;

    /* Surfaces */
    --bg-primary: #f0f2f8;
    --bg-secondary: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.72);
    --sidebar-bg: #0f172a;

    /* Glass tokens */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-heavy: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-border-subtle: rgba(0, 0, 0, 0.06);
    --glass-blur: 16px;
    --glass-shadow: 0 8px 32px rgba(99, 102, 241, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    --glass-shadow-lg: 0 16px 48px rgba(99, 102, 241, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);

    /* Interaction */
    --hover-bg: rgba(99, 102, 241, 0.06);
    --active-bg: rgba(99, 102, 241, 0.12);

    /* Text */
    --text-primary: #1e1b4b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Borders */
    --border-color: rgba(148, 163, 184, 0.22);
    --border-color-strong: rgba(148, 163, 184, 0.35);

    /* Status colors */
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    --gradient-accent: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    --gradient-surface: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(139, 92, 246, 0.04) 100%);
    --gradient-header: linear-gradient(135deg, #4f46e5 0%, #6366f1 40%, #7c3aed 100%);

    /* Noise texture (subtle grain for glass surfaces) */
    --noise-texture: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");

    /* Transitions */
    --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-smooth: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   CSS CUSTOM PROPERTIES — DARK THEME
   ============================================ */
[data-theme="dark"], [data-bs-theme="dark"] {
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --primary-rgb: 129, 140, 248;
    --primary-light: #6366f1;
    --primary-surface: rgba(129, 140, 248, 0.1);

    --secondary-color: #94a3b8;
    --accent-color: #a78bfa;
    --accent-rgb: 167, 139, 250;

    --bg-primary: #0b0e1a;
    --bg-secondary: #111827;
    --card-bg: rgba(17, 24, 39, 0.72);
    --sidebar-bg: #060911;

    --glass-bg: rgba(17, 24, 39, 0.6);
    --glass-bg-heavy: rgba(17, 24, 39, 0.82);
    --glass-border: rgba(129, 140, 248, 0.12);
    --glass-border-subtle: rgba(255, 255, 255, 0.06);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(129, 140, 248, 0.06);
    --glass-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(129, 140, 248, 0.08);

    --hover-bg: rgba(129, 140, 248, 0.08);
    --active-bg: rgba(129, 140, 248, 0.15);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(148, 163, 184, 0.12);
    --border-color-strong: rgba(148, 163, 184, 0.2);

    --danger-color: #f87171;
    --success-color: #34d399;
    --warning-color: #fbbf24;
    --info-color: #60a5fa;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.25);

    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);
    --gradient-accent: linear-gradient(135deg, #818cf8 0%, #f472b6 100%);
    --gradient-surface: linear-gradient(135deg, rgba(129, 140, 248, 0.06) 0%, rgba(167, 139, 250, 0.06) 100%);
    --gradient-header: linear-gradient(135deg, #4338ca 0%, #6366f1 40%, #7c3aed 100%);

    --noise-texture: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ============================================
   SMOOTH THEME TRANSITIONS
   ============================================ */
html,
body,
.card,
.form-control,
.form-select,
.btn,
.alert,
.modal-content,
input,
textarea,
select {
    transition: background-color 0.4s var(--spring-smooth), color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

*, *::before, *::after {
    transition: background-color 0.25s ease-in-out,
                border-color 0.25s ease-in-out,
                color 0.2s ease-in-out,
                box-shadow 0.3s ease;
}

/* ============================================
   BASE TYPOGRAPHY
   ============================================ */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15.4px;
    scroll-behavior: smooth;
    letter-spacing: -0.01em;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    background-image: var(--noise-texture);
    background-attachment: fixed;
}

a, .btn-link {
    color: var(--primary-color);
    transition: color 0.2s ease;
}

a:hover, .btn-link:hover {
    color: var(--primary-hover);
}

/* ============================================
   HEADING STYLES
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    line-height: 1.25;
}

h1 {
    font-size: 2.2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: slideInLeft 0.5s var(--spring-smooth);
}

.title-icon {
    display: inline-block;
    -webkit-text-fill-color: initial;
    -webkit-background-clip: initial;
    background-clip: initial;
    background: none;
}

h2 { font-size: 1.7875rem; color: var(--text-primary); }
h3 { font-size: 1.375rem; color: var(--text-primary); }
h4 { font-size: 1.16875rem; color: var(--text-primary); }
h5 { font-size: 1.1rem; color: var(--text-primary); }

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}

h1:focus { outline: none; }

/* ============================================
   CONTENT ANIMATIONS
   ============================================ */
.content {
    padding-top: 1rem;
    animation: fadeIn 0.5s var(--ease-out-expo);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   CRYSTALLINE GLASS BUTTONS
   ============================================ */
.btn {
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 0.5rem;
    transition: all 0.3s var(--spring-bounce);
    position: relative;
    overflow: hidden;
    padding: 0.45rem 1.1rem;
    font-size: 0.9625rem;
    border: 1px solid transparent;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.5s var(--ease-out-expo), height 0.5s var(--ease-out-expo);
}

.btn:hover::before {
    width: 280px;
    height: 280px;
}

.btn-primary {
    color: #fff;
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border: none;
    box-shadow: 0 3px 10px rgba(100, 116, 139, 0.25);
    color: #fff;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.25);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.25);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25);
    color: #fff;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.25);
    color: #fff;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem rgba(var(--primary-rgb), 0.15), 0 0 0 0.22rem rgba(var(--primary-rgb), 0.25);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* ============================================
   GLASS FORM CONTROLS
   ============================================ */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1.5px solid var(--border-color);
    transition: all 0.3s var(--spring-smooth);
    padding: 0.55rem 0.9625rem;
    font-size: 0.9625rem;
    background-color: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Custom Visible Dropdown Arrow for .form-select in both Light & Dark themes */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23818cf8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 14px 10px !important;
    padding-right: 2.25rem !important;
}

[data-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-select {
    background-color: var(--glass-bg);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a78bfa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

[data-theme="light"] .form-select,
[data-bs-theme="light"] .form-select {
    background-color: var(--glass-bg);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234f46e5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

/* Custom Styling for Select Options */
select option,
.form-select option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    padding: 0.6rem 0.8rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
}

/* Light theme options */
[data-theme="light"] select option,
[data-theme="light"] .form-select option,
[data-bs-theme="light"] select option,
[data-bs-theme="light"] .form-select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* Dark theme options */
[data-theme="dark"] select option,
[data-theme="dark"] .form-select option,
[data-bs-theme="dark"] select option,
[data-bs-theme="dark"] .form-select option {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

/* Checked / Active Option */
select option:checked,
.form-select option:checked {
    background-color: #6366f1 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Custom Scrollbar for Dropdown Popup Menu */
select::-webkit-scrollbar,
.form-select::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

select::-webkit-scrollbar-track,
.form-select::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

select::-webkit-scrollbar-thumb,
.form-select::-webkit-scrollbar-thumb {
    background: #818cf8;
    border-radius: 4px;
}

select::-webkit-scrollbar-thumb:hover,
.form-select::-webkit-scrollbar-thumb:hover {
    background: #a78bfa;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1), 0 0 20px rgba(var(--primary-rgb), 0.06);
    transform: translateY(-1px);
    background-color: var(--glass-bg-heavy);
}

.form-floating {
    position: relative;
}

.form-floating > label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9625rem;
}

/* Switches & Checkboxes Theme Alignment */
.form-check-input:checked {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.35);
}

.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
}

.category-header {
    background: var(--gradient-header, linear-gradient(135deg, #4338ca 0%, #6366f1 40%, #7c3aed 100%)) !important;
    color: white !important;
    border-bottom: none !important;
}

/* ============================================
   VALIDATION STYLES
   ============================================ */
.valid.modified:not([type=checkbox]) {
    outline: 1.5px solid #10b981;
    outline-offset: 1.5px;
}

.invalid {
    outline: 1.5px solid #ef4444;
    outline-offset: 1.5px;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.validation-message {
    color: #ef4444;
    font-size: 0.89375rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: slideDown 0.3s var(--spring-smooth);
}

.validation-message::before {
    content: '⚠';
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   CRYSTALLINE TABLE STYLES
   ============================================ */
.table {
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-subtle);
}

.table thead {
    background: var(--gradient-header);
    color: white;
}

.table thead th {
    font-weight: 600;
    font-size: 0.89375rem;
    letter-spacing: 0.03em;
    padding: 0.825rem;
    border: none;
}

.table tbody tr {
    transition: all 0.25s var(--spring-smooth);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.table tbody tr:hover {
    background: var(--hover-bg);
    transform: scale(1.002);
}

.table tbody td {
    padding: 0.825rem;
    border-color: var(--border-color);
    vertical-align: middle;
    font-size: 0.9625rem;
}

/* ============================================
   CRYSTALLINE CARD STYLES
   ============================================ */
.card {
    border-radius: 0.875rem;
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--glass-shadow);
    transition: all 0.35s var(--spring-smooth);
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glass-shadow-lg);
    border-color: rgba(var(--primary-rgb), 0.15);
}

.card-header {
    color: white;
    font-weight: 600;
    border: none;
    font-size: 1.03125rem;
}

.card-body {
    padding: 1.2375rem;
}

.card-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.825rem 1.2375rem;
}

/* ============================================
   ALERT STYLES — GLASS PILLS
   ============================================ */
.alert {
    border-radius: 0.75rem;
    border: 1px solid transparent;
    padding: 0.825rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.6875rem;
    animation: slideInRight 0.4s var(--spring-smooth);
    font-size: 0.9625rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(52, 211, 153, 0.08) 100%);
    border-color: rgba(16, 185, 129, 0.2);
    color: #065f46;
}

[data-theme="dark"] .alert-success,
[data-bs-theme="dark"] .alert-success {
    color: #6ee7b7;
}

.alert-success::before { content: '✓'; font-size: 1.2375rem; }

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(248, 113, 113, 0.08) 100%);
    border-color: rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

[data-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-danger {
    color: #fca5a5;
}

.alert-danger::before { content: '✕'; font-size: 1.2375rem; }

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(251, 191, 36, 0.08) 100%);
    border-color: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

[data-theme="dark"] .alert-warning,
[data-bs-theme="dark"] .alert-warning {
    color: #fde68a;
}

.alert-warning::before { }

.alert-info {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.06) 100%);
    border-color: rgba(99, 102, 241, 0.2);
    color: #3730a3;
}

[data-theme="dark"] .alert-info,
[data-bs-theme="dark"] .alert-info {
    color: #c7d2fe;
}

.alert-info::before { content: '' !important; font-size: 1.2375rem; }

/* ============================================
   BADGE STYLES — LUMINOUS PILLS
   ============================================ */
.badge {
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-transform: uppercase;
}

.badge i { font-size: 0.875rem; }

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner-border {
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   ERROR BOUNDARY
   ============================================ */
.blazor-error-boundary {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    padding: 0.9625rem 0.9625rem 0.9625rem 3.52rem;
    color: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-xl);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ============================================
   BORDER UTILITY
   ============================================ */
.border {
    border-color: var(--border-color) !important;
}

/* ============================================
   THEME SWITCHER — GLASS CAPSULE
   ============================================ */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.4125rem;
    padding: 0.2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 999px;
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--shadow-sm);
}

.theme-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.3375rem;
    height: 2.3375rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s var(--spring-bounce);
    position: relative;
}

.theme-button:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: scale(1.1);
}

.theme-button.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.theme-button.active::after {
    content: '';
    position: absolute;
    bottom: -0.22rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0.4125rem;
    height: 0.4125rem;
    background: var(--primary-color);
    border-radius: 50%;
}

.theme-button svg {
    width: 1.2375rem;
    height: 1.2375rem;
}

.theme-switcher[data-user-set="true"] {
    border-width: 1.65px;
    border-color: rgba(var(--primary-rgb), 0.4);
}

.theme-switcher[data-user-set="true"]::before {
    content: '✓';
    position: absolute;
    top: -0.4125rem;
    right: -0.4125rem;
    font-size: 0.75625rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    width: 0.9625rem;
    height: 0.9625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* ============================================
   CRYSTALLINE SCROLLBARS
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.15);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.3);
    background-clip: content-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.2);
    background-clip: content-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.35);
    background-clip: content-box;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--glass-shadow);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-hover {
    transition: all 0.35s var(--spring-smooth);
}

.shadow-hover:hover {
    box-shadow: var(--glass-shadow-lg);
    transform: translateY(-3px);
}

.aurora-glow {
    box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.15), 0 0 60px rgba(var(--accent-rgb), 0.08);
}

.crystal-surface {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    background-image: var(--noise-texture);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    html, body {
        font-size: 14.3px;
    }

    .theme-switcher {
        gap: 0.275rem;
        padding: 0.2rem;
    }

    .theme-button {
        width: 2.0625rem;
        height: 2.0625rem;
    }

    .theme-button svg {
        width: 1.1rem;
        height: 1.1rem;
    }

    h1 { font-size: 1.925rem; }
    h2 { font-size: 1.5125rem; }
    h3 { font-size: 1.2375rem; }

    .btn {
        padding: 0.44rem 0.9625rem;
        font-size: 0.89375rem;
    }
}

/* ============================================
   QUICKGRID — CRYSTALLINE GLASS TABLE
   ============================================ */
.grid-container {
    width: 100%;
    overflow-x: auto;
}

.quickgrid {
    width: 100%;
    border-collapse: collapse;
}

.quickgrid thead th {
    background: var(--gradient-header);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.03em;
    padding: 1rem;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.quickgrid thead th[aria-sort] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2rem;
}

.quickgrid thead th:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 40%, #7c3aed 100%);
}

.quickgrid tbody tr {
    transition: all 0.25s var(--spring-smooth);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.quickgrid tbody tr:hover {
    background: var(--hover-bg);
    transform: scale(1.001);
}

/* Selected row — Light */
.quickgrid tbody tr.selected-row {
    background: rgba(var(--primary-rgb), 0.12) !important;
    box-shadow: inset 3px 0 0 0 var(--primary-color), inset 0 0 0 1px rgba(var(--primary-rgb), 0.15);
}

.quickgrid tbody tr.selected-row:hover {
    background: rgba(var(--primary-rgb), 0.18) !important;
}

/* Selected row — Dark */
[data-theme="dark"] .quickgrid tbody tr.selected-row,
[data-bs-theme="dark"] .quickgrid tbody tr.selected-row {
    background: rgba(var(--primary-rgb), 0.15) !important;
    box-shadow: inset 3px 0 0 0 var(--primary-color), inset 0 0 0 1px rgba(var(--primary-rgb), 0.2);
}

[data-theme="dark"] .quickgrid tbody tr.selected-row:hover,
[data-bs-theme="dark"] .quickgrid tbody tr.selected-row:hover {
    background: rgba(var(--primary-rgb), 0.22) !important;
}

.quickgrid tbody td {
    padding: 0.875rem;
    vertical-align: middle;
    font-size: 0.9375rem;
}

/* QuickGrid Column Options */
.col-options-button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    border-radius: 0.375rem;
    transition: background 0.2s;
}

.col-options-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.search-box {
    box-shadow: var(--glass-shadow);
    min-width: 200px;
}

.search-box input,
.search-box select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

/* ============================================
   PAGINATION — GLASS CAPSULE BUTTONS
   ============================================ */
.paginator {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem 0;
}

.paginator button {
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--primary-color);
    border-radius: 0.625rem;
    cursor: pointer;
    transition: all 0.3s var(--spring-bounce);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.paginator button:hover:not(:disabled) {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
    transform: translateY(-2px);
}

.paginator button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

.paginator button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-muted);
    box-shadow: none;
}

/* Current/Active Page Button */
.paginator button.current-page {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.4), 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    font-weight: 700;
    transform: scale(1.08);
}

.paginator button.current-page:hover {
    transform: scale(1.08);
}

/* Navigation Arrows */
.paginator button[aria-label*="Go to first page"]::before,
.paginator button[aria-label*="first"]::before {
    content: '◀◀ '; font-size: 10px; font-weight: 700; opacity: 0.95;
}

.paginator button[aria-label*="Go to previous page"]::before,
.paginator button[aria-label*="previous"]::before {
    content: '◀ '; font-size: 11px; font-weight: 900;
}

.paginator button[aria-label*="Go to next page"]::after,
.paginator button[aria-label*="next"]::after {
    content: ' ▶'; font-size: 11px; font-weight: 900; transform: scaleX(1);
}

.paginator button[aria-label*="Go to last page"]::after,
.paginator button[aria-label*="last"]::after {
    content: ' ▶▶'; font-size: 10px; font-weight: 700; opacity: 0.95; transform: scaleX(1);
}

.paginator button[aria-label*="Go to first page"],
.paginator button[aria-label*="first"],
.paginator button[aria-label*="Go to previous page"],
.paginator button[aria-label*="previous"],
.paginator button[aria-label*="Go to next page"],
.paginator button[aria-label*="next"],
.paginator button[aria-label*="Go to last page"],
.paginator button[aria-label*="last"] {
    min-width: auto;
    padding: 0.5rem 1rem;
    font-weight: 700;
    transform: scaleX(1);
}

.paginator button[aria-label*="Go to first page"]::before,
.paginator button[aria-label*="first"]::before,
.paginator button[aria-label*="Go to previous page"]::before,
.paginator button[aria-label*="previous"]::before,
.paginator button[aria-label*="Go to next page"]::after,
.paginator button[aria-label*="next"]::after,
.paginator button[aria-label*="Go to last page"]::after,
.paginator button[aria-label*="last"]::after {
    display: inline;
    margin: 0;
}

.paginator .pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0 0.5rem;
    white-space: nowrap;
}

/* Dark Theme Pagination */
[data-theme="dark"] .paginator button,
[data-bs-theme="dark"] .paginator button {
    background: var(--glass-bg);
    border-color: rgba(var(--primary-rgb), 0.2);
    color: var(--primary-color);
}

[data-theme="dark"] .paginator button:hover:not(:disabled),
[data-bs-theme="dark"] .paginator button:hover:not(:disabled) {
    background: var(--gradient-primary);
    color: white;
}

[data-theme="dark"] .paginator button.current-page,
[data-bs-theme="dark"] .paginator button.current-page {
    background: var(--gradient-primary);
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.35), 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

[data-theme="dark"] .paginator button:disabled,
[data-bs-theme="dark"] .paginator button:disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Light Theme Pagination (match) */
[data-theme="light"] .paginator button,
[data-bs-theme="light"] .paginator button {
    background: var(--glass-bg);
    border-color: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-color);
}

[data-theme="light"] .paginator button:hover:not(:disabled),
[data-bs-theme="light"] .paginator button:hover:not(:disabled) {
    background: var(--gradient-primary);
    color: white;
}

[data-theme="light"] .paginator button.current-page,
[data-bs-theme="light"] .paginator button.current-page {
    background: var(--gradient-primary);
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.35), 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

[data-theme="light"] .paginator button:disabled,
[data-bs-theme="light"] .paginator button:disabled {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Responsive Pagination */
@media (max-width: 640px) {
    .paginator {
        gap: 0.375rem;
    }

    .paginator button {
        min-width: 2.25rem;
        height: 2.25rem;
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
}

/* ============================================
   MODAL — FROSTED GLASS DIALOG
   ============================================ */
.modal.show {
    animation: fadeIn 0.3s var(--ease-out-expo);
}

.modal-dialog {
    animation: modalSlideUp 0.4s var(--spring-smooth);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
    border-radius: 1rem;
    border: 1px solid var(--glass-border-subtle);
    box-shadow: var(--shadow-xl), 0 0 60px rgba(var(--primary-rgb), 0.06);
    background: var(--glass-bg-heavy);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* ============================================
   QUICKGRID — CUSTOM OVERRIDES
   ============================================ */
.quickgrid-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.quickgrid-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    border-color: rgba(var(--primary-rgb), 0.15);
    border-top-color: var(--primary-color);
}

.quickgrid-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.quickgrid-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive QuickGrid */
@media (max-width: 992px) {
    .quickgrid thead th {
        font-size: 0.8125rem;
        padding: 0.75rem;
    }

    .quickgrid tbody td {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    .grid-container {
        border-radius: 0.5rem;
    }

    .quickgrid thead th {
        font-size: 0.75rem;
        padding: 0.625rem;
    }

    .quickgrid tbody td {
        font-size: 0.8125rem;
        padding: 0.625rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ============================================
   CUSTOM QUICKGRID OVERRIDES
   ============================================ */
.text-muted {
    margin-right: 12px !important;
    margin-left: 12px !important;
}

.container-fluid {
    margin: 0 !important;
    padding: 0 !important;
}

.row > * {
    margin: 0 !important;
    padding: 0 !important;
}

.py-2 {
    padding: 0 !important;
    margin: 0 !important;
}

.px-3 {
    padding-right: 1rem !important;
    padding-left: 0.5rem !important;
}

.quickgrid[theme=default] > thead > tr > th {
    font-weight: normal;
    padding: 0;
}

.border-bottom {
    border-bottom: none !important;
}

/* ============================================
   TOAST NOTIFICATION — FROSTED GLASS
   ============================================ */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 320px;
    border-radius: 0.875rem;
    box-shadow: var(--glass-shadow-lg);
    animation: slideInUp 0.4s var(--spring-smooth);
    border: 1px solid var(--glass-border-subtle);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--glass-bg-heavy);
}

@keyframes slideInUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast-header {
    border-top-left-radius: 0.875rem;
    border-top-right-radius: 0.875rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.toast-body {
    padding: 1rem;
}

.toast-body .btn {
    transition: all 0.3s var(--spring-bounce);
}

.toast-body .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark theme toast */
[data-theme="dark"] .toast,
[data-bs-theme="dark"] .toast {
    background: var(--glass-bg-heavy);
    box-shadow: var(--glass-shadow-lg);
}

[data-theme="dark"] .toast-header,
[data-bs-theme="dark"] .toast-header {
    background-color: rgba(16, 185, 129, 0.15);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .toast-body,
[data-bs-theme="dark"] .toast-body {
    background-color: transparent;
}

/* ============================================
   UPWORK TRANSACTIONS GRID ENHANCEMENTS
   ============================================ */
.transactions-grid table {
    table-layout: auto !important;
    width: 100% !important;
}

.transactions-grid th,
.transactions-grid td {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    vertical-align: middle !important;
    max-width: 260px;
}

.transactions-grid th {
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.cell-truncate {
    display: inline-block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.text-truncate-custom {
    max-width: 240px;
}

.bg-gradient-header {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08) 0%, rgba(var(--primary-rgb), 0.02) 100%);
}

.panel-icon-glow {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(var(--primary-rgb), 0.12);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.15);
}

.upload-card {
    transition: transform 0.3s var(--spring-smooth), box-shadow 0.3s var(--spring-smooth);
}

.upload-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glass-shadow-lg) !important;
}

.dropzone-area {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.dropzone-area:hover {
    background-color: rgba(var(--primary-rgb), 0.04) !important;
    border-color: var(--primary-color) !important;
}