/* =============================================================================
   LHC SITE HEADER
   Plugin:  livestock-homepage-clone
   Version: 1.0.0
   Scope:   .lhc-header — all rules scoped to avoid theme conflicts
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Default CSS custom properties (overridden by inline style on the element)
   --------------------------------------------------------------------------- */
.lhc-header {
    --lhc-hdr-bg:         #ffffff;
    --lhc-hdr-border:     #0d2344;
    --lhc-hdr-logo-name:  #0d2344;
    --lhc-hdr-logo-sub:   #e88020;
    --lhc-hdr-nav:        #121212;
    --lhc-hdr-active:     #e88020;
    --lhc-hdr-height:     72px;
    --lhc-hdr-max-width:  1200px;
    --lhc-hdr-px:         20px;
    --lhc-hdr-ease:       cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --lhc-hdr-trans:      0.2s var(--lhc-hdr-ease);
}

/* ---------------------------------------------------------------------------
   Scoped reset
   --------------------------------------------------------------------------- */
.lhc-header *,
.lhc-header *::before,
.lhc-header *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.lhc-header ul { list-style: none; }
.lhc-header a  { text-decoration: none; color: inherit; }
.lhc-header button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* ---------------------------------------------------------------------------
   Container
   --------------------------------------------------------------------------- */
.lhc-hdr-container {
    width: 100%;
    max-width: var(--lhc-hdr-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--lhc-hdr-px);
    padding-right: var(--lhc-hdr-px);
}

/* ---------------------------------------------------------------------------
   Header root
   --------------------------------------------------------------------------- */
.lhc-header {
    background: var(--lhc-hdr-bg);
    border-bottom: 2.5px solid var(--lhc-hdr-border);
    position: relative;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.lhc-header--sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Inner flex row */
.lhc-header__inner {
    display: flex;
    align-items: center;
    height: var(--lhc-hdr-height);
    gap: 16px;
}

/* ---------------------------------------------------------------------------
   Logo
   --------------------------------------------------------------------------- */
.lhc-header__logo {
    flex-shrink: 0;
}

.lhc-header__logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    outline-offset: 4px;
}

.lhc-header__logo-icon {
    color: var(--lhc-hdr-logo-name);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 1;
}

.lhc-header__logo-img {
    height: 44px;
    width: auto;
    display: block;
    max-width: 180px;
    object-fit: contain;
}

.lhc-header__logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.lhc-header__logo-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--lhc-hdr-logo-name);
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}

.lhc-header__logo-sub {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--lhc-hdr-logo-sub);
    line-height: 1;
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Navigation
   --------------------------------------------------------------------------- */
.lhc-header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100%;
}

/* Panel wrappers are layout-transparent on desktop; mobile overrides below */
.lhc-header__nav-panels { display: contents; }
.lhc-header__nav-panel  { display: contents; }
.lhc-header__cats-panel { display: none; }

.lhc-header__nav-list {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 100%;
}

.lhc-header__nav-item {
    display: flex;
    align-items: stretch;
    position: relative;
}

.lhc-header__nav-link {
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--lhc-hdr-nav);
    letter-spacing: 0.01em;
    position: relative;
    transition: color var(--lhc-hdr-trans);
    white-space: nowrap;
    text-decoration: none;
}

/* Active / hover underline bar at bottom */
.lhc-header__nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2.5px;
    background: var(--lhc-hdr-active);
    transition: width var(--lhc-hdr-trans);
}

.lhc-header__nav-link:hover {
    color: var(--lhc-hdr-active);
}

.lhc-header__nav-link:hover::after {
    width: calc(100% - 20px);
}

.lhc-header__nav-link--active {
    color: var(--lhc-hdr-active);
    font-weight: 600;
}

.lhc-header__nav-link--active::after {
    width: calc(100% - 20px);
}

/* ---------------------------------------------------------------------------
   Categories dropdown
   --------------------------------------------------------------------------- */
.lhc-header__dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 100%;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--lhc-hdr-nav);
    letter-spacing: 0.01em;
    position: relative;
    transition: color var(--lhc-hdr-trans);
    white-space: nowrap;
    cursor: pointer;
}

.lhc-header__dropdown-toggle::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2.5px;
    background: var(--lhc-hdr-active);
    transition: width var(--lhc-hdr-trans);
}

.lhc-header__nav-item--has-dropdown:hover .lhc-header__dropdown-toggle,
.lhc-header__dropdown-toggle[aria-expanded="true"] {
    color: var(--lhc-hdr-active);
}

.lhc-header__nav-item--has-dropdown:hover .lhc-header__dropdown-toggle::after,
.lhc-header__dropdown-toggle[aria-expanded="true"]::after {
    width: calc(100% - 20px);
}

.lhc-header__dropdown-chevron {
    flex-shrink: 0;
    transition: transform var(--lhc-hdr-trans);
    margin-top: 1px;
}

.lhc-header__dropdown-toggle[aria-expanded="true"] .lhc-header__dropdown-chevron {
    transform: rotate(180deg);
}

.lhc-header__dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--lhc-hdr-bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top: 2.5px solid var(--lhc-hdr-active);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--lhc-hdr-trans), visibility var(--lhc-hdr-trans), transform var(--lhc-hdr-trans);
}

.lhc-header__nav-item--has-dropdown:hover .lhc-header__dropdown-menu,
.lhc-header__dropdown-menu--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lhc-header__dropdown-item {
    display: block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 400;
    color: var(--lhc-hdr-nav);
    transition: color var(--lhc-hdr-trans), background var(--lhc-hdr-trans);
    white-space: nowrap;
    text-decoration: none;
}

.lhc-header__dropdown-item:hover {
    color: var(--lhc-hdr-active);
    background: rgba(0, 0, 0, 0.04);
}

/* ---------------------------------------------------------------------------
   Action buttons (search, cart)
   --------------------------------------------------------------------------- */
.lhc-header__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.lhc-header__action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--lhc-hdr-nav);
    border-radius: 50%;
    transition: background var(--lhc-hdr-trans), color var(--lhc-hdr-trans);
    text-decoration: none;
    position: relative;
    cursor: pointer;
}

.lhc-header__action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--lhc-hdr-logo-name);
}

/* Cart item count badge */
.lhc-header__cart-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--lhc-hdr-active);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    pointer-events: none;
    border: 1.5px solid var(--lhc-hdr-bg);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Hamburger — shown only on mobile
   --------------------------------------------------------------------------- */
.lhc-header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 4px;
    transition: background var(--lhc-hdr-trans);
}

.lhc-header__hamburger:hover {
    background: rgba(0, 0, 0, 0.06);
}

.lhc-header__hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--lhc-hdr-nav);
    border-radius: 2px;
    transition: transform 0.28s var(--lhc-hdr-ease), opacity 0.28s var(--lhc-hdr-ease);
    pointer-events: none;
}

.lhc-header__hamburger[aria-expanded="true"] .lhc-header__hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.lhc-header__hamburger[aria-expanded="true"] .lhc-header__hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.lhc-header__hamburger[aria-expanded="true"] .lhc-header__hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------------------------------------------------------------------------
   Mobile nav close button — hidden on desktop, shown inside drawer on mobile
   --------------------------------------------------------------------------- */
.lhc-header__nav-close {
    display: none;
}

/* ---------------------------------------------------------------------------
   Search overlay (slides in below header)
   --------------------------------------------------------------------------- */
.lhc-header__search-overlay {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.32s var(--lhc-hdr-ease);
    background: var(--lhc-hdr-bg);
}

.lhc-header__search-overlay--open {
    max-height: 72px;
}

.lhc-header__search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 60px;
}

.lhc-header__search-input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: #121212;
    background: transparent;
    min-width: 0;
    -webkit-appearance: none;
}

.lhc-header__search-input::placeholder {
    color: #aaaaaa;
}

.lhc-header__search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #888;
    border-radius: 4px;
    transition: color var(--lhc-hdr-trans), background var(--lhc-hdr-trans);
    flex-shrink: 0;
}

.lhc-header__search-close:hover {
    color: #121212;
    background: rgba(0, 0, 0, 0.06);
}

/* ---------------------------------------------------------------------------
   Responsive — Tablet (≤ 900px): tighter nav spacing
   --------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .lhc-header__nav-link {
        padding: 0 12px;
        font-size: 13.5px;
    }
}

/* ---------------------------------------------------------------------------
   Responsive — Mobile (≤ 768px): drawer nav
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .lhc-header__hamburger {
        display: flex;
    }

    /* Nav becomes a slide-in drawer */
    .lhc-header__nav {
        position: fixed;
        inset: 0;
        background: var(--lhc-hdr-bg);
        z-index: 9999;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        height: 100dvh;
        padding: 0;
        transform: translateX(-100%);
        transition: transform 0.32s var(--lhc-hdr-ease);
        overflow: hidden;
        overscroll-behavior: contain;
    }

    .lhc-header__nav--open {
        transform: translateX(0);
    }

    .lhc-header__nav-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 18px;
        right: 18px;
        width: 40px;
        height: 40px;
        color: var(--lhc-hdr-nav);
        border-radius: 4px;
        transition: background var(--lhc-hdr-trans);
        flex-shrink: 0;
        z-index: 2;
    }

    .lhc-header__nav-close:hover {
        background: rgba(0, 0, 0, 0.06);
    }

    .lhc-header__nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
        height: auto;
    }

    .lhc-header__nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        height: auto;
        align-items: stretch;
    }

    .lhc-header__nav-link {
        height: auto;
        padding: 18px 0;
        font-size: 18px;
        font-weight: 600;
        width: 100%;
        letter-spacing: 0;
    }

    .lhc-header__nav-link::after {
        display: none;
    }

    /* Dropdown: inline accordion on mobile */
    .lhc-header__dropdown-toggle {
        height: auto;
        padding: 18px 0;
        font-size: 18px;
        font-weight: 600;
        width: 100%;
        justify-content: space-between;
        letter-spacing: 0;
    }

    .lhc-header__dropdown-toggle::after {
        display: none;
    }

    /* Disable hover-open on mobile */
    .lhc-header__nav-item--has-dropdown:hover .lhc-header__dropdown-menu {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
    }

    .lhc-header__dropdown-menu {
        position: static;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: none;
        border-radius: 0;
        padding: 0 0 8px 16px;
        background: transparent;
    }

    .lhc-header__dropdown-menu--open {
        display: block;
    }

    .lhc-header__dropdown-item {
        padding: 12px 0;
        font-size: 15px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    /* ── Two-panel slider ─────────────────────────────────────────────────── */
    .lhc-header__nav-panels {
        display: flex;
        flex-direction: row;
        width: 200%;
        min-height: 100%;
        transition: transform 0.32s var(--lhc-hdr-ease);
        align-items: flex-start;
    }

    .lhc-header__nav--cats-open .lhc-header__nav-panels {
        transform: translateX(-50%);
    }

    .lhc-header__nav-panel {
        display: flex;
        flex-direction: column;
        width: 50%;
        flex-shrink: 0;
        padding: 80px 24px 48px;
        height: 100dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* Chevron points right on mobile — indicates slide-navigation, not expand */
    .lhc-header__dropdown-toggle .lhc-header__dropdown-chevron {
        transform: rotate(-90deg);
    }

    .lhc-header__dropdown-toggle[aria-expanded="true"] .lhc-header__dropdown-chevron {
        transform: rotate(-90deg);
    }

    /* ── Categories panel (Panel 2) ───────────────────────────────────────── */
    .lhc-header__cats-panel {
        display: flex;
        flex-direction: column;
        width: 50%;
        flex-shrink: 0;
        height: 100dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .lhc-header__cats-panel-hd {
        display: flex;
        align-items: center;
        height: 76px;
        padding: 0 64px 0 24px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        position: sticky;
        top: 0;
        background: var(--lhc-hdr-bg);
        z-index: 1;
        flex-shrink: 0;
    }

    .lhc-header__cats-panel-back {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 15px;
        font-weight: 500;
        color: var(--lhc-hdr-nav);
        padding: 8px 0;
        transition: color var(--lhc-hdr-trans);
    }

    .lhc-header__cats-panel-back:hover,
    .lhc-header__cats-panel-back:active {
        color: var(--lhc-hdr-active);
    }

    .lhc-header__cats-panel-title {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 18px;
        font-weight: 600;
        color: var(--lhc-hdr-nav);
        pointer-events: none;
        white-space: nowrap;
    }

    .lhc-header__cats-panel-list {
        padding: 0 24px 48px;
    }

    .lhc-header__cats-panel-list li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .lhc-header__cats-panel-link {
        display: block;
        padding: 18px 0;
        font-size: 18px;
        font-weight: 600;
        color: var(--lhc-hdr-nav);
        transition: color var(--lhc-hdr-trans);
    }

    .lhc-header__cats-panel-link:hover,
    .lhc-header__cats-panel-link:active {
        color: var(--lhc-hdr-active);
    }
}

/* ---------------------------------------------------------------------------
   Responsive — Small mobile (≤ 480px)
   --------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .lhc-header {
        --lhc-hdr-px: 16px;
        --lhc-hdr-height: 64px;
    }

    .lhc-header__logo-name {
        font-size: 18px;
    }

    .lhc-header__logo-icon svg {
        width: 34px;
        height: 34px;
    }
}

/* ---------------------------------------------------------------------------
   WordPress admin bar compatibility
   WP admin bar: 32px on desktop (>782px), 46px on tablet (601–782px),
   hidden off-screen on mobile (≤600px).
   --------------------------------------------------------------------------- */

/* Sticky header: push down below admin bar */
.admin-bar .lhc-header--sticky {
    top: 32px;
}

/* Mobile nav drawer: start below admin bar */
@media (max-width: 782px) {
    .admin-bar .lhc-header--sticky {
        top: 46px;
    }

    .admin-bar .lhc-header__nav {
        top: 46px;
    }
}

/* Admin bar hidden on very small screens — restore top: 0 */
@media (max-width: 600px) {
    .admin-bar .lhc-header--sticky {
        top: 0;
    }

    .admin-bar .lhc-header__nav {
        top: 0;
    }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .lhc-header *,
    .lhc-header *::before,
    .lhc-header *::after {
        transition-duration: 0.01ms !important;
    }
}
