/* ==========================================================================
   Medicare Central & Tenant Clinics - Premium Global Design System
   Preserving original theme brand colors: --theme-color & --accent-color
   ========================================================================== */

:root {
    /* Brand Theme Colors (Dynamic fallbacks) */
    --theme-color: #1d5d9b;
    --accent-color: #f4d160;
    
    /* Extended Color Palette */
    --theme-dark: color-mix(in srgb, var(--theme-color) 80%, #0f172a 20%);
    --theme-light: color-mix(in srgb, var(--theme-color) 10%, #ffffff 90%);
    --accent-dark: #d97706;
    --accent-light: #fffdf0;

    /* Neutrals */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-light: #e2e8f0;
    --border-subtle: #f1f5f9;

    /* Shadows & Glows */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 36px -6px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 8px 25px rgba(244, 209, 96, 0.35);
    --shadow-theme-glow: 0 10px 30px rgba(29, 93, 155, 0.2);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 9999px;

    /* Transitions */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Global Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Glassmorphism & Elevation Utilities --- */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-md);
}

.hover-lift {
    transition: var(--transition-normal);
}
.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

/* --- Shimmer & Animated Shine Button --- */
.btn-shine {
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}
.btn-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        60deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    transition: all 0.6s ease;
}
.btn-shine:hover::after {
    left: 140%;
}

/* --- Badges & Micro-components --- */
.badge-gold {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #fffdf0 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
}

.badge-theme {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: color-mix(in srgb, var(--theme-color) 10%, #ffffff 90%);
    border: 1px solid color-mix(in srgb, var(--theme-color) 25%, #ffffff 75%);
    color: var(--theme-color);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-pill);
}

/* --- Keyframe Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(244, 209, 96, 0.4);
    }
    50% {
        box-shadow: 0 0 28px rgba(244, 209, 96, 0.8);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Quick-Nav Sticky Table of Contents for Legal Docs --- */
.toc-sidebar {
    position: sticky;
    top: 30px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.toc-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--border-subtle);
    padding-bottom: 12px;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-weight: 400;
}

.toc-link:hover {
    background: color-mix(in srgb, var(--theme-color) 8%, #ffffff 92%);
    color: var(--theme-color);
    transform: translateX(4px);
}

.toc-link.active {
    background: var(--theme-color);
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--shadow-theme-glow);
}

/* 🌑 Dark Theme System Variables & Sidebar Overrides */
html.dark-theme .toc-sidebar,
body.dark-theme .toc-sidebar {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.3);
}

html.dark-theme .toc-title,
body.dark-theme .toc-title {
    color: #f8fafc;
    border-bottom-color: #334155;
}

html.dark-theme .toc-link,
body.dark-theme .toc-link {
    color: #94a3b8;
}

html.dark-theme .toc-link:hover,
body.dark-theme .toc-link:hover {
    background: #334155;
    color: #f8fafc;
}

html.dark-theme .toc-link.active,
body.dark-theme .toc-link.active {
    background: var(--theme-color);
    color: #ffffff;
    box-shadow: var(--shadow-theme-glow);
}

/* --- Reading Progress Bar & Scroll-To-Top Button --- */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--theme-color) 0%, var(--accent-color) 100%);
    z-index: 99999;
    transition: width 0.1s ease-out;
}

.scroll-top-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: var(--theme-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(29, 93, 155, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 990;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background-color: var(--accent-color);
    color: #0f172a;
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 28px rgba(244, 209, 96, 0.5);
}

html.dark-theme .scroll-top-btn,
body.dark-theme .scroll-top-btn {
    background-color: var(--accent-color);
    color: #0f172a;
}
