/* ==========================================================================
   Phase 2: Public Pages Header - Sticky Glassmorphism Design
   ========================================================================== */

/* ==========================================================================
   CSS Variables (imported from variables.css)
   ========================================================================== */
/*
   --primary-color: #e63c4e;
   --primary-rgb: 230, 60, 78;
   --text-color: #333333;
   --bg-color: #ffffff;
   --border-color: #dee2e6;
   --transition-fast: 0.15s ease;
   --transition-normal: 0.3s ease;
   --transition-slow: 0.5s ease;
   --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
   --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
   --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
*/

/* ==========================================================================
   Header Base Styles
   ========================================================================== */

.header-modern {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--bg-color);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.15);
    box-shadow: 0 1px 3px rgba(92, 52, 108, 0.06);
    transition: all var(--transition-normal);
}

body:not(.session-page) .header-modern.header-scrolled {
    background: var(--brand-purple);
    border-bottom: none;
    box-shadow: var(--shadow-lg);
}

.header-modern .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    height: 70px;
}

/* ==========================================================================
   Logo
   ========================================================================== */

.header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    z-index: 1051;
}

.header-logo-img {
    height: 40px;
    width: auto;
    transition: transform var(--transition-fast);
}

.header-logo-img:hover {
    transform: scale(1.05);
}

.header-logo-text {
    font-family: 'Lobster', cursive;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-left: 0.5rem;
    letter-spacing: 0.5px;
}

body:not(.session-page) .header-modern.header-scrolled .header-logo-text {
    color: #ffffff;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.header-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1 1 auto;
    min-width: 0;
}

.header-nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0 auto;
    padding: 0;
    gap: 0.25rem;
}

.header-nav-item {
    position: relative;
}

.header-nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    position: relative;
}

.header-nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--brand-gold);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.header-nav-link:hover::after,
.header-nav-link.active::after {
    width: 80%;
}

body:not(.session-page) .header-modern.header-scrolled .header-nav-link {
    color: #ffffff;
}

body:not(.session-page) .header-modern.header-scrolled .header-nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Search Form
   ========================================================================== */

/* ==========================================================================
   User State / Auth Buttons
   ========================================================================== */

.header-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.header-auth-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

.header-auth-link--outline {
    color: var(--gold-dark);
    border: 1px solid var(--gold-dark);
    background: transparent;
}

.header-auth-link--outline:hover {
    background: var(--gold-dark);
    color: #ffffff;
}

.header-auth-link--filled {
    color: var(--gold-ink);
    background: var(--brand-gold);
    border: 1px solid var(--brand-gold);
}

.header-auth-link--filled:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

body:not(.session-page) .header-modern.header-scrolled .header-auth-link--outline {
    color: #ffffff;
    border-color: #ffffff;
}

body:not(.session-page) .header-modern.header-scrolled .header-auth-link--outline:hover {
    background: #ffffff;
    color: var(--primary-color);
}

/* ==========================================================================
   User Dropdown (When Logged In)
   ========================================================================== */

.header-user-menu {
    position: relative;
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--brand-purple);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-user-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--brand-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Lobster', cursive;
}

.header-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.header-user-menu:hover .header-user-dropdown,
.header-user-menu:focus-within .header-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-user-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.header-user-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header-user-dropdown-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.header-user-dropdown-email {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.125rem;
}

.header-user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.header-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.header-user-dropdown-item:hover {
    background: var(--bg-gray);
    color: var(--primary-dark);
}

.header-user-dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
}

.header-user-dropdown-item--logout {
    color: #dc3545;
}

.header-user-dropdown-item--logout:hover {
    background: #fff5f5;
    color: #dc3545;
}

/* ==========================================================================
   Mobile Menu Toggle
   ========================================================================== */

.header-mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1051;
}

.header-mobile-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: all var(--transition-normal);
}

body:not(.session-page) .header-modern.header-scrolled .header-mobile-toggle span {
    background: #ffffff;
}

.header-mobile-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.header-mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.header-mobile-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */

@media (max-width: 991.98px) {
    .header-nav-list {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-color);
        padding: 1.5rem;
        gap: 0.5rem;
        box-shadow: var(--shadow-lg);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
        border-bottom: 1px solid var(--border-color);
    }

    .header-nav-list.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .header-nav-link {
        padding: 1rem;
        width: 100%;
        justify-content: center;
        font-size: 1.1rem;
    }

    .header-nav-link::after {
        display: none;
    }

    .header-mobile-toggle {
        display: flex;
        margin-left: auto;
    }

    .header-auth {
        flex-direction: column;
        width: 100%;
        margin: 1rem 0 0;
        gap: 0.5rem;
    }

    .header-auth-link {
        width: 100%;
        justify-content: center;
    }

    .header-user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--bg-gray);
        margin-top: 0.5rem;
        border-radius: var(--border-radius);
    }

    .header-user-dropdown::before {
        display: none;
    }

    /* The wrapper is the off-canvas panel, so the search field and the
       auth links drop into it together with the nav list. */
    .header-nav-wrapper {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        padding: 1.5rem;
        gap: 1rem;
        background: var(--bg-color);
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        transition: all var(--transition-normal);
        z-index: calc(var(--z-header) - 1);
    }

    .header-nav-wrapper.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Reset the nav list: it is no longer the panel itself. */
    .header-nav-wrapper .header-nav-list {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        width: 100%;
        padding: 0;
        background: none;
        box-shadow: none;
        border-bottom: 0;
        align-items: stretch;
    }

}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .header-modern,
    .header-nav-link::after,
    .header-auth-link,
    .header-user-btn,
    .header-mobile-toggle span,
    .header-user-dropdown {
        transition: none;
        animation: none;
    }
}

/* ==========================================================================
   SESSION CHROME - shared by every page that includes
   partials/session-header.php (all post-login pages).

   This is the reference header: a 100px sticky white brand bar with the
   wordmark over a subtitle, a separated help line, the icon nav, a visible
   Logout button and the user dropdown.

   Scope is .session-page (the body class that partial stamps), NOT
   .session-page--dashboard, so the public header keeps the rules further up
   this file. Only the tokens the chrome needs are declared here; the page
   bodies keep their own tokens in their own stylesheet.
   ========================================================================== */

.session-page {
    --lb-maroon: #99002f;
    --lb-maroon-dark: #760022;
    --lb-ink: #18151a;
    --lb-line: #eee8eb;
    --lb-soft: #fff8f3;
    --lb-margin: 30px;
    --lb-card-shadow: 0 12px 28px rgba(50, 27, 36, .08);
}

/* --------------------------------------------------------------------------
   Session chrome base
   -------------------------------------------------------------------------- */
.session-page .header-modern {
    align-items: center;
    background: #fff;
    box-shadow: 0 8px 22px rgba(35, 19, 25, .08);
    display: flex;
    gap: 28px;
    min-height: 100px;
    padding: 12px var(--lb-margin);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* header.css gives this inner container a fixed height: 70px and its own
   padding; both are reset here so the 100px bar and the 70px brand block
   are not clipped. */
.session-page .header-modern > .container {
    align-items: center;
    display: flex;
    height: auto;
    justify-content: space-between;
    margin: 0 auto;
    max-width: none;
    padding: 0;
    width: 100%;
}

.session-page .header-nav {
    align-items: center;
    display: flex;
    gap: 28px;
    width: 100%;
}

/* Brand block */
.session-page .header-logo {
    align-items: center;
    color: var(--lb-maroon);
    display: flex;
    gap: 14px;
    min-width: 260px;
    text-decoration: none;
}

.session-page .header-logo-img {
    height: 70px;
    object-fit: contain;
    width: 70px;
}

.session-page .header-logo-text {
    display: block;
    line-height: 1;
}

.session-page .header-logo-text strong {
    color: var(--lb-maroon);
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 32px;
    letter-spacing: 0;
    line-height: 1;
}

.session-page .header-logo-meta {
    border-left: 0;
    display: block;
    margin: 0;
    padding: 0;
}

.session-page .header-logo-subtitle {
    color: #2c2529;
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 3px;
    margin-top: 5px;
    text-transform: uppercase;
}

/* Help line: a hairline separates it from the brand. */
.session-page .header-help {
    align-items: center;
    border-left: 1px solid var(--lb-line);
    display: flex;
    gap: 12px;
    min-width: 220px;
    padding-left: 26px;
}

.session-page .header-help > i {
    color: var(--lb-maroon);
    font-size: 24px;
}

.session-page .header-help small {
    color: var(--lb-ink);
    display: block;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
}

.session-page .header-logo-phone {
    color: var(--lb-maroon);
    display: block;
    font-size: 17px;
    font-weight: 900;
    line-height: 1.3;
    text-decoration: none;
}

.session-page .header-logo-phone:hover {
    color: var(--lb-maroon-dark);
}

/* Centre navigation: icon over label. */
.session-page .header-nav-wrapper {
    flex: 1;
}

.session-page .header-nav-list {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.session-page .header-nav-link {
    align-items: center;
    color: #111;
    display: grid;
    font-size: 16px;
    font-weight: 800;
    gap: 6px;
    justify-items: center;
    min-width: 108px;
    padding: 8px 6px;
    text-decoration: none;
}

.session-page .header-nav-link i,
.session-page .header-nav-link .fa {
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
}

.session-page .header-nav-link:hover,
.session-page .header-nav-link.active {
    color: var(--lb-maroon);
}

/* No underline bar: the current page is marked with colour only. */
.session-page .header-nav-link::after {
    display: none;
}

.session-page .header-auth {
    align-items: center;
    display: flex;
    gap: 18px;
}

.session-page .header-user-btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--lb-line);
    color: var(--lb-ink);
    display: inline-flex;
    font-size: 14px;
    font-weight: 800;
    gap: 8px;
    padding: 8px 14px;
}

.session-page .header-user-btn:hover {
    border-color: var(--lb-maroon);
    color: var(--lb-maroon);
}

.session-page .header-user-avatar {
    background: var(--lb-soft);
    color: var(--lb-maroon);
    font-size: 13px;
    font-weight: 900;
}

.session-page .header-user-dropdown {
    border-color: var(--lb-line);
    box-shadow: var(--lb-card-shadow);
}

.session-page .header-user-dropdown-item {
    color: var(--lb-ink);
    font-size: 14px;
    font-weight: 700;
    padding: 10px 16px;
}

.session-page .header-user-dropdown-item:hover {
    background: var(--lb-soft);
    color: var(--lb-maroon);
}

/* Logout button - 135 x 54 */
.session-page .header-logout-btn {
    align-items: center;
    background: var(--lb-maroon);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-size: 16px;
    font-weight: 800;
    gap: 10px;
    height: 54px;
    justify-content: center;
    min-width: 135px;
    padding: 0 22px;
    text-decoration: none;
    white-space: nowrap;
}

.session-page .header-logout-btn i {
    font-size: 18px;
}

.session-page .header-logout-btn:hover,
.session-page .header-logout-btn:focus {
    background: var(--lb-maroon-dark);
    color: #fff;
}

.session-page .header-mobile-toggle {
    display: none;
}

/* --------------------------------------------------------------------------
   Session chrome - responsive
   Same breakpoints as the base session block above, so the bar keeps the same
   proportions on every session page instead of only on the dashboard.
   -------------------------------------------------------------------------- */

@media (max-width: 1699px) {
    .session-page .header-modern {
        gap: 20px;
    }

    .session-page .header-logo {
        min-width: 0;
    }

    .session-page .header-help {
        min-width: 0;
        padding-left: 20px;
    }

    .session-page .header-nav-list {
        gap: 6px;
    }

    .session-page .header-nav-link {
        min-width: 88px;
    }
}

@media (max-width: 1439px) {
    .session-page .header-nav-link {
        font-size: 15px;
        min-width: 74px;
    }

    .session-page .header-nav-link i,
    .session-page .header-nav-link .fa {
        font-size: 23px;
    }

    /* The help line pushes the row past the viewport on 1280-1366 laptops. */
    .session-page .header-help {
        display: none;
    }
}

@media (max-width: 1100px) {
    .session-page .header-help {
        border-left: 0;
        padding-left: 0;
    }
}

/* --------------------------------------------------------------------------
   Session chrome - early off-canvas
   The desktop row (brand + six icon links + Logout + user block) needs roughly
   1380px. Hiding the help line at 1439px covers the common 1280-1366 laptops;
   below 1150px even that is not enough, so the session header switches to the
   same off-canvas panel the base header opens at 991.98px. The panel and its
   contents are re-declared under .session-page because the base rules only
   start applying at 991.98px.
   -------------------------------------------------------------------------- */
@media (max-width: 1150px) {
    .session-page .header-nav-wrapper {
        position: fixed;
        top: 100px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        margin-left: 0;
        padding: 1.5rem;
        gap: 1rem;
        background: #fff;
        box-shadow: var(--shadow-lg);
        border-bottom: 1px solid var(--lb-line);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        transition: all var(--transition-normal);
        z-index: calc(var(--z-header) - 1);
    }

    .session-page .header-nav-wrapper.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    /* Reset the nav list: it is no longer the panel itself. */
    .session-page .header-nav-wrapper .header-nav-list {
        position: static;
        flex-direction: column;
        justify-content: flex-start;
        transform: none;
        opacity: 1;
        visibility: visible;
        width: 100%;
        padding: 0;
        gap: 0.5rem;
        background: none;
        box-shadow: none;
        border-bottom: 0;
        align-items: stretch;
    }

    .session-page .header-nav-link {
        justify-items: center;
        min-width: 0;
        padding: 0.75rem;
        width: 100%;
    }

    .session-page .header-auth {
        flex-direction: column;
        width: 100%;
        margin: 0;
        gap: 0.75rem;
    }

    .session-page .header-logout-btn {
        justify-content: center;
        width: 100%;
    }

    .session-page .header-user-menu,
    .session-page .header-user-btn {
        width: 100%;
    }

    .session-page .header-user-btn {
        justify-content: center;
    }

    .session-page .header-user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--lb-soft);
        margin-top: 0.5rem;
        border-radius: var(--border-radius);
        width: 100%;
    }

    .session-page .header-user-dropdown::before {
        display: none;
    }

    .session-page .header-mobile-toggle {
        display: inline-flex;
        margin-left: auto;
    }
}

@media (max-width: 991px) {
    .session-page .header-modern {
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
        min-height: 76px;
        padding: 10px 16px;
    }

    /* Compact brand mark so the bar stays a predictable 76px tall; the base
       header anchors its off-canvas panel at 70px, so the two must agree. */
    .session-page .header-logo-img {
        height: 46px;
        width: 46px;
    }

    .session-page .header-logo-text strong {
        font-size: 26px;
    }

    /* Brand + toggle is all that fits a phone row; the phone number lives in
       the footer and on the contact page. */
    .session-page .header-help {
        display: none;
    }

    /* The base header turns .header-nav-wrapper (not .header-nav-list) into the
       off-canvas panel and anchors it at 70px; move it under the taller session
       bar and keep it scrollable. */
    .session-page .header-nav-wrapper {
        top: 76px;
        max-height: calc(100vh - 76px);
    }

    .session-page .header-mobile-toggle {
        display: inline-flex;
        margin-left: auto;
    }
}

@media (max-width: 575px) {
    .session-page .header-logo-img {
        height: 46px;
        width: 46px;
    }

    .session-page .header-logo-text strong {
        font-size: 22px;
    }

    .session-page .header-logo-subtitle {
        font-size: 10px;
        letter-spacing: 2px;
    }

    .session-page .header-help small {
        font-size: 12px;
    }

    .session-page .header-logo-phone {
        font-size: 14px;
    }

    .session-page .header-logout-btn {
        font-size: 14px;
        height: 46px;
        min-width: 0;
        padding: 0 14px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .header-modern {
        position: static;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
    }
    
    body:not(.session-page) .header-modern.header-scrolled {
        background: var(--bg-color);
    }
}