/**
 * Isolated header + drawer (namespace .tia-hdr / .tia-drawer)
 * Loaded last so nothing in frontend.css can break the top bar or mobile menu.
 */

/* ========== Sticky header shell ========== */
.tia-hdr {
    position: sticky;
    top: 0;
    z-index: 10050;
    width: 100%;
    background: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 1px 0 #e5e7eb, 0 6px 20px rgba(15, 23, 42, 0.06);
    /* Header stays visible when drawer is open */
}

body.admin-bar .tia-hdr {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .tia-hdr {
        top: 46px;
    }
}

.tia-hdr *,
.tia-hdr *::before,
.tia-hdr *::after,
.tia-drawer *,
.tia-drawer *::before,
.tia-drawer *::after {
    box-sizing: border-box;
}

.tia-hdr__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
}

/* Flag stripe */
.tia-hdr__stripe {
    height: 3px;
    background: linear-gradient(90deg, #b22234 0 33.33%, #fff 33.33% 66.66%, #3c3b6e 66.66% 100%);
}

/* ========== Top utility bar ========== */
.tia-hdr__top {
    background: #0b1d36;
    color: #e2e8f0;
    font-size: 12.5px;
    line-height: 1.3;
}

.tia-hdr__top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.tia-hdr__tagline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 600;
    color: #e2e8f0;
    min-width: 0;
}

.tia-hdr__tagline > span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tia-hdr__star {
    color: #fbbf24;
    flex-shrink: 0;
    font-size: 11px;
}

.tia-hdr__top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tia-hdr__top-link {
    color: #e2e8f0 !important;
    font-weight: 600;
    font-size: 12.5px;
    text-decoration: none !important;
    padding: 4px 2px;
    white-space: nowrap;
}

.tia-hdr__top-link:hover {
    color: #fff !important;
}

/* List free pill — explicit styles, no inheritance bugs */
a.tia-hdr__pill,
.tia-hdr a.tia-hdr__pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: background 0.15s ease, border-color 0.15s ease;
}

a.tia-hdr__pill:hover,
.tia-hdr a.tia-hdr__pill:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: rgba(255, 255, 255, 0.55) !important;
    color: #fff !important;
}

/* ========== Main bar ========== */
.tia-hdr__main {
    background: #fff;
    border-bottom: 1px solid #eef2f7;
}

.tia-hdr__main-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 64px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.tia-hdr__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none !important;
    line-height: 0;
}

.tia-hdr__logo img {
    display: block !important;
    height: 42px !important;
    width: auto !important;
    max-width: 168px !important;
    max-height: 42px !important;
    object-fit: contain !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tia-hdr__nav {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 2px;
    min-width: 0;
}

.tia-hdr__nav a {
    color: #1e293b !important;
    font-weight: 650;
    font-size: 14.5px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none !important;
    white-space: nowrap;
}

.tia-hdr__nav a:hover {
    background: #f1f5f9;
    color: #0b1d36 !important;
}

.tia-hdr__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.tia-hdr__search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #334155 !important;
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none !important;
    background: #fff;
}

.tia-hdr__search-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.tia-hdr__cta {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 14px !important;
    border-radius: 9px !important;
    border: 0 !important;
    background: #b22234 !important;
    color: #fff !important;
    font-weight: 800 !important;
    font-size: 13.5px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow: 0 3px 10px rgba(178, 34, 52, 0.25);
}

.tia-hdr__cta:hover {
    background: #9b1c2e !important;
    color: #fff !important;
}

/* Burger */
.tia-hdr__burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    margin-left: 4px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    flex-shrink: 0;
}

.tia-hdr__burger-lines {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 18px;
}

.tia-hdr__burger-lines span {
    display: block;
    height: 2px;
    width: 100%;
    background: #0b1d36;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.tia-hdr__burger[aria-expanded="true"] .tia-hdr__burger-lines span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.tia-hdr__burger[aria-expanded="true"] .tia-hdr__burger-lines span:nth-child(2) {
    opacity: 0;
}
.tia-hdr__burger[aria-expanded="true"] .tia-hdr__burger-lines span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Category chips */
.tia-hdr__cats {
    background: #f8fafc;
    border-bottom: 1px solid #e8edf3;
}

.tia-hdr__cats-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    padding-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tia-hdr__cats-inner::-webkit-scrollbar {
    display: none;
}

.tia-hdr__cats-label {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-right: 2px;
}

.tia-hdr__chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155 !important;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
}

.tia-hdr__chip:hover {
    border-color: #93c5fd;
    color: #1e40af !important;
    background: #eff6ff;
}

.tia-hdr__chip--all {
    color: #b22234 !important;
    border-color: #fecaca;
    background: #fff7f7;
}

/* ========== Drawer (outside header) ========== */
.tia-drawer {
    position: fixed;
    inset: 0;
    z-index: 10100;
    pointer-events: none;
}

.tia-drawer.is-open {
    pointer-events: auto;
}

.tia-drawer[hidden] {
    display: none !important;
}

.tia-drawer.is-open[hidden] {
    display: block !important;
}

.tia-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.tia-drawer.is-open .tia-drawer__backdrop {
    opacity: 1;
}

.tia-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(360px, 100vw);
    height: 100%;
    height: 100dvh;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
}

.tia-drawer.is-open .tia-drawer__panel {
    transform: translateX(0);
}

.tia-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #eef2f7;
    background: #0b1d36;
    color: #fff;
}

.tia-drawer__title {
    font-weight: 800;
    font-size: 16px;
}

.tia-drawer__close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.tia-drawer__search {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
}

.tia-drawer__field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 12px;
    min-height: 46px;
    margin: 0;
}

.tia-drawer__field i {
    color: #64748b;
    font-size: 13px;
}

.tia-drawer__field input {
    border: 0;
    outline: none;
    width: 100%;
    font-size: 16px; /* no iOS zoom */
    background: transparent;
    color: #0f172a;
    min-width: 0;
}

.tia-drawer__search-btn {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: #b22234;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
}

.tia-drawer__nav {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    flex: 1;
}

.tia-drawer__nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 8px;
    color: #0f172a !important;
    font-weight: 650;
    font-size: 16px;
    text-decoration: none !important;
    min-height: 48px;
}

.tia-drawer__nav a i {
    width: 20px;
    color: #64748b;
    text-align: center;
}

.tia-drawer__nav a:hover {
    background: #f1f5f9;
}

.tia-drawer__cta {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 16px 0;
    padding: 14px 16px;
    border-radius: 10px;
    background: #b22234 !important;
    color: #fff !important;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none !important;
    text-align: center;
}

body.tia-drawer-open {
    overflow: hidden !important;
    /* Do NOT hide header — only lock scroll */
}

/* ========== Responsive ========== */
@media (max-width: 1020px) {
    .tia-hdr__nav {
        display: none;
    }
    .tia-hdr__search-btn span {
        display: none;
    }
    .tia-hdr__burger {
        display: inline-flex;
    }
}

@media (max-width: 900px) {
    .tia-hdr__cats {
        display: none;
    }
    .tia-hdr__search-btn {
        display: none;
    }
}

@media (max-width: 640px) {
    .tia-hdr__tagline > span:last-child {
        max-width: 42vw;
    }
    .tia-hdr__cta span {
        display: none;
    }
    .tia-hdr__cta {
        padding: 10px 12px !important;
    }
    .tia-hdr__logo img {
        height: 36px !important;
        max-width: 140px !important;
    }
    .tia-hdr__main-inner {
        min-height: 56px;
        gap: 10px;
    }
}

@media (max-width: 420px) {
    .tia-hdr__tagline {
        display: none;
    }
    .tia-hdr__top-inner {
        justify-content: flex-end;
    }
    .tia-hdr__cta {
        display: none !important;
    }
}

/* Skip link */
.tia-skip-link {
    position: absolute;
    left: -9999px;
}
.tia-skip-link:focus {
    left: 12px;
    top: 12px;
    z-index: 10200;
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
