/* ===== NEUROTRIALS UNIVERSAL HEADER & STYLES ===== */

/* ===== BASE TYPOGRAPHY — match what Idea Flow / site had ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 16px;
    line-height: 1.6;
    color: #1e1e1e;
}
h1, h2, h3, h4, h5, h6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
p, span, a, li, td, th, input, button, select, textarea, label, div {
    font-family: inherit;
}

/* Elementor content inherits system font */
.elementor-widget-text-editor,
.elementor-widget-heading .elementor-heading-title,
.elementor-widget-counter .elementor-counter-number-wrapper,
.elementor-widget-counter .elementor-counter-title,
.elementor *,
#h2-page-content * {
    font-family: inherit !important;
}

/* Trial table font consistency */
#trialsTable, #trialsTable * {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

/* Trial count / visits counters */
.ntsd-stat, .ntsd-counter, [class*="counter"], [class*="stat"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

/* ===== KILL WHITE SPACE ===== */
html, body { margin: 0 !important; padding: 0 !important; }
body.admin-bar .h2-header { top: 32px; }
body.admin-bar #h2-page-content { margin-top: 126px; }
@media (max-width: 782px) {
    body.admin-bar .h2-header { top: 46px; }
    body.admin-bar #h2-page-content { margin-top: 140px; }
}

/* ===== HIDE DEFAULT WP HEADER/NAV ===== */
#header, .site-header, .elementor-location-header,
header.has-logo, .ehf-header, #ast-desktop-header,
.ast-above-header, .ast-main-header-wrap,
.elementor-element [data-elementor-type="header"],
nav.elementor-nav-menu, .hfe-header-content,
#masthead, .site-navigation { display: none !important; }

/* ===== SINGLE-TIER HEADER ===== */
.h2-header { position: fixed; top: 0; left: 0; right: 0; z-index: 999999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.h2-header * { box-sizing: border-box; }
#h2-page-content { margin-top: 94px; position: relative; z-index: 1; }
.h2-header-bar {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 56px;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    position: relative;
}
.h2-header-left { display: flex; align-items: center; gap: 0; }
.h2-header-logo { display: flex; align-items: center; text-decoration: none; margin-right: 8px; padding-right: 20px; border-right: 1px solid #e5e7eb; }
.h2-header-logo img { height: 28px; }
.h2-nav-main { display: flex; align-items: center; gap: 0; }
.h2-nav-item {
    display: flex; align-items: center; gap: 5px;
    padding: 0 16px; height: 56px;
    font-size: 14px; font-weight: 600;
    color: #4b5563; text-decoration: none;
    transition: all 0.15s; position: relative; white-space: nowrap;
}
.h2-nav-item:hover { color: #1f7cec; background: #f0f7ff; }
.h2-nav-item.active { color: #fff; background: #1f7cec; }
.h2-nav-badge { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 5px; border-radius: 3px; }
.h2-nav-item.active .h2-nav-badge { background: rgba(255,255,255,0.25); color: #fff; }
.h2-nav-item:not(.active) .h2-nav-badge { background: #e0ecff; color: #1f7cec; }
.h2-mobile-nav-row { display: none; }
.h2-header-right { display: flex; align-items: center; gap: 6px; }
.h2-nav-sec { padding: 0 12px; height: 56px; display: flex; align-items: center; font-size: 13px; color: #9ca3af; text-decoration: none; transition: color 0.15s; }
.h2-nav-sec:hover { color: #4b5563; }
.h2-nav-divider { width: 1px; height: 24px; background: #e5e7eb; margin: 0 4px; }
.h2-header-auth { display: flex; align-items: center; gap: 10px; }
.h2-header-auth a { font-size: 13px; font-weight: 600; text-decoration: none; transition: all 0.2s; }
.h2-auth-login { color: #4b5563; }
.h2-auth-login:hover { color: #1f7cec; }
.h2-auth-signup { background: #1f7cec; color: #fff; padding: 6px 16px; border-radius: 5px; }
.h2-auth-signup:hover { background: #1a6dd4; color: #fff; }
.h2-nav-toggle { display: none; background: none; border: none; color: #4b5563; font-size: 24px; cursor: pointer; padding: 4px 8px; }

/* Header center title hidden */
.h2-header-center { display: none; }

/* Navy title banner hidden */
.h2-navy-bar { display: none; }

/* ===== SPECIALTY SUB-NAV BAR (NAVY) ===== */
.h2-spec-bar {
    background: #1e3a5f;
    border-bottom: none;
    display: flex;
    align-items: center;
    padding: 0 32px;
    height: 38px;
    gap: 0;
    position: relative;
}
.h2-spec-left { display: flex; align-items: center; gap: 0; flex: 1; justify-content: center; }
.h2-spec-item {
    padding: 0 16px; height: 38px;
    display: flex; align-items: center;
    font-size: 13px; font-weight: 500;
    color: rgba(255,255,255,0.7); text-decoration: none;
    transition: all 0.15s; position: relative;
    white-space: nowrap; cursor: pointer;
    border: none; background: none;
    font-family: inherit;
}
.h2-spec-item:hover { color: #fff; background: rgba(255,255,255,0.1); }
.h2-spec-item.active { color: #fff; font-weight: 700; }
.h2-spec-item.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #B8860B; }
.h2-spec-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* Active filter tag in specialty bar */
.h2-filter-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: #e0ecff; color: #1f7cec;
    font-size: 12px; font-weight: 600;
    padding: 3px 10px; border-radius: 12px;
    cursor: pointer; transition: all 0.15s;
    white-space: nowrap;
}
.h2-filter-tag:hover { background: #c7dbff; }
.h2-filter-tag .h2-tag-x { font-size: 14px; font-weight: 700; margin-left: 2px; line-height: 1; }

/* ===== FLOATING FILTER PANEL ===== */
.h2-filter-panel {
    position: absolute;
    top: 38px; left: 0; right: 0;
    background: #fff;
    border-bottom: 2px solid #1e3a5f;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    z-index: 999998;
    padding: 0 32px;
}
.h2-filter-panel.open {
    max-height: 360px;
    padding: 14px 32px 16px;
    overflow-y: auto;
}
.h2-fp-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.h2-fp-tab {
    padding: 6px 18px; border-radius: 18px;
    font-size: 13px; font-weight: 600;
    border: 1px solid #b8cfe0; background: #d6e6f5;
    color: #1e3a5f; cursor: pointer;
    transition: all 0.15s;
}
.h2-fp-tab:hover { border-color: #1f7cec; color: #1f7cec; background: #c5dcf0; }
.h2-fp-tab.active { background: #1f7cec; color: #fff; border-color: #1f7cec; }
.h2-fp-content { display: none; }
.h2-fp-content.active { display: block; }
.h2-fp-section { margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; line-height: 1.6; }
.h2-fp-label { font-size: 13px; font-weight: 700; color: #1e3a5f; margin-right: 4px; white-space: nowrap; }
.h2-fp-tag {
    display: inline-block;
    padding: 4px 14px; border-radius: 14px;
    font-size: 12px; font-weight: 500;
    background: #eef3f9; color: #475569;
    cursor: pointer; transition: all 0.15s;
    border: 1px solid transparent;
}
.h2-fp-tag:hover { background: #dbe8f8; color: #1f7cec; border-color: #bfdbfe; }

/* ===== SPECIALTY COUNT BADGES ===== */
.h2-spec-count {
    font-size: 10px;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 5px;
    line-height: 1.4;
}
.h2-spec-item.active .h2-spec-count {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

/* ===== MODAL & DETAIL PANEL ABOVE HEADER ===== */
#trialModal { z-index: 99999999 !important; padding-top: 60px !important; }
#trialModal #modalContent { z-index: 99999999 !important; }
.nwt-slide-panel { z-index: 99999999 !important; }
.nwt-slide-overlay { z-index: 99999998 !important; }

/* ===== AI CHAT FAB — on-brand colors ===== */
.sp-chat-fab { background: linear-gradient(135deg, #1e3a5f, #3B8DFF) !important; box-shadow: 0 4px 16px rgba(30,58,95,0.4) !important; }
.sp-chat-fab:hover { box-shadow: 0 6px 24px rgba(30,58,95,0.5) !important; }
.sp-chat-header { background: linear-gradient(135deg, #1e3a5f, #3B8DFF) !important; }
.sp-chat-msg.user .sp-chat-bubble { background: #1e3a5f !important; }
.sp-chat-input:focus { border-color: #3B8DFF !important; }
.sp-chat-send { background: #1e3a5f !important; }
.sp-chat-quick-btn:hover { background: #1e3a5f !important; color: #fff !important; border-color: #1e3a5f !important; }

/* ===== BACK TO TOP BUTTON ===== */
.h2-back-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #1e3a5f;
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.h2-back-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.h2-back-top:hover { background: #2a4f7a; }

/* ===== MOBILE SPEC BAR SCROLL FADE ===== */
.h2-spec-bar-wrap { position: relative; }
.h2-spec-bar-wrap::before,
.h2-spec-bar-wrap::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; width: 24px;
    z-index: 2;
    pointer-events: none;
    display: none;
}
.h2-spec-bar-wrap::before { left: 0; background: linear-gradient(90deg, #1e3a5f 0%, transparent 100%); }
.h2-spec-bar-wrap::after { right: 0; background: linear-gradient(-90deg, #1e3a5f 0%, transparent 100%); }

/* ===== FOOTER ===== */
.nt-footer {
    background: #1e3a5f;
    color: rgba(255,255,255,0.7);
    padding: 32px 28px 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
}
.nt-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.nt-footer a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: color 0.15s;
}
.nt-footer a:hover { color: #fff; }
.nt-footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* ===== NEUROEVIDENCE BUTTON & PANEL ===== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@600;700&display=swap');
.h2-ne-btn {
    display: inline-flex; align-items: center;
    padding: 6px 16px; border-radius: 50px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px; font-weight: 600;
    color: #fff; background: #00a896;
    border: none; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
    margin-right: 6px; letter-spacing: 0.01em;
}
.ne-btn-bold { font-weight: 700; }
.ne-btn-ai { font-weight: 600; }
.h2-ne-btn:hover { background: #009485; box-shadow: 0 2px 8px rgba(0,168,150,0.3); }
.h2-ne-btn.active { background: #007a6c; box-shadow: 0 2px 12px rgba(0,168,150,0.4); }

#neuroevidence-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999997;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
#neuroevidence-overlay.open { opacity: 1; pointer-events: auto; }

#neuroevidence-panel {
    position: fixed;
    top: 56px; left: 50%; transform: translateX(-50%) translateY(-110%);
    width: 92vw; max-width: 1200px;
    height: calc(90vh - 56px);
    background: #0f172a;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    z-index: 999998;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column;
}
body.admin-bar #neuroevidence-panel { top: 88px; height: calc(90vh - 88px); }
#neuroevidence-panel.open { transform: translateX(-50%) translateY(0); }

.ne-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #00503e 100%);
    border-bottom: 1px solid rgba(0,168,150,0.3);
    flex-shrink: 0;
}
.ne-panel-title {
    display: flex; align-items: center; gap: 12px;
}
.ne-panel-logo {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 16px; font-weight: 600; color: #fff;
}
.ne-panel-logo strong { font-weight: 700; }
.ne-panel-subtitle {
    font-size: 12px; font-weight: 400; color: #5eead4; margin-left: 4px;
}
.ne-panel-actions { display: flex; align-items: center; gap: 12px; }
.ne-open-btn {
    font-size: 12px; font-weight: 600; color: #5eead4;
    text-decoration: none; padding: 4px 12px;
    border: 1px solid rgba(94,234,212,0.3); border-radius: 5px;
    transition: all 0.2s;
}
.ne-open-btn:hover { background: rgba(94,234,212,0.1); color: #99f6e4; border-color: #5eead4; }
.ne-close-btn {
    background: none; border: none; color: #94a3b8;
    font-size: 24px; cursor: pointer; padding: 0 4px;
    line-height: 1; transition: color 0.15s;
}
.ne-close-btn:hover { color: #fff; }

#neuroevidence-iframe {
    flex: 1; width: 100%; border: none;
    background: #0f172a;
}

/* ===== MOBILE-ONLY ELEMENTS (hidden on desktop) ===== */
.h2-mobile-auth { display: none; }
.h2-mobile-specialties { display: none; }
.h2-nav-ne-mobile { display: none !important; }
.ne-mobile-fab {
    display: none; position: fixed;
    bottom: 24px; right: 24px;
    height: 44px; padding: 0 18px;
    border-radius: 22px;
    background: #00a896;
    color: #fff; border: none; cursor: pointer;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px; font-weight: 700;
    box-shadow: 0 4px 20px rgba(0,168,150,0.4);
    z-index: 99999;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 0.02em;
    align-items: center; justify-content: center;
}
.ne-fab-bold { font-weight: 800; }
.ne-mobile-fab:active { transform: scale(0.92); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Header bar: allow children to wrap */
    .h2-header-bar { padding: 0 12px; height: auto; min-height: 52px; flex-wrap: wrap; }

    /* Top row: hamburger left, logo center, login right */
    .h2-header-left { width: 100%; display: flex; align-items: center; flex-wrap: wrap; min-height: 52px; }
    .h2-nav-toggle { display: block; order: 1; font-size: 26px; padding: 8px 10px; color: #1e3a5f; margin-right: auto; }
    .h2-header-logo { order: 2; position: absolute; left: 50%; top: 0; height: 52px; display: flex; align-items: center; transform: translateX(-50%); padding-right: 0; margin-right: 0; border-right: none; z-index: 2; }
    .h2-header-logo img { height: 24px; }
    .h2-mobile-auth {
        display: inline-flex; align-items: center; order: 3; margin-left: auto;
        font-size: 13px; font-weight: 600; color: #1e3a5f;
        text-decoration: none; padding: 6px 14px; border-radius: 5px;
        border: 1.5px solid #1e3a5f; white-space: nowrap;
    }
    .h2-mobile-auth:hover { background: #1e3a5f; color: #fff; }
    .h2-mobile-logout { margin-left: 6px; font-size: 12px; padding: 5px 10px; border-color: #9ca3af; color: #6b7280; }
    .h2-mobile-logout:hover { background: #6b7280; color: #fff; border-color: #6b7280; }

    /* Nav menu: hidden by default, full-width column when open */
    .h2-nav-main, .h2-header-right {
        display: none; flex-direction: column; width: 100%;
        order: 10;
    }
    .h2-nav-main.open, .h2-header-right.open {
        display: flex;
        border-top: 1px solid #e5e7eb;
        background: #fff;
    }
    .h2-nav-main.open { padding: 4px 0; }
    .h2-header-right.open { padding: 8px 0; border-top: 1px solid #f0f0f0; }

    /* Hide primary nav items from hamburger — they're in the mobile nav row now */
    .h2-nav-main .h2-nav-item:not(.h2-nav-ne-mobile) { display: none !important; }

    /* Secondary nav items in hamburger: full-width, good tap targets */
    .h2-nav-sec { width: 100%; height: 44px; padding: 0 20px; font-size: 14px; color: #6b7280; }
    .h2-nav-divider { display: none; }

    /* Auth: hidden from dropdown on mobile (login/account is in top bar) */
    .h2-header-auth { display: none; }

    /* NeuroEvidence button in dropdown */
    .h2-ne-btn { font-size: 12px; padding: 8px 16px; margin: 4px 20px; width: calc(100% - 40px); justify-content: center; }

    .h2-header-center { display: none; }

    /* ===== MOBILE NAV ROW — always visible below header bar ===== */
    .h2-mobile-nav-row {
        display: flex !important;
        align-items: center;
        background: #fff;
        border-bottom: 1px solid #e5e7eb;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 4px;
        height: 40px;
        gap: 0;
    }
    .h2-mobile-nav-row::-webkit-scrollbar { display: none; }
    .h2-mobile-nav-row a {
        flex-shrink: 0;
        padding: 0 12px;
        height: 40px;
        display: flex;
        align-items: center;
        font-size: 13px;
        font-weight: 600;
        color: #4b5563;
        text-decoration: none;
        white-space: nowrap;
        border-bottom: 2px solid transparent;
        transition: all 0.15s;
    }
    .h2-mobile-nav-row a:hover { color: #1f7cec; }
    .h2-mobile-nav-row a.active {
        color: #1f7cec;
        border-bottom-color: #1f7cec;
    }
    .h2-mobile-nav-row .h2-mnr-ne {
        color: #00a896;
        font-weight: 700;
    }
    .h2-mobile-nav-row .h2-mnr-ne:hover { color: #009485; }

    /* Specialty sub-nav bar */
    .h2-spec-bar { overflow-x: auto; padding: 0 12px; -webkit-overflow-scrolling: touch; height: 36px; }
    .h2-spec-bar::-webkit-scrollbar { display: none; }
    .h2-spec-item { padding: 0 12px; font-size: 12px; flex-shrink: 0; height: 36px; }
    .h2-spec-bar-wrap::before, .h2-spec-bar-wrap::after { display: block; }

    /* Filter panel */
    .h2-filter-panel.open { padding: 12px 12px; max-height: 60vh; }

    /* Page content: header 52px + nav row 40px + spec bar 36px = 128px */
    #h2-page-content { margin-top: 128px; }

    /* Back to top */
    .h2-back-top { bottom: 16px; right: 16px; width: 38px; height: 38px; font-size: 18px; }

    /* Footer stacks */
    .nt-footer-inner { flex-direction: column; text-align: center; }

    /* NeuroEvidence panel full-screen on mobile */
    #neuroevidence-panel { width: 100vw; border-radius: 0; height: calc(92vh - 52px); }
    .ne-panel-subtitle { display: none; }
    .ne-open-btn { display: none; }

    /* --- Mobile auth button is styled above in the top-row section --- */

    /* --- Hide NeuroEvidence button in dropdown, use FAB instead --- */
    .h2-ne-btn { display: none !important; }
    .ne-mobile-fab { display: flex; }

    /* --- Specialty accordion inside hamburger --- */
    .h2-mobile-specialties { display: block; width: 100%; border-top: 1px solid #f0f0f0; }
    .h2-mobile-spec-toggle {
        display: flex; align-items: center; justify-content: space-between;
        width: 100%; height: 48px; padding: 0 20px;
        font-size: 15px; font-weight: 600; color: #4b5563;
        background: none; border: none; cursor: pointer;
        font-family: inherit;
    }
    .h2-spec-chevron { transition: transform 0.25s ease; }
    .h2-mobile-spec-list {
        display: none; flex-direction: column;
        background: #f8fafc; padding: 4px 0;
    }
    .h2-mobile-spec-list.open { display: flex; }
    .h2-mobile-spec-list a {
        padding: 10px 32px; font-size: 14px; font-weight: 500;
        color: #4b5563; text-decoration: none; transition: all 0.15s;
    }
    .h2-mobile-spec-list a:hover,
    .h2-mobile-spec-list a:active { background: #e0ecff; color: #1f7cec; }

    /* --- NeuroEvidence link in mobile menu — hidden, now in nav row --- */
    .h2-nav-ne-mobile { display: none !important; }

    /* --- Active state highlight in mobile menu --- */
    .h2-nav-main.open .h2-nav-item.active {
        background: #1f7cec; color: #fff;
        border-left: 3px solid #B8860B;
    }
}
