/**
 * 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: single line, scroll or truncate */
@media (max-width: 767px) {
    .ye-announcement-bar__items {
        gap: var(--spacing-lg);
        padding: var(--spacing-xs) 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }

    .ye-announcement-bar__items::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .ye-announcement-bar__container {
        padding: 0 var(--spacing-md);
    }
}


/* ============================================
   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 — text-based "your electrics"
 */
.ye-header__logo {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: var(--font-weight-bold);
    color: var(--dark-gray);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.ye-header__logo span {
    color: var(--primary-red);
}

.ye-header__logo:hover {
    text-decoration: none;
    color: var(--dark-gray);
}

/**
 * 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 {
    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: show phone, hide email & account, simplify layout */
@media (max-width: 767px) {
    /* Show phone number but hide the email row */
    .ye-header__contact {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
    }

    .ye-header__contact .ye-header__contact-row:last-child {
        display: none; /* Hide email row */
    }

    .ye-header__contact .ye-header__phone-number {
        font-size: var(--font-size-sm);
    }

    .ye-header__account {
        display: none;
    }

    .ye-header__container {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .ye-header__search {
        flex: 1;
        max-width: none;
        min-width: 0;
        order: 3;
    }

    .ye-header__logo {
        font-size: 1.3rem;
    }

    .ye-hamburger {
        display: flex;
        order: -1;
    }
}

/* 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);
}


/* ============================================
   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-3xl);
}

.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;
    }
}
