/**
 * Header Styles
 * Mobile-first design
 */

/* ============================================================================
   ADVERT NAV
   ========================================================================== */

.advert-nav-wrapper {
    background-color: var(--nasc-gray);
    width: 100%;
}

.advert-nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
}

.advert-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.advert-menu li {
    margin: 0;
}

.advert-menu .promo-text {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
}

.advert-menu a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.advert-menu a:hover {
    color: var(--sage-green);
}

/* ============================================================================
   SITE WRAPPER
   ========================================================================== */

.site-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* ============================================================================
   SITE HEADER
   ========================================================================== */

.site-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.main-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

/* Logo Section */
.header-logo {
    display: flex;
    align-items: center;
}

.logo {
    max-width: 120px;
}

.logo img {
    width: 100%;
    height: auto;
    display: block;
}

/* Search Section */
.header-search {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* AWS Search Plugin Overrides */
.header-search .aws-container {
    width: 100% !important;
    max-width: 100% !important;
}

.header-search .aws-search-form {
    width: 100% !important;
}

.header-search .aws-wrapper {
    width: 100% !important;
    border: 2px solid var(--light-grey) !important;
    border-radius: 8px 0 0 8px !important;
    background-color: white !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    border-right: none !important;
}

.header-search .aws-wrapper:focus-within {
    border-color: var(--nasc-gray) !important;
    box-shadow: 0 0 0 3px rgba(69, 69, 64, 0.1) !important;
}

.header-search form {
    width: 100%;
    display: flex !important;
    align-items: stretch !important;
}

.header-search input[type="search"],
.header-search input[type="text"],
.header-search .aws-search-field {
    width: 100%;
    border: none !important;
    font-family: var(--font-body) !important;
    font-size: 1rem !important;
    color: var(--dark-grey) !important;
    padding: 0.75rem 1rem !important;
    background: transparent !important;
    outline: none !important;
    border-radius: 8px 0 0 8px !important;
}

.header-search .aws-search-field::placeholder {
    color: var(--medium-grey-green) !important;
    opacity: 1;
}

/* Search button styling */
.header-search .aws-search-btn {
    background-color: var(--nasc-gray) !important;
    border: 2px solid var(--nasc-gray) !important;
    border-radius: 0 8px 8px 0 !important;
    padding: 0.75rem 1.25rem !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.header-search .aws-search-btn:hover {
    background-color: var(--dark-grey) !important;
}

/* Micro-interaction: Button animates when search input is focused */
.header-search .aws-wrapper:focus-within ~ .aws-search-btn,
.header-search .aws-search-field:focus ~ .aws-search-btn {
    animation: searchButtonPulse 0.6s ease-out;
}

.header-search .aws-search-btn_icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-search .aws-wrapper:focus-within ~ .aws-search-btn .aws-search-btn_icon,
.header-search .aws-search-field:focus ~ .aws-search-btn .aws-search-btn_icon {
    transform: scale(1.15) rotate(-5deg);
}

.header-search .aws-search-btn_icon svg {
    fill: white !important;
}

@keyframes searchButtonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(93, 110, 79, 0.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Clear button styling */
.header-search .aws-search-clear {
    color: var(--medium-grey-green) !important;
    font-size: 1.5rem !important;
    transition: color 0.3s ease;
}

.header-search .aws-search-clear:hover {
    color: var(--dark-grey) !important;
}

/* Hide the label visually but keep it for accessibility */
.header-search .aws-search-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Right Section (Nav + Cart) */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--dark-grey);
}

.mobile-menu-toggle i {
    font-size: 1.5rem;
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
}

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

.nav-menu a {
    color: var(--dark-grey);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--forest-green);
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    cursor: pointer;
    padding: 0.5rem 0;
    color: var(--dark-grey);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
    background: none;
    border: none;
}

.nav-dropdown-toggle:hover {
    color: var(--forest-green);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    background: white;
    border: 1px solid var(--light-grey);
    border-radius: 8px;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    z-index: 1002;
}

.nav-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 0.5rem;
    background: transparent;
    z-index: 999;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

/* Account Dropdown - Etsy Style */
.nav-account-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 1.5rem;
    padding: 0.5rem;
}

.nav-account-caret {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.nav-account-dropdown.active .nav-account-caret {
    transform: rotate(180deg);
}

.nav-account-dropdown.active .nav-account-menu {
    display: block;
}

/* Overlay - Etsy Style Fade */
.nav-dropdown-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    pointer-events: all;
}

.nav-dropdown-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Account Menu Enhanced */
.nav-account-menu {
    top: calc(100% + 1rem);
    animation: slideDown 0.2s ease;
    z-index: 1002;
}

/* Arrow Pointer - Points to user icon */
.nav-account-arrow {
    position: absolute;
    top: -8px;
    right: 12px;
    width: 16px;
    height: 16px;
    background: white;
    border-left: 1px solid var(--light-grey);
    border-top: 1px solid var(--light-grey);
    transform: rotate(45deg);
    z-index: 1;
}

/* Sign In Link (Signed Out State) */
.nav-signin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    padding: 0.5rem;
}

.nav-signin i {
    font-size: 1.25rem;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--dark-grey);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-dropdown-menu a:hover {
    background-color: var(--off-white);
    color: var(--forest-green);
}

.nav-dropdown-divider {
    height: 1px;
    background-color: var(--light-grey);
    margin: 0.5rem 0;
    border: none;
}

/* Cart Icon */
.nav-cart {
    display: flex;
    align-items: center;
    color: var(--dark-grey);
    font-size: 1.25rem;
}

.nav-cart:hover {
    color: var(--forest-green);
}

/* ============================================================================
   MAIN NAV WRAPPER
   ========================================================================== */

.main-nav-wrapper {
    background-color: var(--nasc-gray);
    width: 100%;
    padding: 0;
}

.main-nav-wrapper .container {
    max-width: 1400px;
    margin: 0 auto;
}

.main-nav-wrapper ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.main-nav-wrapper li {
    margin: 0;
}

.main-nav-wrapper a {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 1rem 1.5rem;
    color: #FFFFFF;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.main-nav-wrapper a:hover {
    background-color: var(--dark-green-grey);
    color: #FFFFFF;
}

/* Add chevron to menu items with submenus */
.main-nav-wrapper .menu-item-has-children > a::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    margin-left: 0.25rem;
    transition: transform 0.3s ease;
}

.main-nav-wrapper .menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

/* ============================================================================
   MOBILE STYLES (Default - Mobile First)
   ========================================================================== */

/* Hide desktop nav on mobile */
@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    .main-nav-wrapper {
        display: none;
    }

    .main-header {
        grid-template-columns: 80px 1fr 60px;
        gap: 0.5rem;
    }

    .logo {
        max-width: 80px;
    }

    .header-search {
        padding: 0;
    }

    .main-nav-wrapper a {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* Tablet/narrow screens - reduce padding for better fit */
@media (min-width: 769px) and (max-width: 1200px) {
    .main-nav-wrapper a {
        padding: 1rem 1rem;
        font-size: 0.875rem;
    }
}

/* ============================================================================
   TABLET STYLES
   ========================================================================== */

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }

    .desktop-nav {
        display: flex;
    }

    .logo {
        max-width: 150px;
    }
}

/* ============================================================================
   DESKTOP STYLES
   ========================================================================== */

@media (min-width: 1024px) {
    .site-header {
        padding: 1.5rem 1rem;
    }

    .main-header {
        gap: 2rem;
    }

    .logo {
        max-width: 180px;
    }

    .header-search {
        padding: 0 1rem;
    }
}

/* ============================================================================
   DROPDOWN MENUS
   ========================================================================== */

.main-nav-wrapper .menu > li {
    position: relative;
}

.main-nav-wrapper .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    z-index: 1000;
}

.main-nav-wrapper .menu-item:hover > .sub-menu {
    display: block;
}

.main-nav-wrapper .sub-menu li {
    margin: 0;
}

.main-nav-wrapper .sub-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--dark-grey);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-nav-wrapper .sub-menu a:hover {
    background-color: var(--off-white);
    color: var(--forest-green);
}

/* ============================================================================
   MEGA MENU (for Breeders section)
   ========================================================================== */

/* Target menu items with .mega-menu class - add this class in WordPress menu editor */
.main-nav-wrapper .mega-menu > .sub-menu {
    left: 50%;
    transform: translateX(-50%);
    min-width: 800px;
    max-width: 95vw;
    width: max-content;
    padding: 1.5rem;
    display: none;
}

.main-nav-wrapper .mega-menu:hover > .sub-menu {
    display: block;
    column-count: 3;
    column-gap: 1.5rem;
}

/* Increase columns on larger screens */
@media (min-width: 1200px) {
    .main-nav-wrapper .mega-menu > .sub-menu {
        min-width: 1000px;
    }

    .main-nav-wrapper .mega-menu:hover > .sub-menu {
        column-count: 4;
        column-gap: 2rem;
    }
}

@media (min-width: 1440px) {
    .main-nav-wrapper .mega-menu > .sub-menu {
        min-width: 1200px;
        max-width: 1400px;
    }

    .main-nav-wrapper .mega-menu:hover > .sub-menu {
        column-count: 5;
    }
}

.main-nav-wrapper .mega-menu .sub-menu li {
    break-inside: avoid;
    margin-bottom: 0.25rem;
}

.main-nav-wrapper .mega-menu .sub-menu a {
    padding: 0.375rem 0.625rem;
    font-size: 0.9375rem;
    border-radius: 4px;
    display: block;
    line-height: 1.4;
}

/* ============================================================================
   MOBILE DROPDOWN STYLES
   ========================================================================== */

@media (max-width: 768px) {
    .main-nav-wrapper .sub-menu {
        position: static;
        box-shadow: none;
        background: var(--dark-green-grey);
        border-radius: 0;
        min-width: 100%;
        padding: 0;
    }

    .main-nav-wrapper .sub-menu a {
        padding: 0.75rem 2rem;
        font-size: 0.875rem;
        color: var(--off-white);
    }

    .main-nav-wrapper .sub-menu a:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
    }

    /* Mega menu on mobile becomes regular list */
    .main-nav-wrapper .mega-menu > .sub-menu {
        grid-template-columns: 1fr;
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        transform: none;
        left: 0;
    }
}

/* ============================================================================
   TABLET DROPDOWN STYLES
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1023px) {
    .main-nav-wrapper .mega-menu > .sub-menu {
        min-width: 700px;
        max-width: 90vw;
        padding: 1.5rem;
    }

    .main-nav-wrapper .mega-menu:hover > .sub-menu {
        column-count: 3;
        column-gap: 1.5rem;
    }

    .main-nav-wrapper .mega-menu .sub-menu a {
        font-size: 0.875rem;
        padding: 0.375rem 0.5rem;
    }
}

/* ============================================================================
   DROPDOWN ANIMATIONS (Desktop only)
   ========================================================================== */

@media (min-width: 769px) {
    /* Standard dropdown animation */
    .main-nav-wrapper .sub-menu {
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Mega menu animation - needs to preserve translateX(-50%) */
    .main-nav-wrapper .mega-menu > .sub-menu {
        animation: slideDownMega 0.3s ease;
    }

    @keyframes slideDownMega {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }
}

/* ============================================================================
   MOBILE MENU BUTTON
   ========================================================================== */

.mobile-menu-button {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.375rem;
    z-index: 1001;
}

.burger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--dark-grey);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-button.active .burger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-button.active .burger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-button.active .burger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Show burger button on mobile */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: flex;
    }
}

/* ============================================================================
   MOBILE MENU OVERLAY
   ========================================================================== */

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1998;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================================================
   MOBILE MENU PANEL
   ========================================================================== */

.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background-color: white;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1999;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

.mobile-menu-panel.active {
    transform: translateX(0);
}

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--light-grey);
    background-color: var(--off-white);
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-grey);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.mobile-menu-close:hover {
    color: var(--forest-green);
}

/* Mobile Menu Content */
.mobile-menu-content {
    padding: 1rem 0 2rem 0;
    min-height: 100%;
}

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background-color: white;
}

.mobile-menu-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s ease;
    background-color: white;
}

.mobile-menu-item-wrapper:hover {
    background-color: var(--off-white);
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--dark-grey);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    transition: color 0.3s ease, background-color 0.3s ease;
    flex: 1;
    cursor: pointer;
    background-color: white;
}

.mobile-menu-link.has-submenu {
    padding-right: 0.5rem;
}

.mobile-menu-link:hover,
.mobile-menu-item-wrapper:hover .mobile-menu-link {
    color: var(--forest-green);
}

.mobile-menu-link:not(.has-submenu):hover {
    background-color: var(--off-white);
}

/* Submenu Toggle Button */
.mobile-submenu-toggle {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: var(--dark-grey);
    font-size: 1rem;
    min-width: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, color 0.3s ease;
}

.mobile-submenu-toggle i {
    display: block;
    font-size: 1rem;
}

.mobile-submenu-toggle:hover {
    color: var(--forest-green);
}

.mobile-submenu-toggle.active {
    transform: rotate(180deg);
}

/* Submenu */
.mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #f5f5f0;
    border-left: 3px solid var(--forest-green);
}

.mobile-submenu.active {
    max-height: 10000px;
}

.mobile-submenu .mobile-menu-link {
    padding: 0.875rem 1.5rem 0.875rem 3rem;
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--dark-grey);
    border-bottom: none;
}

.mobile-submenu .mobile-menu-link:hover {
    background-color: rgba(93, 110, 79, 0.08);
    color: var(--forest-green);
}

.mobile-submenu .mobile-menu-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-submenu .mobile-menu-item:last-child {
    border-bottom: none;
}

/* Mobile Menu Account Section */
.mobile-menu-account {
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background-color: white;
}

.mobile-menu-account-link {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--dark-grey);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background-color 0.3s ease, color 0.3s ease;
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mobile-menu-account-link:last-child {
    border-bottom: none;
}

.mobile-menu-account-link:hover {
    background-color: var(--off-white);
    color: var(--forest-green);
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Hide mobile menu elements on desktop */
@media (min-width: 769px) {
    .mobile-menu-button,
    .mobile-menu-overlay,
    .mobile-menu-panel {
        display: none !important;
    }
}
