/**
 * Custom Header & Footer Styles
 * Your Electrics - Replaces Astra default header/footer
 *
 * Structure:
 * 1. Header Top Bar (logo, phone/email, search, cart, login)
 * 2. Mobile Header Adjustments
 * 3. Footer
 */


/* ============================================
   0. ANNOUNCEMENT / TRUST BAR
   Slim bar above header — delivery info, trade CTA
   ============================================ */

.ye-announcement-bar {
    background-color: var(--dark-gray);
    color: var(--white);
    font-size: var(--font-size-xs);
    line-height: 1;
}

.ye-announcement-bar__container {
    max-width: var(--max-width-container);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

.ye-announcement-bar__items {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-sm) 0;
}

.ye-announcement-bar__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.85);
}

.ye-announcement-bar__item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.ye-announcement-bar__item--cta a {
    color: var(--white);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: var(--font-weight-semibold);
    transition: color var(--transition-fast);
}

.ye-announcement-bar__item--cta a:hover {
    color: var(--primary-red);
}

/* Mobile: hide announcement bar — saves vertical space,
   text items don't fit on small screens */
@media (max-width: 767px) {
    .ye-announcement-bar {
        display: none;
    }
}


/* ============================================
   1. HEADER TOP BAR
   White background with logo, phone, search, cart, login
   ============================================ */

.ye-header {
    background-color: var(--white);
    position: sticky;
    top: 0;
    z-index: var(--z-index-sticky);
}

/**
 * Top bar — contains all header elements
 */
.ye-header__top {
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
}

/**
 * Header container — flex layout
 * Aligns: logo | phone | search | cart | login | hamburger(mobile)
 */
.ye-header__container {
    max-width: var(--max-width-container);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

/**
 * Logo — image-based
 */
.ye-header__logo {
    text-decoration: none;
    flex-shrink: 0;
    line-height: 0; /* removes extra space below img */
}

.ye-header__logo img {
    max-height: 90px;
    width: auto;
    height: auto;
    max-width: 100%;
    display: block;
}

.ye-header__logo:hover {
    opacity: 0.85;
}

/**
 * Contact section — phone + email, stacked vertically
 */
.ye-header__contact {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-shrink: 0;
}

.ye-header__contact-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1;
}

.ye-header__contact-row svg {
    flex-shrink: 0;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px;
    max-width: 14px;
    color: var(--primary-red);
}

.ye-header__contact-row a {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--font-size-sm);
    text-decoration: none;
    line-height: 1;
    padding: 0;
    margin: 0;
    min-height: 0 !important; /* Override Astra's 48px min-height on all <a> tags */
}

.ye-header__phone-number {
    font-weight: var(--font-weight-bold);
    color: var(--dark-gray);
}

.ye-header__phone-number:hover {
    color: var(--primary-red);
}

.ye-header__email {
    color: var(--medium-gray);
}

.ye-header__email:hover {
    color: var(--primary-red);
}

/**
 * Search bar — flexible width, with magnifying glass icon
 */
.ye-header__search {
    flex: 1;
    max-width: 550px;
    min-width: 200px;
    position: relative;
}

/* Style the WooCommerce product search form */
.ye-header__search .woocommerce-product-search,
.ye-header__search .search-form {
    display: flex;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden; /* Clip the button to the input's rounded shape */
}

.ye-header__search input[type="search"],
.ye-header__search .search-field {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    min-height: 44px;
    transition: border-color var(--transition-base);
    background-color: var(--white);
}

.ye-header__search input[type="search"]:focus,
.ye-header__search .search-field:focus {
    outline: none;
    border-color: var(--primary-red);
}

/**
 * Search submit button — styled as a magnifying glass icon
 * WooCommerce renders <button type="submit"> (not <input>),
 * so we target both element types for safety.
 * Uses an inline SVG data URI as background image so the button
 * is fully clickable and submits the search form.
 */
.ye-header__search input[type="submit"],
.ye-header__search button[type="submit"],
.ye-header__search .search-submit {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 44px;
    background-color: var(--primary-red);
    border: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    font-size: 0;
    color: transparent;
    line-height: 0;
    padding: 0;
    z-index: 2;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;

    /* White magnifying glass on red background */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
    transition: background-color var(--transition-fast);
}

.ye-header__search input[type="submit"]:hover,
.ye-header__search button[type="submit"]:hover,
.ye-header__search .search-submit:hover {
    background-color: var(--red-hover);
}

/**
 * Cart button — red with icon, text, and price
 */
.ye-header-cart {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.25rem;
    background-color: var(--primary-red);
    color: var(--white);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 48px;
    transition: background-color var(--transition-fast);
}

.ye-header-cart:hover {
    background-color: var(--red-hover);
    color: var(--white);
}

.ye-header-cart svg {
    flex-shrink: 0;
}

.ye-header-cart__total {
    background: var(--white);
    color: var(--primary-red);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
}

.ye-header-cart__count {
    background: var(--white);
    color: var(--primary-red);
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: 1;
}

/**
 * Login / Register link
 */
.ye-header__account {
    flex-shrink: 0;
}

.ye-header__account a {
    color: var(--medium-gray);
    text-decoration: none;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    transition: color var(--transition-fast);
}

.ye-header__account a:hover {
    color: var(--primary-red);
}


/* ============================================
   2. MOBILE HEADER ADJUSTMENTS
   ============================================ */

/* Hamburger hidden on desktop (shown via navigation.css on mobile) */
.ye-hamburger {
    display: none;
}

/* Mobile: compact header — two rows
   Row 1: hamburger | logo | phone-icon | cart-icon
   Row 2: full-width search bar */
@media (max-width: 767px) {

    .ye-header__container {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-sm);
        flex-wrap: wrap;
    }

    .ye-header__logo {
        margin-right: auto; /* Push phone + cart to the right */
    }

    .ye-header__logo img {
        max-height: 50px;
    }

    .ye-hamburger {
        display: flex;
        order: -1;
    }

    /* Phone + email: icon-only on mobile — tapping calls/emails */
    .ye-header__contact {
        flex-direction: row;
        gap: var(--spacing-sm);
    }

    .ye-header__contact .ye-header__phone-number,
    .ye-header__contact .ye-header__email {
        font-size: 0;        /* Hide text */
        min-height: 44px;    /* Keep tappable */
        display: flex;
        align-items: center;
    }

    .ye-header__contact .ye-header__contact-row svg {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px;
        max-width: 20px;
    }

    .ye-header__account {
        display: none;
    }

    /* Search bar: full-width row below */
    .ye-header__search {
        order: 5;
        flex-basis: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* Cart: icon-only on mobile */
    .ye-header-cart {
        padding: 0.5rem 0.75rem;
        gap: 0.25rem;
        font-size: 0; /* Hide bare "Cart" text */
    }

    .ye-header-cart svg,
    .ye-header-cart__count {
        font-size: var(--font-size-xs);
    }

    .ye-header-cart__total {
        display: none;
    }
}

/* Small phones: shrink logo further */
@media (max-width: 480px) {
    .ye-header__logo img {
        max-height: 40px;
    }
}

/* Tablet: search full-width below */
@media (min-width: 768px) and (max-width: 1023px) {
    .ye-hamburger {
        display: flex;
    }

    .ye-header__container {
        flex-wrap: wrap;
    }

    .ye-header__search {
        order: 5;
        flex-basis: 100%;
        max-width: 100%;
    }
}

/* Desktop: full header, hide hamburger */
@media (min-width: 1024px) {
    .ye-hamburger {
        display: none;
    }

    .ye-mobile-menu,
    .ye-menu-overlay {
        display: none;
    }
}

/* Mobile menu category list styling */
.ye-mobile-menu__categories {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.ye-mobile-menu__categories h3 {
    font-family: var(--font-heading);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-red);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary-red);
}

.ye-mobile-menu__categories ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ye-mobile-menu__categories li {
    border-bottom: 1px solid var(--border-light);
}

.ye-mobile-menu__categories a {
    display: block;
    padding: var(--spacing-sm) 0;
    color: var(--dark-gray);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.ye-mobile-menu__categories a:hover {
    color: var(--primary-red);
}


/* ============================================
   VAT TOGGLE — INC/EX VAT PRICE DISPLAY
   Segmented pill control in header
   ============================================ */

/**
 * Toggle container — pill shape, flex row
 */
.ye-vat-toggle {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
    flex-shrink: 0;
}

/**
 * Toggle buttons — two segments
 */
.ye-vat-toggle__btn {
    padding: 0.375rem 0.625rem;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--medium-gray);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    line-height: 1;
    min-height: 0;
}

.ye-vat-toggle__btn:hover {
    color: var(--dark-gray);
}

/**
 * Active state — dark gray background, white text
 * Uses dark-gray (not red) to keep it subtle — it's a utility, not a CTA
 */
.ye-vat-toggle__btn.is-active {
    background-color: var(--dark-gray);
    color: var(--white);
    font-weight: var(--font-weight-semibold);
}

/**
 * Mobile menu VAT toggle — sits between header and categories
 */
.ye-mobile-menu__vat {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.ye-mobile-menu__vat::before {
    content: 'Prices:';
    font-size: var(--font-size-sm);
    color: var(--medium-gray);
    white-space: nowrap;
}

/* Mobile: compact toggle in header row */
@media (max-width: 767px) {
    .ye-header__container > .ye-vat-toggle {
        order: 3;
    }

    .ye-vat-toggle__btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
}

/* Tablet: keep toggle visible */
@media (min-width: 768px) and (max-width: 1023px) {
    .ye-header__container > .ye-vat-toggle {
        order: 0;
    }
}


/* ============================================
   3. FOOTER
   Dark gray bar with links and copyright
   ============================================ */

.ye-footer {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-lg);
}

.ye-footer__container {
    max-width: var(--max-width-container);
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-lg);
}

.ye-footer__menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.ye-footer__menu li a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--transition-fast);
}

.ye-footer__menu li a:hover {
    color: var(--primary-red);
}

.ye-footer__copyright {
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--font-size-sm);
    text-align: right;
    flex-shrink: 0;
}

/* Mobile footer: stack vertically */
@media (max-width: 767px) {
    .ye-footer__container {
        flex-direction: column;
        text-align: center;
        padding: 0 var(--spacing-md);
    }

    .ye-footer__menu {
        justify-content: center;
    }

    .ye-footer__copyright {
        text-align: center;
    }
}
