/**
 * Mobile Header Styles
 * Consolidated mobile header, navigation, and cart button styles
 * Organized for maintainability and no conflicts
 */

/* ========================================
   BASE MOBILE HEADER STYLES
   Core styles that apply to mobile header at all times
   ======================================== */

.krisette-mobile-header {
    display: none; /* Hidden by default, shown via media query */
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    height: 60px;
    min-height: 60px;
    max-height: 60px;
}

/* Mobile Header Container Layout */
.mobile-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    gap: 15px;
}

/* ========================================
   MOBILE LOGO
   ======================================== */

.mobile-logo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    order: 2; /* Center position */
}

.mobile-logo img {
    max-height: 35px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.mobile-logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #333;
}

/* ========================================
   MOBILE MENU TOGGLE (HAMBURGER)
   ======================================== */

.mobile-menu-toggle {
    order: 1; /* Left position */
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 30px;
    height: 30px;
    position: relative;
    z-index: 10001;
}

.hamburger-line {
    width: 22px;
    height: 2px;
    background: #333;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Hamburger animation when active */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   MOBILE CART BUTTON
   ======================================== */

.mobile-checkout-btn {
    order: 3; /* Right position */
    background: none !important;
    color: #666 !important;
    padding: 8px !important;
    border-radius: 0 !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    border: none !important;
    box-shadow: none !important;
    position: relative !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    transition: color 0.3s ease !important;
}

.mobile-checkout-btn:hover {
    background: none !important;
    color: #333 !important;
    transform: none !important;
}

.mobile-cart-icon {
    width: 22px !important;
    height: 22px !important;
    fill: currentColor !important;
}

/* Hide the "Cart" text on mobile */
.mobile-checkout-btn span {
    display: none !important;
}

.mobile-cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.mobile-cart-badge.visible {
    transform: scale(1);
}

/* ========================================
   MOBILE NAVIGATION MENU
   ======================================== */

.mobile-navigation {
    display: none; /* Hidden by default, shown when menu is open */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 9998;
    border-top: 1px solid #f0f0f0;
}

.mobile-navigation.open {
    display: block !important;
}

/* Mobile Menu List */
.mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: white;
}

.mobile-menu li {
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.mobile-menu a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.3s ease;
    position: relative;
}

.mobile-menu a:hover {
    background: #f8f8f8;
    color: #8B4513;
    padding-left: 25px;
}

/* Dropdown arrows are added by JavaScript in global.php */

/* Mobile Submenu */
.mobile-menu .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f8f8;
    overflow: hidden;
    /* Display is controlled by JavaScript inline styles */
}

.mobile-menu .sub-menu li {
    border-bottom: 1px solid #e8e8e8;
}

.mobile-menu .sub-menu a {
    padding-left: 40px;
    font-size: 15px;
    color: #666;
}

.mobile-menu .sub-menu a:hover {
    background: #f0f0f0;
    color: #8B4513;
    padding-left: 45px;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Show mobile header on mobile/tablet devices */
@media (max-width: 1024px) {
    .krisette-mobile-header {
        display: block !important;
    }
    
    /* Ensure site header is hidden on mobile */
    .site-header {
        display: none !important;
    }
}

/* Hide mobile header on desktop */
@media (min-width: 1025px) {
    .krisette-mobile-header {
        display: none !important;
    }
    
    .mobile-navigation {
        display: none !important;
    }
    
    /* Ensure site header is visible on desktop */
    .site-header {
        display: block !important;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .mobile-header-container {
        padding: 0 15px;
    }
    
    .mobile-logo img {
        max-height: 30px;
    }
    
    .mobile-menu a {
        padding: 12px 15px;
        font-size: 15px;
    }
    
    .mobile-menu .sub-menu a {
        padding-left: 30px;
        font-size: 14px;
    }
}

/* ========================================
   ANIMATIONS & TRANSITIONS
   ======================================== */

/* Fade in animation for mobile header */
@keyframes fadeInHeader {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.krisette-mobile-header {
    animation: fadeInHeader 0.3s ease forwards;
}

/* Slide down animation for mobile menu */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-navigation.open {
    animation: slideDown 0.3s ease forwards;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Ensure full width on mobile */
@media (max-width: 1024px) {
    .krisette-mobile-header,
    .mobile-navigation {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
    }
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}