/**
 * Header & Footer Styles
 * Loaded on all pages
 * 
 * @package Ecommerce_Pro
 * @since 1.0.0
 */

/* ========== HEADER STYLES ========== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--ep-header-bg, #ffffff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.site-header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Site Branding */
.site-branding {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.custom-logo-link {
    display: block;
    line-height: 0;
}

.custom-logo {
    max-height: 60px;
    width: auto;
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.site-title a {
    color: #1f2937;
    text-decoration: none;
}

.site-title a:hover {
    color: var(--ep-primary, #3b82f6);
}

.site-description {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Primary Navigation */
.main-navigation {
    flex: 1;
    display: flex;
    justify-content: center;
}

#primary-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

#primary-menu li {
    position: relative;
}

#primary-menu > li > a {
    display: block;
    padding: 0.5rem 1rem;
    color: #1f2937;
    font-weight: 500;
    transition: color 0.3s ease;
}

#primary-menu > li > a:hover,
#primary-menu > li > a:focus {
    color: var(--ep-primary, #3b82f6);
    text-decoration: none;
}

#primary-menu > li.current-menu-item > a,
#primary-menu > li.current_page_item > a {
    color: var(--ep-primary, #3b82f6);
}

/* Dropdown Menu */
#primary-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

#primary-menu li:hover > .sub-menu,
#primary-menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#primary-menu .sub-menu li {
    display: block;
}

#primary-menu .sub-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #1f2937;
    white-space: nowrap;
    transition: background-color 0.3s ease;
}

#primary-menu .sub-menu a:hover,
#primary-menu .sub-menu a:focus {
    background-color: #f3f4f6;
    color: var(--ep-primary, #3b82f6);
    text-decoration: none;
}

/* Mobile Menu Toggle */
#mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #1f2937;
    transition: color 0.3s ease;
}

#mobile-menu-toggle:hover,
#mobile-menu-toggle:focus {
    color: var(--ep-primary, #3b82f6);
}

@media (max-width: 1023px) {
    #mobile-menu-toggle {
        display: block;
    }
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.mobile-menu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

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

#mobile-navigation {
    list-style: none;
    margin: 0;
    padding: 0;
}

#mobile-navigation li {
    border-bottom: 1px solid #e5e7eb;
}

#mobile-navigation li:last-child {
    border-bottom: none;
}

#mobile-navigation a {
    display: block;
    padding: 1rem 0;
    color: #1f2937;
    font-weight: 500;
    transition: color 0.3s ease;
}

#mobile-navigation a:hover,
#mobile-navigation a:focus {
    color: var(--ep-primary, #3b82f6);
    text-decoration: none;
}

/* Header Cart Icon */
.header-cart {
    position: relative;
}

.cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    color: #1f2937;
    transition: color 0.3s ease;
}

.cart-icon:hover,
.cart-icon:focus {
    color: var(--ep-primary, #3b82f6);
    text-decoration: none;
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    transform: translate(25%, -25%);
}

/* ========== FOOTER STYLES ========== */
.site-footer {
    background-color: var(--ep-footer-bg, #1f2937);
    color: #d1d5db;
    margin-top: 4rem;
}

.site-footer a {
    color: #d1d5db;
    transition: color 0.3s ease;
}

.site-footer a:hover,
.site-footer a:focus {
    color: #ffffff;
    text-decoration: none;
}

/* Footer Widgets */
.footer-widgets {
    padding: 3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-widget-area h3,
.footer-widget-area .widget-title {
    color: #ffffff;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.footer-widget-area ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-widget-area ul li {
    margin-bottom: 0.75rem;
}

.footer-widget-area ul li a {
    display: inline-block;
    transition: all 0.3s ease;
}

.footer-widget-area ul li a:hover {
    color: #ffffff;
    transform: translateX(5px);
}

/* Footer Bottom */
.footer-bottom {
    padding: 2rem 0;
}

.site-info {
    text-align: center;
}

.site-info a {
    font-weight: 500;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.social-links a:hover,
.social-links a:focus {
    background-color: var(--ep-primary, #3b82f6);
    transform: translateY(-3px);
}

/* Footer Menu */
.footer-navigation {
    margin-bottom: 2rem;
}

.footer-navigation ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-navigation a {
    font-size: 0.875rem;
}

/* ========== RESPONSIVE HEADER ========== */
@media (max-width: 1023px) {
    .site-header .container {
        position: relative;
    }

    .main-navigation {
        display: none;
    }

    .site-branding {
        flex: 1;
    }

    #primary-menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding-left: 1rem;
        background-color: #f9fafb;
        margin-top: 0.5rem;
        border-radius: 0.375rem;
    }
}

@media (max-width: 767px) {
    .site-header {
        padding: 0.5rem 0;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .custom-logo {
        max-height: 40px;
    }

    .footer-widgets {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        text-align: center;
    }

    .footer-bottom .flex {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ========== SCROLL ANIMATIONS ========== */
.header-animate-in {
    animation: headerSlideDown 0.3s ease;
}

@keyframes headerSlideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ========== ACCESSIBILITY ENHANCEMENTS ========== */
.main-navigation a:focus,
.mobile-menu a:focus,
#mobile-menu-toggle:focus {
    outline: 2px solid var(--ep-primary, #3b82f6);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .site-header {
        border-bottom: 2px solid currentColor;
    }

    #primary-menu > li > a {
        text-decoration: underline;
        text-decoration-color: transparent;
    }

    #primary-menu > li > a:hover,
    #primary-menu > li > a:focus {
        text-decoration-color: currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .site-header,
    #primary-menu a,
    .cart-icon,
    .social-links a,
    .mobile-menu {
        transition: none;
    }

    .mobile-menu.active {
        animation: none;
    }
}