/* ==========================================================================
   ROOT.CSS - Global Styles for Veterans Benefits Center
   ========================================================================== */

/* FONT FACE - Inter Variable Font */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('/assets/fonts/inter-variable.woff2') format('woff2');
}

/* CSS VARIABLES - Light Mode (Default) */
:root {
    --primary-navy: #0f172a;
    --primary-blue: #1e40af;
    --accent-gold: #d97706;
    --bg-off-white: #f8fafc;
    --surface-white: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-subtle: #e2e8f0;
    --success-green: #059669;
    --alert-red: #dc2626;

    /* Alert Colors */
    --warning-bg: #fffbeb;
    --warning-border: #fcd34d;
    --warning-text: #92400e;

    /* UI Utils */
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* RESET & BASE */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-off-white);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a { text-decoration: none; color: inherit; transition: all 0.2s ease; }
ul { list-style: none; }

/* UTILITIES */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; position: relative; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ACCESSIBILITY & FOCUS */
*:focus-visible {
    outline: 3px solid var(--accent-gold);
    outline-offset: 2px;
}

/* Skip Link */
.skip {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--primary-navy);
    color: white;
    padding: 1rem;
    z-index: 9999;
    transition: top 0.3s;
}
.skip:focus {
    top: 0;
}

/* CRISIS BANNER */
.crisis-banner {
    background-color: var(--alert-red);
    color: white;
    text-align: center;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    z-index: 2001;
}
.crisis-banner a { color: white; text-decoration: underline; text-underline-offset: 4px; }
.crisis-banner a:hover { color: #fee2e2; }

/* HEADER */
header {
    background-color: var(--surface-white);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
[data-theme="light"] .logo { color: #0f172a; }
.logo i { color: var(--accent-gold); }

/* Header Logo Image */
.header-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
    transform: scale(1.75);
    transform-origin: left center;
    margin-right: 0.75rem;
}

.nav-links { display: flex; gap: 1.5rem; align-items: center; flex-shrink: 0; }
.nav-links a { font-weight: 500; color: var(--text-main); }
.nav-links a:hover { color: var(--primary-blue); }

/* HEADER SEARCH (DESKTOP) */
.header-search-wrapper {
    width: 280px;
    position: relative;
    display: none;
    flex-shrink: 0;
}
.header-search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: 50px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-off-white);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}
.header-search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: var(--surface-white);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}
.header-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* SITEWIDE SEARCH DROPDOWN */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 0.5rem;
}
.search-dropdown.active {
    display: block;
}
.search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
}
.search-result:last-child {
    border-bottom: none;
}
.search-result:hover {
    background: var(--bg-off-white);
}
.search-result i {
    color: var(--accent-gold);
    width: 20px;
    flex-shrink: 0;
}
.search-result.category {
    background: rgba(30, 64, 175, 0.05);
}
.search-result mark {
    background: rgba(217, 119, 6, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}
.result-tag {
    margin-left: auto;
    font-size: 0.7rem;
    text-transform: uppercase;
    background: var(--primary-blue);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.search-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* HEADER TOOLS */
.header-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.tool-btn {
    background: none; border: none; cursor: pointer; color: var(--text-main); font-size: 1.1rem;
    width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.tool-btn:hover { background: var(--border-subtle); }

/* FOOTER */
footer {
    background: #020617;
    color: #94a3b8;
    padding: 4rem 0;
    text-align: center;
    font-size: 0.9rem;
}
footer a { color: #e2e8f0; text-decoration: underline; }
footer a:hover { color: #ffffff; }

/* Footer Logo */
.footer-logo {
    height: 60px;
    width: auto;
    margin-bottom: 2rem;
    opacity: 0.9;
    transform: scale(1.75);
    transform-origin: center center;
}

/* GO TO TOP BUTTON - positioned above calculator FAB */
#go-top {
    position: fixed;
    bottom: 5.5rem;
    right: 1.75rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
    z-index: 800;
    cursor: pointer;
}
#go-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#go-top:hover {
    background: var(--primary-navy);
}
#go-top:active,
#go-top.is-pressed {
    transform: scale(0.95);
}

/* PRESS FEEDBACK (PWA Touch) */
.is-pressed {
    opacity: 0.7 !important;
    transform: scale(0.97);
}

/* PRINT STYLES */
@media print {
    header, .crisis-banner, .mobile-toggle, .mobile-menu-overlay, .mobile-nav-drawer, .partners, footer, .header-tools, .modal-overlay, .search-wrapper, .quick-nav {
        display: none !important;
    }
    body { background: white; color: black; }
    .hero { padding: 1rem 0; background: none; color: black; }
    .hero h1 { color: black; }
    .hero::before { display: none; }
    .kb-module, .essential-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    .section-header i { color: black; }
    main { padding: 0; }
    a[href]:after { content: " (" attr(href) ")"; font-size: 0.8rem; color: #666; }
    .tooltip-term { border-bottom: none; color: black; }
    .tooltip-term::after { display: none; }
}

/* RESPONSIVE - Desktop */
@media (min-width: 769px) {
    .header-search-wrapper { display: block; }
}

/* RESPONSIVE - Mobile */
@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .nav-links { display: none; }
    .mobile-toggle { display: flex; }

    /* Go-top button above calculator FAB on mobile */
    #go-top {
        bottom: 5.25rem;
        right: 1.75rem;
    }
}
