/* ==========================================================================
   Public site header (include/__header.blade.php)
   --------------------------------------------------------------------------
   Linked last in include/__head.blade.php, public pages only (the dashboard
   has its own header). Behaviour: js/header.js

   - Glass bar: see-through white with blur; a soft shadow once the page
     scrolls (.is-scrolled), and a brand-gradient line along the bottom that
     fills up as you read down the page (.header-progress).
   - Menu: larger text. A soft brand pill sits behind the current page and
     glides to whichever item the mouse is on (.nav-indicator, placed by JS;
     without JS the current page simply keeps its pill).
   - Search: soft grey field that turns white with a brand ring when typing;
     the category button is a white chip; gradient search button.
   - Buttons: matching round icon buttons, outline Login with an icon,
     gradient Sign Up with an arrow and a light that passes over it now and
     then; avatar gets a brand ring that turns on hover.
   - Sizes step down for tablets and phones so everything still fits
     (checked from 320px to 1920px, guest and logged in).
   Selectors start with "header.header" and use !important where the theme,
   category-dropdown.css or hover-effects.css already do.
   ========================================================================== */

header.header {
    --hd-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --hd-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --hd-brand: var(--td-primary, #ff5463);
    --hd-brand-rgb: var(--td-primary-rgb, 255, 84, 99);
    --hd-ink: var(--td-heading, #1e1d25);
    --hd-line: rgba(30, 29, 37, 0.1);
    --hd-btn: 42px;
    --hd-grad: linear-gradient(135deg, #ff7686 0%, var(--hd-brand) 45%, #f0436a 100%);
}

/* ---------- 0. Layout (moved from the inline styles in __header) --------- */

header.header,
header.sticky-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
}

header.header .header-full .left,
header.header .search,
header.header form.search {
    position: relative !important;
    z-index: 9999 !important;
}

header.header .header-full .left {
    gap: 20px !important;
}

header.header .header-full .left .logo {
    display: inline-flex;
    align-items: center;
}

header.header .header-full .right .auth-language-cta {
    gap: 8px !important;
}

header.header .header-auth-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ---------- 1. Bar --------------------------------------------------------- */

header.header {
    background-color: rgba(255, 255, 255, 0.86) !important;
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid rgba(30, 29, 37, 0.07) !important;
    transition: box-shadow 0.35s ease, background-color 0.35s ease, border-color 0.35s ease;
}

header.header.is-scrolled {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border-bottom-color: transparent !important;
    box-shadow: 0 14px 34px -20px rgba(30, 29, 37, 0.35), 0 1px 0 rgba(30, 29, 37, 0.05);
}

/* Reading progress along the bottom edge (width set by header.js) */
header.header .header-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, var(--hd-brand), #ff8a3d 55%, #a855f7);
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
    will-change: transform;
}

[dir="rtl"] header.header .header-progress {
    transform-origin: right center;
    background: linear-gradient(270deg, var(--hd-brand), #ff8a3d 55%, #a855f7);
}

/* ---------- 2. Menu -------------------------------------------------------- */

/* Widths step up with the screen: 1200-1365 is the tightest (search, menu
   and Login / Sign Up share one row), so items sit closer there. */
header.header .header-full .middle .navigation-menu {
    position: relative;
    padding: 0 !important;
    margin-inline-start: 14px !important;
    margin-inline-end: 8px !important;
}

header.header .header-full .middle .navigation-menu ul {
    position: relative;
    z-index: 1;
    gap: 0 !important;
}

header.header .header-full .middle .navigation-menu ul li a {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 10px;
    border-radius: 999px;
    color: #5b5a66;
    font-size: 17px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: color 0.25s ease, background-color 0.25s ease;
}

@media (min-width: 1366px) {
    header.header .header-full .middle .navigation-menu {
        margin-inline-start: 18px !important;
        margin-inline-end: 14px !important;
    }

    header.header .header-full .middle .navigation-menu ul {
        gap: 2px !important;
    }

    header.header .header-full .middle .navigation-menu ul li a {
        padding: 0 13px;
    }
}

@media (min-width: 1400px) {
    header.header .header-full .middle .navigation-menu ul li a {
        font-size: 18px !important;
        padding: 0 15px;
    }
}

header.header .header-full .middle .navigation-menu ul li a:hover,
header.header .header-full .middle .navigation-menu ul li a:focus-visible,
header.header .header-full .middle .navigation-menu ul li a.active {
    color: var(--hd-ink);
}

/* The theme's and hover-effects' underline: replaced by the pill below */
header.header .header-full .middle .navigation-menu ul li a::after,
header.header .header-full .middle .navigation-menu ul li a:after {
    content: none !important;
    display: none !important;
}

/* Without JS the current page keeps a static pill */
header.header .header-full .middle .navigation-menu ul li a.active {
    background-color: rgba(var(--hd-brand-rgb), 0.09);
}

header.header .header-full .middle .navigation-menu.has-indicator ul li a.active {
    background-color: transparent;
}

/* The pill that glides between items */
header.header .nav-indicator {
    position: absolute;
    z-index: 0;
    left: 0;
    top: 50%;
    height: 42px;
    margin-top: -21px;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(var(--hd-brand-rgb), 0.12), rgba(255, 138, 61, 0.1));
    box-shadow: inset 0 0 0 1px rgba(var(--hd-brand-rgb), 0.14);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.5s var(--hd-spring),
        width 0.5s var(--hd-spring),
        opacity 0.25s ease;
}

/* Small gradient line under the text inside the pill */
header.header .nav-indicator::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 16px;
    height: 3px;
    margin-left: -8px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--hd-brand), #ea580c);
    transition: width 0.35s var(--hd-ease), margin-left 0.35s var(--hd-ease);
}

header.header .nav-indicator.is-on {
    opacity: 1;
}

header.header .nav-indicator.is-hover::after {
    width: 24px;
    margin-left: -12px;
}

/* Jump into place (first show, resize) but still fade in */
header.header .nav-indicator.no-anim {
    transition: opacity 0.25s ease;
}

/* ---------- 3. Search ------------------------------------------------------ */

header.header .header-full .search:not(.search-modal) {
    height: 48px !important;
    padding: 4px !important;
    border: 1px solid var(--hd-line) !important;
    background: #f5f5f8 !important;
    box-shadow: inset 0 1px 2px rgba(30, 29, 37, 0.04) !important;
    transition: border-color 0.25s ease, box-shadow 0.3s ease, background-color 0.25s ease !important;
}

header.header .header-full .search:not(.search-modal):hover {
    border-color: rgba(30, 29, 37, 0.18) !important;
    background: #f1f1f5 !important;
}

header.header .header-full .search:not(.search-modal):focus-within {
    background: #fff !important;
    border-color: rgba(var(--hd-brand-rgb), 0.6) !important;
    box-shadow:
        0 0 0 4px rgba(var(--hd-brand-rgb), 0.12),
        0 10px 26px -14px rgba(var(--hd-brand-rgb), 0.55) !important;
}

/* Category button: white chip on the grey field */
header.header .header-full .search:not(.search-modal) .search-dropdown {
    height: 38px !important;
    padding: 0 13px !important;
    background: #fff !important;
    border: 1px solid transparent !important;
    box-shadow: 0 1px 2px rgba(30, 29, 37, 0.08), 0 0 0 1px rgba(30, 29, 37, 0.06) !important;
    transition: color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease !important;
}

header.header .header-full .search:not(.search-modal) .search-dropdown:hover,
header.header .header-full .search:not(.search-modal) .search-dropdown.open {
    color: var(--hd-brand) !important;
    background: #fff !important;
    box-shadow: 0 0 0 1px rgba(var(--hd-brand-rgb), 0.4), 0 6px 14px -8px rgba(var(--hd-brand-rgb), 0.55) !important;
}

/* The chip already separates the two parts */
header.header .header-full .search:not(.search-modal) .vertical-bar {
    width: 0 !important;
    margin: 0 4px !important;
    background: transparent !important;
}

header.header .header-full .search:not(.search-modal) input[type="text"] {
    font-size: 14.5px !important;
}

header.header .header-full .search:not(.search-modal) input[type="text"]::placeholder {
    color: rgba(30, 29, 37, 0.45) !important;
    font-size: 14.5px !important;
}

header.header .header-full .search:not(.search-modal) .search-button {
    width: 40px !important;
    height: 40px !important;
    background: var(--hd-grad) !important;
    box-shadow: 0 8px 16px -8px rgba(var(--hd-brand-rgb), 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transition: scale 0.35s var(--hd-spring), box-shadow 0.3s ease !important;
}

header.header .header-full .search:not(.search-modal) .search-button svg {
    transition: rotate 0.35s var(--hd-spring);
}

/* ---------- 4. Round icon buttons (search, language, bell, chat) ---------- */

header.header .header-full .mobile-search-button,
header.header .header-full .custom-language-dropdown .button-trigger,
header.header .header-full .quick-panel-drop .quick-drop-item .action-icon {
    position: relative;
    width: var(--hd-btn) !important;
    height: var(--hd-btn) !important;
    border-radius: 50% !important;
    background: #fff !important;
    border: 1px solid var(--hd-line) !important;
    color: var(--hd-ink) !important;
    box-shadow: 0 1px 2px rgba(30, 29, 37, 0.05) !important;
    transition:
        border-color 0.25s ease,
        background-color 0.25s ease,
        color 0.25s ease,
        box-shadow 0.3s ease,
        translate 0.3s var(--hd-ease) !important;
}

header.header .header-full .custom-language-dropdown .button-trigger {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
}

header.header .header-full .quick-panel-drop .quick-drop-item .action-icon i {
    font-size: 17px;
    line-height: 1;
}

/* Unread dot: ring it in white so it reads on any button */
header.header .header-full .quick-drop-dot {
    box-shadow: 0 0 0 2px #fff;
}

/* Language dropdown */
header.header .custom-language-dropdown .language-dropdown {
    width: 168px;
    padding: 6px;
    border: 1px solid rgba(30, 29, 37, 0.08);
    border-radius: 14px;
    box-shadow: 0 22px 44px -16px rgba(30, 29, 37, 0.3), 0 2px 6px rgba(30, 29, 37, 0.04);
}

header.header .custom-language-dropdown .language-dropdown ul li {
    margin-bottom: 2px;
}

header.header .custom-language-dropdown .language-dropdown ul li a {
    padding: 9px 12px;
    border-radius: 10px;
    font-weight: 600;
}

header.header .custom-language-dropdown .language-dropdown ul li a.active {
    color: var(--hd-brand);
}

/* ---------- 5. Login / Sign Up -------------------------------------------- */

header.header .header-full .header-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: var(--hd-btn);
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(30, 29, 37, 0.14);
    background: #fff;
    color: var(--hd-ink);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition:
        color 0.25s ease,
        border-color 0.25s ease,
        background-color 0.25s ease,
        box-shadow 0.3s ease,
        translate 0.3s var(--hd-ease);
}

header.header .header-full .header-login-btn .header-btn-icon {
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.25s ease, scale 0.35s var(--hd-spring);
}

header.header .header-full .header-signup-btn {
    gap: 8px !important;
    height: var(--hd-btn) !important;
    padding: 0 20px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    background: var(--hd-grad) !important;
    box-shadow: 0 10px 22px -10px rgba(var(--hd-brand-rgb), 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transition: box-shadow 0.3s ease, translate 0.3s var(--hd-ease) !important;
}

header.header .header-full .header-signup-btn .header-btn-arrow {
    flex-shrink: 0;
    transition: translate 0.35s var(--hd-spring) !important;
}

[dir="rtl"] header.header .header-full .header-signup-btn .header-btn-arrow {
    scale: -1 1;
}

/* Light that passes over Sign Up now and then */
header.header .header-full .header-signup-btn::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 35%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: translateX(0) skewX(-20deg);
    pointer-events: none;
    animation: hdShine 6s ease-in-out 2.5s infinite;
}

@keyframes hdShine {
    0% {
        transform: translateX(0) skewX(-20deg);
    }

    22%,
    100% {
        transform: translateX(480%) skewX(-20deg);
    }
}

/* ---------- 6. Avatar ------------------------------------------------------ */

header.header .header-full .user-box .user {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 2px;
    border-radius: 50%;
    isolation: isolate;
}

/* Brand ring around the photo */
header.header .header-full .user-box .user::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 200deg, var(--hd-brand), #ff8a3d, #a855f7, var(--hd-brand));
    transition: rotate 0.8s var(--hd-ease);
}

header.header .header-full .user-box .user img {
    border: 2px solid #fff !important;
    box-shadow: none !important;
}

/* User menu */
header.header .user-box .user-content {
    border: 1px solid rgba(30, 29, 37, 0.08);
    border-radius: 16px;
    box-shadow: 0 26px 50px -18px rgba(30, 29, 37, 0.32), 0 2px 6px rgba(30, 29, 37, 0.04);
}

/* ---------- 7. Menu button (tablets and phones) ---------------------------- */

header.header .bar-button .td-offcanvas-toggle {
    width: var(--hd-btn);
    height: var(--hd-btn);
    gap: 5px;
    align-items: flex-end;
    padding: 0 11px;
    border-radius: 13px;
    background: #fff;
    border: 1px solid var(--hd-line);
    box-shadow: 0 1px 2px rgba(30, 29, 37, 0.05);
    transition: border-color 0.25s ease, box-shadow 0.3s ease;
}

header.header .bar-button .td-offcanvas-toggle span {
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background-color: var(--hd-ink);
    transition: width 0.3s var(--hd-ease), background-color 0.25s ease;
}

header.header .bar-button .td-offcanvas-toggle span:nth-child(2) {
    width: 65%;
}

/* ---------- 8. Hover (real mouse only) -------------------------------------- */

@media (hover: hover) and (pointer: fine) {

    header.header .header-full .search:not(.search-modal) .search-button:hover {
        scale: 1.07;
        box-shadow: 0 12px 22px -8px rgba(var(--hd-brand-rgb), 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    }

    header.header .header-full .search:not(.search-modal) .search-button:hover svg {
        rotate: -12deg;
    }

    header.header .header-full .mobile-search-button:hover,
    header.header .header-full .custom-language-dropdown .button-trigger:hover,
    header.header .header-full .quick-panel-drop .quick-drop-item .action-icon:hover,
    header.header .header-full .quick-panel-drop .quick-drop-item .action-icon[aria-expanded="true"] {
        color: var(--hd-brand) !important;
        background: rgba(var(--hd-brand-rgb), 0.06) !important;
        border-color: rgba(var(--hd-brand-rgb), 0.45) !important;
        box-shadow: 0 8px 18px -10px rgba(var(--hd-brand-rgb), 0.7) !important;
        translate: 0 -1px;
    }

    header.header .header-full .header-login-btn:hover {
        color: var(--hd-brand);
        border-color: rgba(var(--hd-brand-rgb), 0.55);
        background: rgba(var(--hd-brand-rgb), 0.05);
        box-shadow: 0 8px 18px -12px rgba(var(--hd-brand-rgb), 0.7);
        translate: 0 -1px;
    }

    header.header .header-full .header-login-btn:hover .header-btn-icon {
        opacity: 1;
        scale: 1.12;
    }

    header.header .header-full .header-signup-btn:hover {
        translate: 0 -1px;
        box-shadow: 0 14px 26px -10px rgba(var(--hd-brand-rgb), 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    }

    header.header .header-full .header-signup-btn:hover .header-btn-arrow {
        translate: 3px 0;
    }

    [dir="rtl"] header.header .header-full .header-signup-btn:hover .header-btn-arrow {
        translate: -3px 0;
    }

    header.header .header-full .user-box .user:hover::before {
        rotate: 180deg;
    }

    header.header .bar-button .td-offcanvas-toggle:hover {
        border-color: rgba(var(--hd-brand-rgb), 0.45);
        box-shadow: 0 8px 18px -10px rgba(var(--hd-brand-rgb), 0.7);
    }

    header.header .bar-button .td-offcanvas-toggle:hover span {
        background-color: var(--hd-brand);
    }

    header.header .bar-button .td-offcanvas-toggle:hover span:nth-child(2) {
        width: 100%;
    }
}

header.header .header-full .header-login-btn:focus-visible,
header.header .header-full .header-signup-btn:focus-visible,
header.header .header-full .middle .navigation-menu ul li a:focus-visible {
    outline: 2px solid rgba(var(--hd-brand-rgb), 0.7);
    outline-offset: 2px;
}

/* ---------- 9. Smaller screens -------------------------------------------- */

/* Laptops (1200-1365): menu, search and both buttons share the row */
@media (min-width: 1200px) and (max-width: 1365px) {
    header.header .header-full .header-login-btn {
        padding: 0 15px;
    }

    header.header .header-full .header-signup-btn {
        padding: 0 17px !important;
    }

    header.header .header-full .header-login-btn .header-btn-icon,
    header.header .header-full .header-signup-btn .header-btn-arrow {
        display: none;
    }
}

/* Small laptops (992-1199): no menu, the search bar sits next to the
   buttons, so keep a little air between them */
@media (min-width: 992px) and (max-width: 1199px) {
    header.header .header-full .right {
        margin-inline-start: 16px;
    }
}

/* Tablet: the menu is hidden (theme), the search icon replaces the bar */
@media (max-width: 991px) {
    header.header {
        --hd-btn: 40px;
    }
}

@media (max-width: 767px) {
    header.header {
        --hd-btn: 36px;
    }

    header.header .header-full .header-login-btn {
        padding: 0 13px;
        font-size: 14px;
    }

    header.header .header-full .header-signup-btn {
        padding: 0 14px !important;
        font-size: 14px !important;
    }

    header.header .header-full .header-login-btn .header-btn-icon,
    header.header .header-full .header-signup-btn .header-btn-arrow {
        display: none;
    }

    header.header .header-full .user-box .user {
        width: 38px;
        height: 38px;
    }

    header.header .bar-button .td-offcanvas-toggle {
        padding: 0 9px;
        border-radius: 11px;
    }
}

@media (max-width: 400px) {
    header.header {
        --hd-btn: 32px;
    }

    header.header .header-full .right .auth-language-cta,
    header.header .header-auth-group {
        gap: 5px !important;
    }

    header.header .header-full .header-login-btn {
        padding: 0 9px;
        font-size: 13px;
    }

    header.header .header-full .header-signup-btn {
        padding: 0 11px !important;
        font-size: 13px !important;
    }

    header.header .header-full .custom-language-dropdown .button-trigger {
        font-size: 12px !important;
    }

    header.header .header-full .quick-panel-drop .quick-drop-item .action-icon i {
        font-size: 15px;
    }

    header.header .header-full .user-box .user {
        width: 34px;
        height: 34px;
    }

    header.header .bar-button .td-offcanvas-toggle {
        padding: 0 8px;
        border-radius: 10px;
        gap: 4px;
    }
}

/* Very small phones: Login stays available in the side menu; the round
   buttons sit a little closer so all five fit beside the logo */
@media (max-width: 340px) {
    header.header .header-full .header-login-btn {
        display: none;
    }

    header.header .header-full .right {
        gap: 6px !important;
    }
}

/* ---------- 10. Reduce motion ---------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    header.header,
    header.header *,
    header.header *::before,
    header.header *::after {
        transition: none !important;
        animation: none !important;
    }

    header.header .header-full .header-signup-btn::after {
        display: none;
    }
}
