:root {
    --modern-theme-page-start: #667eea;
    --modern-theme-page-end: #764ba2;
    --modern-theme-surface-start: rgba(99, 102, 241, 0.26);
    --modern-theme-surface-end: rgba(139, 92, 246, 0.26);
    --modern-theme-surface-border: rgba(255, 255, 255, 0.22);
    --modern-theme-header-start: #667eea;
    --modern-theme-header-end: #764ba2;
    --modern-theme-accent-start: #7c3aed;
    --modern-theme-accent-end: #4f46e5;
    --modern-theme-button-text: #ffffff;
    --modern-theme-shadow: rgba(76, 29, 149, 0.24);
}

body[data-theme="ocean"] {
    --modern-theme-page-start: #0f4c81;
    --modern-theme-page-end: #123c69;
    --modern-theme-surface-start: rgba(14, 116, 144, 0.28);
    --modern-theme-surface-end: rgba(37, 99, 235, 0.2);
    --modern-theme-surface-border: rgba(125, 211, 252, 0.18);
    --modern-theme-header-start: #0f4c81;
    --modern-theme-header-end: #2563eb;
    --modern-theme-accent-start: #0ea5e9;
    --modern-theme-accent-end: #2563eb;
    --modern-theme-shadow: rgba(8, 47, 73, 0.3);
}

body[data-theme="midnight"] {
    --modern-theme-page-start: #020617;
    --modern-theme-page-end: #111827;
    --modern-theme-surface-start: rgba(15, 23, 42, 0.82);
    --modern-theme-surface-end: rgba(30, 41, 59, 0.72);
    --modern-theme-surface-border: rgba(148, 163, 184, 0.18);
    --modern-theme-header-start: #111827;
    --modern-theme-header-end: #312e81;
    --modern-theme-accent-start: #6366f1;
    --modern-theme-accent-end: #8b5cf6;
    --modern-theme-shadow: rgba(2, 6, 23, 0.5);
}

body[data-theme="graphite"] {
    --modern-theme-page-start: #d4d4d8;
    --modern-theme-page-end: #a1a1aa;
    --modern-theme-surface-start: rgba(113, 113, 122, 0.16);
    --modern-theme-surface-end: rgba(212, 212, 216, 0.12);
    --modern-theme-surface-border: rgba(82, 82, 91, 0.18);
    --modern-theme-header-start: #27272a;
    --modern-theme-header-end: #52525b;
    --modern-theme-accent-start: #52525b;
    --modern-theme-accent-end: #71717a;
    --modern-theme-shadow: rgba(39, 39, 42, 0.24);
    --modern-theme-button-text: #ffffff;
}

html body {
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 24%), linear-gradient(135deg, var(--modern-theme-page-start) 0%, var(--modern-theme-page-end) 100%) !important;
}

body[data-theme].client-detail-page {
    background: radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.08) 0, transparent 22%), linear-gradient(135deg, var(--modern-theme-page-start) 0%, var(--modern-theme-page-end) 100%) !important;
    background-attachment: fixed !important;
}

body[data-theme] .addon-container,
body[data-theme] .pdf-container {
    background: transparent !important;
}

body[data-theme] .search-hero-section,
body[data-theme] .dashboard-header,
body[data-theme] .modern-header,
body[data-theme] .detail-header,
body[data-theme] .page-header,
body[data-theme] .modal-header-custom,
body[data-theme] .pdf-header,
body[data-theme] .search-header {
    background: linear-gradient(135deg, var(--modern-theme-header-start) 0%, var(--modern-theme-header-end) 100%) !important;
    box-shadow: 0 18px 40px var(--modern-theme-shadow) !important;
}

body[data-theme] .search-hero-section,
body[data-theme] .search-header,
body[data-theme] .dashboard-header {
    border: 1px solid var(--modern-theme-surface-border);
}

body[data-theme] .metric-card,
body[data-theme] .action-card,
body[data-theme] .modern-card,
body[data-theme] .addon-card,
body[data-theme] .pdf-card,
body[data-theme] .client-info-card,
body[data-theme] .policies-section,
body[data-theme] .search-header,
body[data-theme] .page-header,
body[data-theme] .card-modern,
body[data-theme] .modern-tabs {
    box-shadow: 0 24px 48px var(--modern-theme-shadow) !important;
}

body[data-theme] .btn-logout-modern,
body[data-theme] .btn-back-home,
body[data-theme] .btn-home-modern,
body[data-theme] .btn-back,
body[data-theme] .btn-primary-modern,
body[data-theme] .btn-search-hero,
body[data-theme] .btn-action.btn-primary-modern {
    background: linear-gradient(135deg, var(--modern-theme-accent-start) 0%, var(--modern-theme-accent-end) 100%) !important;
    color: var(--modern-theme-button-text) !important;
    border-color: transparent !important;
}

body[data-theme] .quick-search-shell,
body[data-theme] .page-action-card,
body[data-theme] .global-loading-card,
body[data-theme] .page-loading-box {
    border: 1px solid var(--modern-theme-surface-border);
}

body[data-theme] .dashboard-title,
body[data-theme] .dashboard-subtitle,
body[data-theme] .dashboard-subtitle i,
body[data-theme] .dashboard-header .dashboard-title,
body[data-theme] .dashboard-header .dashboard-title i,
body[data-theme] .dashboard-header .dashboard-subtitle,
body[data-theme] .dashboard-header .dashboard-subtitle span,
body[data-theme] .dashboard-header .dashboard-subtitle i,
body[data-theme] .search-hero-title,
body[data-theme] .search-hero-subtitle,
body[data-theme] .search-hero-eyebrow,
body[data-theme] .quick-search-title,
body[data-theme] .quick-search-caption,
body[data-theme] .search-title,
body[data-theme] .search-title i,
body[data-theme] .search-label,
body[data-theme] .search-label i,
body[data-theme] .filter-label,
body[data-theme] .filters-header h3,
body[data-theme] .results-title,
body[data-theme] .results-count,
body[data-theme] .page-title,
body[data-theme] .page-subtitle,
body[data-theme] .detail-header h1,
body[data-theme] .detail-header h1 i,
body[data-theme] .search-hero-section .btn-search-hero,
body[data-theme] .search-hero-section .search-highlight-chip,
body[data-theme] .search-hero-section .quick-search-status {
    color: #f8fafc !important;
}

body[data-theme="ocean"] .dashboard-title,
body[data-theme="ocean"] .dashboard-subtitle,
body[data-theme="ocean"] .dashboard-subtitle i,
body[data-theme="ocean"] .dashboard-header .dashboard-title,
body[data-theme="ocean"] .dashboard-header .dashboard-title i,
body[data-theme="ocean"] .dashboard-header .dashboard-subtitle,
body[data-theme="ocean"] .dashboard-header .dashboard-subtitle span,
body[data-theme="ocean"] .dashboard-header .dashboard-subtitle i,
body[data-theme="ocean"] .search-hero-title,
body[data-theme="ocean"] .search-hero-subtitle,
body[data-theme="ocean"] .search-hero-eyebrow,
body[data-theme="ocean"] .quick-search-title,
body[data-theme="ocean"] .quick-search-caption,
body[data-theme="ocean"] .search-title,
body[data-theme="ocean"] .search-title i,
body[data-theme="ocean"] .search-label,
body[data-theme="ocean"] .search-label i,
body[data-theme="ocean"] .filter-label,
body[data-theme="ocean"] .filters-header h3,
body[data-theme="ocean"] .results-title,
body[data-theme="ocean"] .results-count,
body[data-theme="ocean"] .page-title,
body[data-theme="ocean"] .page-subtitle,
body[data-theme="ocean"] .detail-header h1,
body[data-theme="ocean"] .detail-header h1 i,
body[data-theme="ocean"] .search-hero-section .btn-search-hero,
body[data-theme="ocean"] .search-hero-section .search-highlight-chip,
body[data-theme="ocean"] .search-hero-section .quick-search-status {
    text-shadow: 0 1px 2px rgba(8, 47, 73, 0.25);
}

body[data-theme] .search-title .btn-back-home,
body[data-theme] .dashboard-actions .btn-logout-modern,
body[data-theme] .search-hero-right .btn-outline-light,
body[data-theme] .quick-search-status {
    color: #ffffff !important;
}

body[data-theme] .search-select-mobile,
body[data-theme] .filter-select,
body[data-theme] .search-input-field,
body[data-theme] .form-control,
body[data-theme] .form-select,
body[data-theme] .form-control-custom,
body[data-theme] .form-select-custom {
    color: #0f172a;
}

body[data-theme="midnight"] .metric-card,
body[data-theme="midnight"] .action-card,
body[data-theme="midnight"] .modern-card,
body[data-theme="midnight"] .addon-card,
body[data-theme="midnight"] .pdf-card,
body[data-theme="midnight"] .client-info-card,
body[data-theme="midnight"] .policies-section,
body[data-theme="midnight"] .page-header,
body[data-theme="midnight"] .card-modern,
body[data-theme="midnight"] .modern-tabs {
    background: rgba(255, 255, 255, 0.97) !important;
}

body[data-theme="midnight"] .client-info-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 245, 249, 0.98) 100%) !important;
}

body[data-theme="midnight"] .policies-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.985) 0%, rgba(248, 250, 252, 0.985) 100%) !important;
}

body[data-theme="graphite"] .metric-card,
body[data-theme="graphite"] .action-card,
body[data-theme="graphite"] .modern-card,
body[data-theme="graphite"] .addon-card,
body[data-theme="graphite"] .pdf-card,
body[data-theme="graphite"] .client-info-card,
body[data-theme="graphite"] .policies-section,
body[data-theme="graphite"] .page-header,
body[data-theme="graphite"] .card-modern,
body[data-theme="graphite"] .modern-tabs {
    background: rgba(250, 250, 250, 0.97) !important;
}

body[data-theme="graphite"] .client-info-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 244, 245, 0.98) 100%) !important;
}

body[data-theme="graphite"] .policies-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.985) 0%, rgba(250, 250, 250, 0.985) 100%) !important;
}

.modern-theme-fab {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 12001;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.modern-theme-toggle {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.4) 0%, rgba(30, 41, 59, 0.28) 100%);
    color: #f8fafc;
    border-radius: 16px;
    padding: 9px 12px;
    min-width: 154px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.modern-theme-toggle:hover {
    transform: translateY(-1px);
}

.modern-theme-toggle-main {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.modern-theme-toggle-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.28) 0%, rgba(244, 114, 182, 0.2) 100%);
    font-size: 1rem;
}

.modern-theme-toggle-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.modern-theme-toggle-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #cbd5e1;
}

.modern-theme-toggle-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
}

.modern-theme-menu {
    width: 280px;
    padding: 10px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.68) 0%, rgba(30, 41, 59, 0.58) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.24);
    backdrop-filter: blur(14px);
    display: none;
}

.modern-theme-fab.open .modern-theme-menu {
    display: block;
}

.modern-theme-option {
    width: 100%;
    border: 0;
    background: transparent;
    color: #e2e8f0;
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modern-theme-option:hover {
    background: rgba(148, 163, 184, 0.12);
    transform: translateY(-1px);
}

.modern-theme-option.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(168, 85, 247, 0.18) 100%);
    border: 1px solid rgba(129, 140, 248, 0.2);
}

.modern-theme-option-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.modern-theme-option[data-theme-option="aurora"] .modern-theme-option-icon {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.28) 0%, rgba(129, 140, 248, 0.24) 100%);
}

.modern-theme-option[data-theme-option="ocean"] .modern-theme-option-icon {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.28) 0%, rgba(37, 99, 235, 0.24) 100%);
}

.modern-theme-option[data-theme-option="midnight"] .modern-theme-option-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(15, 23, 42, 0.42) 100%);
}

.modern-theme-option-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.modern-theme-option-title {
    font-weight: 700;
    color: #f8fafc;
}

.modern-theme-option-description {
    font-size: 0.82rem;
    color: #94a3b8;
}

@media (max-width: 768px) {
    .modern-theme-fab {
        top: auto;
        right: 16px;
        bottom: 16px;
    }

    .modern-theme-toggle {
        min-width: 148px;
        padding: 9px 12px;
    }

    .modern-theme-menu {
        width: min(92vw, 280px);
    }
}
