/* 
 * CalculatHub — Elite Navigation & Foundation Styles
 * Glassmorphism + 10-Color Neon Spectrum
 */

:root {
    --ch-nav-h: 80px;
    --ch-glass-blur: blur(30px);
    --ch-glass-bg: rgba(255, 255, 255, 0.08);
    --ch-glass-border: rgba(255, 255, 255, 0.2);
    
    /* 10-Color Neon Spectrum */
    --neon-blue:    #1A5BB9;
    --neon-orange:  #FF9100;
    --neon-purple:  #A855F7;
    --neon-green:   #22C55E;
    --neon-pink:    #EC4899;
    --neon-cyan:    #06B6D4;
    --neon-yellow:  #EAB308;
    --neon-red:     #EF4444;
    --neon-lime:    #84CC16;
    --neon-magenta: #D946EF;

    /* Gradients */
    --grad-blue-orange: linear-gradient(90deg, var(--neon-blue), var(--neon-orange));
}

[data-theme="dark"] {
    --ch-glass-bg: rgba(13, 27, 46, 0.4);
    --ch-glass-border: rgba(255, 255, 255, 0.1);
}

/* ── 1. Floating/Sticky Header ── */
.ch-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--ch-nav-h);
    z-index: 1100;
    background: var(--ch-glass-bg);
    backdrop-filter: var(--ch-glass-blur);
    -webkit-backdrop-filter: var(--ch-glass-blur);
    border-bottom: 1px solid var(--ch-glass-border);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.ch-header.scrolled {
    height: 70px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 30px rgba(26, 91, 185, 0.1);
}

[data-theme="dark"] .ch-header.scrolled {
    background: rgba(9, 22, 40, 0.85);
}

.ch-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* Logo Glow */
.ch-logo {
    display: flex;
    align-items: center;
    position: relative;
}

.ch-logo__text {
    font-weight: 900;
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(26, 91, 185, 0.3));
}

/* ── 2. Navigation Links ── */
.ch-nav {
    display: flex;
    gap: 15px;
}

.ch-nav__link {
    font-weight: 600;
    color: var(--ch-text);
    padding: 8px 12px;
    position: relative;
    transition: color 0.3s ease;
}

.ch-nav__link::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%;
    width: 0; height: 2px;
    background: var(--grad-blue-orange);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.ch-nav__link:hover {
    background: var(--grad-blue-orange);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ch-nav__link:hover::after {
    width: 80%;
}

/* ── 3. Centered Pulsing Search ── */
.ch-search-wrap {
    flex: 1;
    max-width: 450px;
    margin: 0 40px;
}

.ch-search-bar {
    border: 1px solid var(--neon-blue);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    padding: 10px 20px;
    transition: all 0.4s ease;
}

.ch-search-bar:focus-within {
    border-color: var(--neon-orange);
    box-shadow: 0 0 15px rgba(255, 145, 0, 0.4);
    animation: searchPulse 2s infinite;
}

@keyframes searchPulse {
    0% { box-shadow: 0 0 5px rgba(255, 145, 0, 0.2); }
    50% { box-shadow: 0 0 20px rgba(255, 145, 0, 0.5); }
    100% { box-shadow: 0 0 5px rgba(255, 145, 0, 0.2); }
}

/* ── 3b. Live Search Results Dropdown ── */
.ch-search-wrap {
    position: relative; /* Anchor for the dropdown */
}

.ch-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--neon-blue);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(26, 91, 185, 0.2), 0 0 0 1px rgba(26, 91, 185, 0.1);
    max-height: 380px;
    overflow-y: auto;
    z-index: 2000;
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--neon-blue) transparent;
}

[data-theme="dark"] .ch-search-results {
    background: rgba(13, 27, 46, 0.97);
    border-color: rgba(26, 91, 185, 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(26, 91, 185, 0.15);
}

.ch-search-results.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Each result link */
.ch-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(26, 91, 185, 0.08);
    transition: background 0.15s ease;
}

.ch-search-result-item:last-child { border-bottom: none; }

.ch-search-result-item:hover,
.ch-search-result-item:focus {
    background: rgba(26, 91, 185, 0.06);
    outline: none;
}

[data-theme="dark"] .ch-search-result-item:hover {
    background: rgba(26, 91, 185, 0.12);
}

.ch-search-result-item .icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(26, 91, 185, 0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    color: var(--neon-blue);
    flex-shrink: 0;
    transition: background 0.15s;
}

.ch-search-result-item:hover .icon {
    background: rgba(26, 91, 185, 0.18);
}

.ch-search-result-item .info { flex: 1; min-width: 0; }

.ch-search-result-item .title {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .ch-search-result-item .title { color: #f0f4ff; }

.ch-search-result-item .cat {
    display: block;
    font-size: 0.75rem;
    color: var(--neon-blue);
    margin-top: 2px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* No-results state */
.ch-search-results .ch-search-no-results {
    padding: 24px 16px;
    text-align: center;
    color: rgba(100, 116, 139, 0.8);
    font-size: 0.9rem;
}

/* Loading spinner inside dropdown */
.ch-search-results .ch-search-loading {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--neon-blue);
    font-size: 0.9rem;
}

/* ── 4. Member Login Glass Pill ── */
.ch-btn-login {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 145, 0, 0.5);
    border-radius: 50px;
    padding: 10px 24px;
    font-weight: 700;
    color: var(--ch-text);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 10px rgba(255, 145, 0, 0.2);
    transition: all 0.3s ease;
}

.ch-btn-login:hover {
    background: rgba(255, 145, 0, 0.15);
    border-color: var(--neon-orange);
    box-shadow: 0 0 25px rgba(255, 145, 0, 0.5);
    transform: translateY(-2px);
}

/* ── 5. Footer: 4-Column Layout ── */
.ch-footer {
    padding: 80px 0 40px;
    background: var(--ch-glass-bg);
    backdrop-filter: var(--ch-glass-blur);
    border-top: 1px solid var(--ch-glass-border);
    position: relative;
    overflow: hidden;
}

.ch-footer__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 60px;
}

.ch-footer__col h5 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── 6. Category Cloud ── */
.ch-cat-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ch-cat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--pill-color);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ch-text);
    transition: all 0.3s ease;
}

.ch-cat-pill:hover {
    background: var(--pill-color);
    color: #fff;
    box-shadow: 0 0 15px var(--pill-glow);
}

/* ── 7. Newsletter ── */
.ch-newsletter-form {
    display: flex;
    gap: 8px;
}

.ch-newsletter-form input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--ch-glass-border);
    border-radius: 50px;
    padding: 12px 20px;
    color: var(--ch-text);
    flex: 1;
}

.ch-newsletter-btn {
    background: var(--grad-blue-orange);
    border-radius: 50px;
    padding: 12px 25px;
    color: #fff;
    font-weight: 700;
    transition: all 0.3s ease;
}

.ch-newsletter-btn:hover {
    box-shadow: 0 5px 20px rgba(255, 145, 0, 0.4);
    transform: scale(1.05);
}

/* ── 8. Social Icons ── */
.ch-social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.ch-social-link {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px var(--soc-color));
}

.ch-social-link:hover {
    transform: rotate(360deg) scale(1.2);
    box-shadow: 0 0 20px var(--soc-color);
}

/* ── 9. Bottom Bar ── */
.ch-footer__bottom {
    padding-top: 30px;
    border-top: 1px solid var(--ch-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--ch-text-muted);
}

/* ── 10. Mobile Optimization ── */
@media (max-width: 1024px) {
    .ch-footer__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ch-search-wrap {
        display: none;
    }
}

@media (max-width: 768px) {
    .ch-footer__grid {
        grid-template-columns: 1fr;
    }
    .ch-nav {
        display: none;
    }
    .ch-hamburger {
        display: flex;
    }
    .ch-footer__bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Mobile Menu Overlay */
.ch-mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(13, 27, 46, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    transform: translateX(100%);
    transition: transform 0.5s ease;
}

.ch-mobile-menu.open {
    transform: translateX(0);
}

.ch-mobile-menu .ch-nav__link {
    font-size: 1.5rem;
}
