/*
 * Tripvalley Custom Header — CSS
 * Primary colour: #1F6672
 * Google Font: Inter (loaded via wp_enqueue)
 * ---------------------------------------------------------------------- */

/* ── CSS Custom Properties ────────────────────────────────────────────── */
:root {
    --tv-green:       #1F6672;
    --tv-green-dark:  #1a5761;
    --tv-green-light: #e9f0f1;
    --tv-red:         #e74c3c;
    --tv-text:        #1a1a2e;
    --tv-text-muted:  #666;
    --tv-border:      #e8e8e8;
    --tv-white:       #ffffff;
    --tv-shadow:      0 4px 24px rgba(0,0,0,.10);
    --tv-radius:      8px;
    --tv-header-h:    68px;
    --tv-tab-bar-h:   44px;
    --tv-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --tv-transition:  .22s cubic-bezier(.4,0,.2,1);
}

/* ── Reset scoped to header ───────────────────────────────────────────── */
#header.tv-site-header *,
#header.tv-site-header *::before,
#header.tv-site-header *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   HEADER SHELL
   ═══════════════════════════════════════════════════════════════════════ */
#header.tv-site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--tv-white);
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    font-family: var(--tv-font);
    width: 100%;
}

.tv-header-wrap {
    width: 100%;
}

.tv-container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Main row ─────────────────────────────────────────────────────────── */
.tv-header-inner {
    display: flex;
    align-items: center;
    height: var(--tv-header-h);
    gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════
   LOGO
   ═══════════════════════════════════════════════════════════════════════ */
.tv-logo {
    flex-shrink: 0;
    line-height: 0;
}

.tv-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.tv-logo-img {
    height: 42px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

.tv-logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--tv-green);
    letter-spacing: -.5px;
    font-family: var(--tv-font);
}

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP NAV TABS
   ═══════════════════════════════════════════════════════════════════════ */
.tv-nav-desktop {
    flex: 1;
    overflow: hidden;
}

/* Top-level menu list */
.tv-nav-desktop .tv-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 2px;
    padding: 0;
    margin: 0;
}

/* Top-level items */
.tv-nav-desktop .tv-nav-list > li {
    position: relative;
    flex-shrink: 0;
}

.tv-nav-desktop .tv-nav-list > li > a,
.tv-nav-desktop .tv-nav-list > li > span {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 14px;
    height: var(--tv-header-h);
    font-size: 14px;
    font-weight: 500;
    color: var(--tv-text);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: color var(--tv-transition), border-color var(--tv-transition);
    cursor: pointer;
}

.tv-nav-desktop .tv-nav-list > li > a:hover,
.tv-nav-desktop .tv-nav-list > li.current-menu-item > a,
.tv-nav-desktop .tv-nav-list > li.current-menu-ancestor > a,
.tv-nav-desktop .tv-nav-list > li.current-menu-parent > a {
    color: var(--tv-green);
    border-bottom-color: var(--tv-green);
}

/* Chevron for items with sub-menu */
.tv-nav-desktop .tv-nav-list > li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
}

/* ── Sub-menu (dropdown) ──────────────────────────────────────────────── */
.tv-nav-desktop .tv-nav-list li .sub-menu {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 200px;
    background: var(--tv-white);
    border-radius: 0 0 var(--tv-radius) var(--tv-radius);
    box-shadow: var(--tv-shadow);
    list-style: none;
    padding: 8px 0;
    z-index: 200;
    border-top: 3px solid var(--tv-green);
    animation: tvDropIn .18s ease;
}

@keyframes tvDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tv-nav-desktop .tv-nav-list li:hover > .sub-menu,
.tv-nav-desktop .tv-nav-list li:focus-within > .sub-menu {
    display: block;
}

.tv-nav-desktop .tv-nav-list li .sub-menu li a {
    display: block;
    padding: 10px 20px;
    font-size: 13.5px;
    color: var(--tv-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--tv-transition), color var(--tv-transition);
}

.tv-nav-desktop .tv-nav-list li .sub-menu li a:hover {
    background: var(--tv-green-light);
    color: var(--tv-green);
    padding-left: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════
   HEADER RIGHT ACTIONS
   ═══════════════════════════════════════════════════════════════════════ */
.tv-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Phone link ───────────────────────────────────────────────────────── */
.tv-phone-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tv-text);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--tv-transition);
}

.tv-phone-link:hover {
    color: var(--tv-green);
}

/* ── My Account dropdown ──────────────────────────────────────────────── */
.tv-account {
    position: relative;
}

.tv-account-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--tv-border);
    border-radius: 24px;
    padding: 7px 14px 7px 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tv-text);
    cursor: pointer;
    font-family: var(--tv-font);
    transition: border-color var(--tv-transition), color var(--tv-transition);
    white-space: nowrap;
}

.tv-account-btn:hover,
.tv-account-btn[aria-expanded="true"] {
    border-color: var(--tv-green);
    color: var(--tv-green);
}

.tv-account-label {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-chevron {
    flex-shrink: 0;
    transition: transform var(--tv-transition);
}

.tv-account-btn[aria-expanded="true"] .tv-chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
.tv-account-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 188px;
    background: var(--tv-white);
    border-radius: var(--tv-radius);
    box-shadow: var(--tv-shadow);
    border: 1px solid var(--tv-border);
    z-index: 300;
    overflow: hidden;
    animation: tvDropIn .18s ease;
}

.tv-account-menu.tv-open {
    display: block;
}

.tv-account-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 13.5px;
    color: var(--tv-text);
    text-decoration: none;
    transition: background var(--tv-transition), color var(--tv-transition);
}

.tv-account-item:hover {
    background: var(--tv-green-light);
    color: var(--tv-green);
}

.tv-account-item svg {
    flex-shrink: 0;
    opacity: .7;
}

.tv-account-divider {
    height: 1px;
    background: var(--tv-border);
    margin: 4px 0;
}

.tv-account-logout {
    color: var(--tv-red);
}

.tv-account-logout:hover {
    background: #fff5f5;
    color: var(--tv-red);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.tv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tv-font);
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background var(--tv-transition), color var(--tv-transition),
                border-color var(--tv-transition), box-shadow var(--tv-transition);
    white-space: nowrap;
    cursor: pointer;
    border: 2px solid transparent;
    line-height: 1;
}

.tv-btn-sm {
    font-size: 13px;
    padding: 8px 18px;
}

.tv-btn-full {
    width: 100%;
    font-size: 15px;
    padding: 13px 20px;
}

/* Filled green */
.tv-btn-filled {
    background: var(--tv-green);
    color: var(--tv-white);
    border-color: var(--tv-green);
}

.tv-btn-filled:hover {
    background: var(--tv-green-dark);
    border-color: var(--tv-green-dark);
    color: var(--tv-white);
    box-shadow: 0 4px 14px rgba(31,102,114,.35);
}

/* Outlined green */
.tv-btn-outline {
    background: transparent;
    color: var(--tv-green);
    border-color: var(--tv-green);
}

.tv-btn-outline:hover {
    background: var(--tv-green-light);
    color: var(--tv-green-dark);
}

/* ── Hamburger ────────────────────────────────────────────────────────── */
.tv-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
    margin-left: 4px;
}

.tv-ham-bar {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--tv-text);
    border-radius: 2px;
    transition: transform var(--tv-transition), opacity var(--tv-transition);
}

.tv-hamburger[aria-expanded="true"] .tv-ham-bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.tv-hamburger[aria-expanded="true"] .tv-ham-bar:nth-child(2) {
    opacity: 0;
}

.tv-hamburger[aria-expanded="true"] .tv-ham-bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE SCROLLABLE TABS BAR
   ═══════════════════════════════════════════════════════════════════════ */
.tv-mobile-tabs-bar {
    display: none;
    background: var(--tv-white);
    border-top: 1px solid var(--tv-border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tv-mobile-tabs-bar::-webkit-scrollbar {
    display: none;
}

.tv-mobile-tabs-inner {
    padding: 0 16px;
}

.tv-mobile-tabs-list {
    display: flex;
    align-items: stretch;
    list-style: none;
    gap: 0;
    padding: 0;
    margin: 0;
    white-space: nowrap;
}

.tv-mobile-tabs-list > li > a {
    display: flex;
    align-items: center;
    padding: 0 14px;
    height: var(--tv-tab-bar-h);
    font-size: 13px;
    font-weight: 500;
    color: var(--tv-text-muted);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: color var(--tv-transition), border-color var(--tv-transition);
}

.tv-mobile-tabs-list > li.current-menu-item > a,
.tv-mobile-tabs-list > li > a:hover {
    color: var(--tv-green);
    border-bottom-color: var(--tv-green);
}

/* Hide sub-menu items in the tab bar */
.tv-mobile-tabs-list > li > .sub-menu {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE DRAWER
   ═══════════════════════════════════════════════════════════════════════ */
.tv-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    pointer-events: none;
    visibility: hidden;
}

.tv-drawer.tv-drawer-open {
    pointer-events: auto;
    visibility: visible;
}

/* Overlay */
.tv-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    transition: opacity var(--tv-transition);
}

.tv-drawer-open .tv-drawer-overlay {
    opacity: 1;
}

/* Panel slides in from right */
.tv-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 300px;
    max-width: 88vw;
    background: var(--tv-white);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    overflow: hidden;
}

.tv-drawer-open .tv-drawer-panel {
    transform: translateX(0);
}

/* Drawer top */
.tv-drawer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--tv-border);
    flex-shrink: 0;
}

.tv-drawer-logo a {
    text-decoration: none;
    line-height: 0;
}

.tv-drawer-logo .tv-logo-img {
    height: 36px;
}

.tv-drawer-logo .tv-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--tv-green);
}

.tv-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--tv-text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: color var(--tv-transition), background var(--tv-transition);
    display: flex;
    align-items: center;
}

.tv-drawer-close:hover {
    color: var(--tv-text);
    background: var(--tv-border);
}

/* Drawer body (scrollable) */
.tv-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Contact block */
.tv-drawer-contact {
    padding: 16px 20px;
    background: var(--tv-green-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tv-drawer-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tv-green-dark);
    text-decoration: none;
}

.tv-drawer-contact-row:hover {
    color: var(--tv-green);
}

.tv-drawer-contact-row svg {
    flex-shrink: 0;
    color: var(--tv-green);
}

/* Drawer nav */
.tv-drawer-nav {
    padding: 8px 0;
}

.tv-drawer-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tv-drawer-nav-list > li > a,
.tv-drawer-nav-list > li > span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--tv-text);
    text-decoration: none;
    border-bottom: 1px solid var(--tv-border);
    transition: color var(--tv-transition), background var(--tv-transition);
}

.tv-drawer-nav-list > li > a:hover {
    color: var(--tv-green);
    background: var(--tv-green-light);
    padding-left: 24px;
}

.tv-drawer-nav-list > li.current-menu-item > a {
    color: var(--tv-green);
    font-weight: 600;
}

/* Sub-menu in drawer */
.tv-drawer-nav-list .sub-menu {
    display: none;
    list-style: none;
    padding: 0;
    background: #f9f9f9;
}

.tv-drawer-nav-list li.tv-drawer-open-sub > .sub-menu {
    display: block;
}

.tv-drawer-nav-list .sub-menu li a {
    display: block;
    padding: 10px 20px 10px 36px;
    font-size: 13.5px;
    color: var(--tv-text-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--tv-border);
    transition: color var(--tv-transition), background var(--tv-transition);
}

.tv-drawer-nav-list .sub-menu li a:hover {
    color: var(--tv-green);
    background: var(--tv-green-light);
}

/* Chevron for drawer parent items */
.tv-drawer-nav-list > li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--tv-text-muted);
    border-bottom: 2px solid var(--tv-text-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--tv-transition);
    flex-shrink: 0;
}

.tv-drawer-nav-list > li.tv-drawer-open-sub > a::after {
    transform: rotate(-135deg) translateY(-2px);
}

/* Drawer footer */
.tv-drawer-footer {
    padding: 20px;
    border-top: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: var(--tv-white);
}

.tv-drawer-username {
    font-size: 13px;
    color: var(--tv-text-muted);
    text-align: center;
    padding-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════
   HELP MASCOT BUBBLE
   ═══════════════════════════════════════════════════════════════════════ */
.tv-mascot {
    position: fixed;
    bottom: 28px;
    left: 24px;
    z-index: 9000;
    cursor: pointer;
}

.tv-mascot-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--tv-green);
    color: var(--tv-white);
    border-radius: 50px;
    padding: 10px 18px 10px 12px;
    box-shadow: 0 6px 20px rgba(31,102,114,.4);
    font-family: var(--tv-font);
    font-weight: 600;
    font-size: 13.5px;
    transition: transform var(--tv-transition), box-shadow var(--tv-transition);
    position: relative;
    z-index: 1;
}

.tv-mascot:hover .tv-mascot-inner {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(31,102,114,.5);
}

.tv-mascot-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.tv-mascot-label {
    white-space: nowrap;
}

/* Pulse ring */
.tv-mascot-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50px;
    background: var(--tv-green);
    opacity: .4;
    animation: tvPulse 2.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes tvPulse {
    0%   { transform: translate(-50%,-50%) scale(1); opacity: .4; }
    70%  { transform: translate(-50%,-50%) scale(1.25); opacity: 0; }
    100% { transform: translate(-50%,-50%) scale(1.25); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════
   BODY SCROLL LOCK (when drawer open)
   ═══════════════════════════════════════════════════════════════════════ */
body.tv-no-scroll {
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 1024px)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {

    .tv-nav-desktop {
        display: none;
    }

    .tv-phone-link {
        display: none;
    }

    .tv-btn-sm {
        display: none;
    }

    .tv-account {
        display: none;
    }

    .tv-hamburger {
        display: flex;
    }

    .tv-mobile-tabs-bar {
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 640px)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

    :root {
        --tv-header-h: 58px;
    }

    .tv-container {
        padding: 0 16px;
    }

    .tv-logo-img {
        height: 34px;
    }

    .tv-mascot-label {
        display: none;
    }

    .tv-mascot-inner {
        padding: 12px;
        border-radius: 50%;
    }

    .tv-mascot-pulse {
        border-radius: 50%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   ACCESSIBILITY — Focus styles
   ═══════════════════════════════════════════════════════════════════════ */
.tv-account-btn:focus-visible,
.tv-hamburger:focus-visible,
.tv-drawer-close:focus-visible,
.tv-btn:focus-visible,
.tv-account-item:focus-visible,
.tv-nav-desktop .tv-nav-list a:focus-visible {
    outline: 3px solid var(--tv-green);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════
   WP Admin Bar adjustment
   ═══════════════════════════════════════════════════════════════════════ */
.admin-bar #header.tv-site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar #header.tv-site-header {
        top: 46px;
    }
}
