/* ============================================================
   PainHunting — Header
   ============================================================ */

   .ph-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--ph-white);
    border-bottom: 1px solid var(--ph-border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.ph-header .ph-container {
    padding: 0;
    min-width: fit-content;
}

.ph-header__inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 80px;
}

/* ---- Logo ---- */
.ph-header__logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    align-self: center;
    line-height: 0;
}

.ph-header__logo img {
    height: 42px !important;
    width: auto !important;
    display: block;
    object-fit: contain;
    margin-top: -4px;
}

/* ---- Nav ---- */
.ph-nav {
    flex: 1;
    display: flex;
    align-items: center;
    align-self: center;
    margin-top: 5px;
}

.ph-nav__list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ph-nav__item {
    position: relative;
}

.ph-nav__link {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ph-black);
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.1px;
    transition: color var(--ph-transition), background var(--ph-transition);
}

.ph-nav__link:hover {
    color: var(--ph-green);
    background: var(--ph-green-bg);
}

.ph-nav__item.current-menu-item > .ph-nav__link,
.ph-nav__item.current-page-ancestor > .ph-nav__link {
    color: var(--ph-green);
    background: transparent;
    font-weight: 600;
}

/* Dropdown chevron — inline SVG set via walker, styled here */
.ph-nav__arrow {
    display: inline-flex;
    align-items: center;
    opacity: 0.75;
    line-height: 1;
    font-size: 10px;
    margin-top: 1px;
}


.ph-flag-emoji {
    font-size: 16px;
    line-height: 1;
}

/* ---- Dropdown ---- */
.ph-nav__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    padding: 6px;
    padding-top: 14px; /* visual gap built into the dropdown itself */
    list-style: none;
    z-index: 200;
    /* shift down visually while keeping hover zone connected */
    margin-top: 0;
}

/* Invisible bridge — fills the space between link and dropdown panel */
.ph-nav__item--dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 14px;
    z-index: 199;
}

/* Desktop only — on mobile, .ph-open class controls visibility via JS */
@media (min-width: 1025px) {
    .ph-nav__item--dropdown:hover .ph-nav__dropdown,
    .ph-nav__item--dropdown:focus-within .ph-nav__dropdown {
        display: block;
    }
    .ph-nav__link > span.ph-nav__arrow {
        display: none;
    }
    .ph-nav__link.ph-nav__link--has-dropdown > span.ph-nav__arrow {
        display: block;
    }

}

.ph-nav__dropdown li a {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: var(--ph-black);
    padding: 9px 14px;
    border-radius: 6px;
    text-decoration: none;
    transition: background var(--ph-transition), color var(--ph-transition);
}

.ph-nav__dropdown li a:hover {
    background: var(--ph-green-bg);
    color: var(--ph-green);
}

/* ---- Header Actions ---- */
.ph-header__actions {
    display: flex;
    align-items: center;
    align-self: center;
    gap: 20px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Currency / Language meta buttons */
.ph-header__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 5px;
    z-index: 9999;
}

/* Logged-in: avatar + first name + View Dashboard (beats global `a { color: green }`) */
a.ph-header__account {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ph-black);
    border-radius: 10px;
    padding: 10px;
    margin: 0 auto;
    margin-top: 5px;
    transition: background var(--ph-transition);
    box-sizing: border-box;
}

a.ph-header__account:hover,
a.ph-header__account:focus,
a.ph-header__account:focus-visible,
a.ph-header__account:visited {
    color: var(--ph-black);
    text-decoration: none;
}


a.ph-header__account:focus-visible {
    outline: 2px solid var(--ph-green);
    outline-offset: 2px;
}

.ph-header__account-avatar {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--ph-black);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

/* Initial always visible underneath; photo fades in only after successful load */
.ph-header__account-initial {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: var(--ph-fw-semi);
    color: var(--ph-white);
    background: var(--ph-black);
    line-height: 1;
    border-radius: 50%;
}

/* Override global `img { max-width:100%; height:auto }` so avatar stays circular */
img.ph-header__account-img {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

img.ph-header__account-img.is-loaded:not(.is-broken) {
    opacity: 1;
}

img.ph-header__account-img.is-broken {
    display: none;
}

.ph-header__account-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

a.ph-header__account .ph-header__account-name {
    font-size: 15px;
    font-weight: var(--ph-fw-bold);
    color: var(--ph-black);
    line-height: 1.25;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}


a.ph-header__account .ph-header__account-sub {
    font-size: 13px;
    font-weight: var(--ph-fw-regular);
    color: var(--ph-black);
    line-height: 1.2;
}

a.ph-header__account:hover .ph-header__account-sub {
    text-decoration: underline;
}

.ph-header__account--mobile {
    width: 100%;
    max-width: none;
    margin-top: 0;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--ph-border);
    background: var(--ph-white);
}

.ph-header__account--mobile:hover {
    background: var(--ph-green-bg);
}

/* Base style — no border, no background, just text + icon */
.ph-meta-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 500;
    color: var(--ph-black);
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    cursor: pointer;
    transition: color var(--ph-transition);
    white-space: nowrap;
    line-height: 1;
}

.ph-meta-btn:hover {
    color: var(--ph-green);
}

.ph-meta-btn--flag {
    padding: 0;
}

.ph-meta-btn--flag img {
    display: block;
    border-radius: 2px;
}

/* Hide WCML/WPML loading spinners and animations */
.wcml-spinner,
.wpml-ls-spinner,
img.wcml-spinner,
.wcml_currency_switcher img.wcml-spinner {
    display: none !important;
}

/* Hide any WCML/WBW default rendered widgets — we use our custom switcher */
#wcuCurrencySwitcherFloating,
#wcuCurrencySwitcherSimpleClassic,
.wcuCurrencySwitcherSimpleDropdown,
.wcuCurrencySwitcher,
.wcml_currency_switcher form,
.wcml_currency_switcher select {
    display: none !important;
}

/* Hide WPML's default footer language bar — we use our custom switcher instead */
.wpml-ls-statics-footer,
.wpml-ls-legacy-list-horizontal,
#lang_sel_footer,
#lang_sel,
.widget_icl_lang_sel_widget {
    display: none !important;
}

/* ---- Currency & Language Switchers ---- */

/* <details> is our dropdown container */
.ph-switcher {
    position: relative;
    display: inline-flex;
}

/* <summary> acts as the trigger button — reset browser defaults */
.ph-switcher__summary {
    list-style: none;
    cursor: pointer;
}
.ph-switcher__summary::-webkit-details-marker { display: none; }
summary.ph-switcher__summary { display: flex; }

/* Arrow rotates when open */
.ph-switcher__arrow {
    flex-shrink: 0;
    transition: transform var(--ph-transition);
}
.ph-switcher[open] .ph-switcher__arrow {
    transform: rotate(180deg);
}

/* Dropdown panel */
.ph-switcher__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: -8px;
    min-width: auto;
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    padding: 4px;
    list-style: none;
    z-index: 300;
    margin: 0;
}

.ph-switcher--lang .ph-switcher__dropdown {
    min-width: 118px;
    left: -45px;
    top: 22px;
	overflow: hidden;
}

/* Each option row */
.ph-switcher__option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--ph-black);
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: background var(--ph-transition), color var(--ph-transition);
    white-space: nowrap;
}

.ph-switcher__option:hover {
    background: var(--ph-green-bg);
    color: var(--ph-green);
}

.ph-switcher__option.is-active {
    color: var(--ph-green);
    font-weight: 600;
}

/* Currency: code bold, label muted */
.ph-switcher__code {
    font-weight: 600;
}

.ph-switcher__label {
    color: var(--ph-gray);
    font-size: 12px;
}

.ph-switcher__option:hover .ph-switcher__label {
    color: var(--ph-green);
}

/* Flag images */
.ph-switcher__option img,
.ph-meta-btn--flag img {
    display: block;
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ---- Mobile Toggle ---- */
.ph-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    flex-shrink: 0;
    position: relative;
    top: 2px;
}

.ph-nav-toggle__bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ph-black);
    border-radius: 2px;
    transition: all var(--ph-transition);
}

/* Animate bars when open */
.ph-header--open .ph-nav-toggle .ph-nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.ph-header--open .ph-nav-toggle .ph-nav-toggle__bar:nth-child(2) {
    opacity: 0;
}
.ph-header--open .ph-nav-toggle .ph-nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   Mobile nav — right-side drawer
   ============================================================ */


/* Mobile-only elements: hidden on desktop */
.ph-nav__mobile-bottom {
    display: none;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {

    /* Tighten the header row gap on mobile so nothing overflows */
    .ph-header__inner {
        gap: 12px;
        height: 72px;
    }

    .ph-header .ph-container {
        padding: 0 var(--ph-space-md);
    }

    /* Show hamburger — remove margin-left:auto, actions already push right */
    .ph-nav-toggle {
        display: flex;
        margin-left: 0;
    }

    /* Keep actions visible on mobile but hide the login button */
    .ph-header__actions {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
    }
    /* Must beat `a.ph-header__account { display: flex }` (higher specificity than `.ph-header__account--desktop` alone) */
    a.ph-header__login,
    a.ph-header__account.ph-header__account--desktop {
        display: none;
    }

    /* Right-side slide drawer — starts below the sticky header */
    .ph-nav {
        position: fixed;
        top: 73px;           /* header height */
        right: 0;
        bottom: 0;
        width: min(320px, 88vw);
        background: var(--ph-gray-bg);
        box-shadow: -4px 0 32px rgba(0, 0, 0, 0.12);
        z-index: 1099;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(100%);
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        margin: 0;
        flex: unset;
        align-items: unset;
        align-self: unset;
    }

    /* Admin bar offset on mobile (46px) */
    body.admin-bar .ph-nav {
        top: calc(68px + 46px);
        width: 100%;
        padding-top: 20px;
    }

    /* Open state */
    .ph-header--open .ph-nav {
        transform: translateX(0);
    }

    /* Nav list: vertical stack with separator lines */
    .ph-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0 8px;
        flex: unset;
        order: 2;
    }

    /* Each item separated by a light line */
    .ph-nav__item {
        border-radius: 0;
        border-bottom: 1px solid var(--ph-border);
    }
    .ph-nav__item:first-child {
        border-top: none;
    }

    /* Base link style */
    .ph-nav__link {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 500;
        border-radius: 0;
        justify-content: space-between;
        color: var(--ph-black);
        transition: background var(--ph-transition), color var(--ph-transition);
    }

    .ph-nav__link:hover {
        background: var(--ph-green-bg);
        color: var(--ph-green);
    }

    /* Active item */
    .ph-nav__item.current-menu-item > .ph-nav__link,
    .ph-nav__item.current-page-ancestor > .ph-nav__link {
        color: var(--ph-green);
        font-weight: 600;
    }

    /* All arrows default to pointing RIGHT (rotated -90deg from the down chevron SVG) */
    .ph-nav__arrow {
        transform: rotate(-90deg);
        transition: transform 0.22s ease;
        opacity: 0.4;
        flex-shrink: 0;
    }

    /* Dropdown parent open: arrow rotates to DOWN */
    .ph-nav__item--dropdown.ph-open > .ph-nav__link .ph-nav__arrow {
        transform: rotate(0deg);
        opacity: 0.8;
    }
    .ph-nav__item--dropdown.ph-open > .ph-nav__link {
        color: var(--ph-green);
    }

    /* Override the hover bridge pseudo-element on mobile */
    .ph-nav__item--dropdown::after {
        display: none;
    }

    /* Mobile submenu */
    .ph-nav__dropdown {
        display: none;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
        min-width: unset;
        background: #f8f9f8;
    }

    .ph-nav__item--dropdown.ph-open .ph-nav__dropdown {
        display: block;
    }

    .ph-nav__dropdown li {
        list-style: none;
        border-bottom: 1px solid var(--ph-border);
    }
    .ph-nav__dropdown li:last-child {
        border-bottom: none;
    }

    /* Submenu links — indented, same right-arrow via ph-nav__arrow in walker */
    .ph-nav__dropdown li a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 13px 20px 13px 32px;
        font-size: 14px;
        font-weight: 400;
        color: var(--ph-gray);
        text-decoration: none;
        transition: color var(--ph-transition), background var(--ph-transition);
    }
    .ph-nav__dropdown li a:hover {
        color: var(--ph-green);
        background: var(--ph-green-bg);
    }
    /* No bullet — arrow from walker handles the indicator */
    .ph-nav__dropdown li a::before {
        display: none;
    }

    /* Login button — no border, just natural spacing after the nav */
    .ph-nav__mobile-bottom {
        display: flex;
        flex-direction: column;
        padding: 14px;
        margin-top: 0;
        border-top: none;
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
        min-width: 100%;
    }
    .ph-nav__mobile-bottom>a.ph-btn {
        margin-top: 10px;
    }
    .ph-nav__mobile-bottom>a.ph-header__account.ph-header__account--mobile{
        margin-top: 0;
    }
    /* Full-width button helper */
    .ph-btn--full {
        width: 100%;
        justify-content: center;
    }

    /* Lock body scroll when drawer is open */
    body.ph-nav-open {
        overflow: hidden;
    }
}
