/**
 * Modern Stylesheet for CIVM Documentation Project
 * Theme: Glassmorphism & Dark Mode Support
 */

/* =========================================
   1. VARIABLES & THEME CONFIG
   ========================================= */
:root {
    /* Fonts */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'Fira Code', monospace;

    /* Light Theme Palette */
    --primary: #4361ee;
    --primary-rgb: 67, 97, 238;
    --secondary: #3f37c9;
    --accent: #f72585;
    --success: #4cc9f0;

    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);

    --text-main: #2b2d42;
    --text-muted: #6c757d;
    --text-light: #8d99ae;

    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);

    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Theme Palette */
    --primary: #4895ef;
    --primary-rgb: 72, 149, 239;
    --secondary: #4361ee;

    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.7);

    --text-main: #f8f9fa;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* =========================================
   2. RESET & BASE
   ========================================= */
body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary);
}

/* =========================================
   3. UTILITIES & GLASSMORPHISM
   ========================================= */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

.card-glass {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: 100%;
    overflow: hidden;
}

.card-glass:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =========================================
   4. NAVBAR
   ========================================= */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition);
    padding: 1rem 0;
}

.site-header.scrolled {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 1rem;
}

.theme-toggle:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    transform: rotate(15deg);
}

/* =========================================
   5. HERO SECTION
   ========================================= */
.hero-section {
    padding-top: 140px;
    padding-bottom: 80px;
    position: relative;
    overflow: hidden;
}

.hero-shape {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.2) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(50px);
}

.shape-1 {
    top: -100px;
    right: -100px;
}

.shape-2 {
    bottom: -100px;
    left: -100px;
    background: radial-gradient(circle, rgba(247, 37, 133, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 600px;
}

/* Buttons */
.btn-modern {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.6);
    color: white;
}

.btn-outline-modern {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline-modern:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

/* =========================================
   6. CONTENT AREA
   ========================================= */
.overview-section {
    padding: 5rem 0;
}

.section-label {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    display: block;
}

/* =========================================
   7. FOOTER
   ========================================= */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 4rem 0 0;
    margin-top: 4rem;
}

.footer-brand img {
    height: 40px;
    margin-bottom: 1rem;
}

.footer-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
    padding-left: 5px;
}

.footer-bottom {
    padding: 1.5rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================================
   8. COMPONENTS (FAQ, BackToTop)
   ========================================= */
/* Quick FAQ Button */
.floating-faq {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.faq-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.faq-button:hover {
    transform: scale(1.1) rotate(10deg);
}

.faq-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 990;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.faq-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.faq-header {
    padding: 1rem 1.5rem;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.faq-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 980;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: all;
    bottom: 30px;
}

.back-to-top:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-5px);
}

/* =========================================
   9. CUSTOM INDEX COMPONENTS
   ========================================= */
/* TOC Styles */
.toc-section {
    padding: 5rem 0;
    background-color: var(--bg-body);
}

.toc-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 4px solid var(--primary);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.toc-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.toc-number {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Pillars Grid */
.pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pillar-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--primary);
    position: relative;
    transition: var(--transition);
}

.pillar-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.pillar-card.pillar-2 {
    border-top-color: var(--success);
}

.pillar-card.pillar-3 {
    border-top-color: #f5a623;
}

.pillar-card.pillar-4 {
    border-top-color: #9b59b6;
}

.pillar-card.pillar-5 {
    border-top-color: var(--accent);
}

.pillar-weight {
    position: absolute;
    top: -12px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* IVS Scale */
.ivs-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.ivs-level {
    flex: 1;
    min-width: 120px;
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 500;
}

.ivs-level .score {
    display: block;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.ivs-level.excellent {
    background: rgba(46, 125, 50, 0.1);
    color: #2e7d32;
    border: 1px solid #2e7d32;
}

.ivs-level.good {
    background: rgba(56, 142, 60, 0.1);
    color: #388e3c;
    border: 1px solid #388e3c;
}

.ivs-level.fair {
    background: rgba(245, 127, 23, 0.1);
    color: #f57f17;
    border: 1px solid #f57f17;
}

.ivs-level.marginal {
    background: rgba(230, 81, 0, 0.1);
    color: #e65100;
    border: 1px solid #e65100;
}

.ivs-level.poor {
    background: rgba(198, 40, 40, 0.1);
    color: #c62828;
    border: 1px solid #c62828;
}

/* =========================================
   10. RESPONSIVE
   ========================================= */
@media (max-width: 991px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .navbar-collapse {
        background: var(--bg-surface);
        padding: 1rem;
        border-radius: var(--radius-md);
        margin-top: 1rem;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border-color);
    }
}