/**
 * Wolf Pack Store Customizations
 * Version: 2.15.0 - FINAL
 * 
 * CSS-based layout approach: Elements stay in DOM (preserving Salla web component functionality)
 * but are repositioned visually using flexbox
 * 
 * Features:
 * - Desktop: Language+Search on LEFT, Logo at 75% (center-right), User+Cart on RIGHT
 * - Logo sizing: Responsive across all breakpoints (SIGNIFICANTLY INCREASED)
 *   - Desktop (769px+): 150px height with 300px max-width
 *   - Mobile (<480px): 120px height, 300px max-width, ABSOLUTE positioning (left: -1em)
 *   - Small (480-768px): 150px height, 300px max-width, ABSOLUTE positioning (left: -1em)
 *   - Medium (768px+): 100px height, 320px max-width
 *   - Large (992px+): 120px height, 320px max-width
 *   - XL (1200px+): 140px height, 350px max-width
 * - Header: Min-height 120px on mobile for larger logo
 * - Padding: 0.5rem for compact design
 * - Dark theme with consistent colors (ALL SCREEN SIZES):
 *   - Header/Nav background: var(--color-primary)
 *   - Language/Search inputs: #2d2624 background, matching rounded design
 *   - Border radius: 18px (consistent with search input)
 *   - Height: 36px (consistent with search input)
 *   - Compact language selector: Reduced padding (0.5rem 0.75rem)
 *   - Search max-width: 400px on desktop, full width on mobile
 *   - Gap between elements: 0.75rem
 *   - All text, icons, placeholders: white
 *   - User and cart icons: white
 *   - Overrides default button styles (btn--rounded-gray)
 * - Mobile: Original Salla layout with same colors and logo sizing
 * - Hamburger menu hidden (mobile menu not used)
 * - Proper vertical alignment for all elements
 * - Better visual balance with logo positioned at 75%
 * - Navbar-brand offset to the left (-5.3rem) for better visual centering
 */

/* ============================================================================
   1. IMAGE LIGHTBOX - SIMPLE & RELIABLE WITH MAGNIFIER
   ============================================================================ */

/* Lightbox overlay - simple fixed modal */
.image-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Show lightbox */
.image-lightbox-overlay.active {
    display: flex;
}

/* Lightbox image container */
.image-lightbox-container {
    position: relative;
    display: inline-block;
    max-width: 90%;
    max-height: 90vh;
}

/* Lightbox image */
.image-lightbox-overlay img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.8);
    cursor: crosshair;
}

/* Magnifier glass for lightbox */
.lightbox-magnifier-glass {
    position: absolute;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: none;
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 10001;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    display: none;
    background-color: white;
}

/* Show magnifier when hovering over lightbox image */
.image-lightbox-container:hover .lightbox-magnifier-glass {
    display: block;
}

/* Close button */
.image-lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #1a1a1a;
    z-index: 10002;
    border: none;
}

.image-lightbox-close:hover {
    background: #f0f0f0;
}

.s-user-menu-trigger {
    background-color: transparent;
    padding: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .image-lightbox-overlay {
        padding: 0.5rem;
    }

    .image-lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }

    .image-lightbox-container {
        max-width: 95%;
        max-height: 85vh;
    }

    /* Hide magnifier on mobile */
    .lightbox-magnifier-glass {
        display: none !important;
    }
    
    .image-lightbox-overlay img {
        cursor: default;
    }
}

/* Prevent body scroll when lightbox open */
body.lightbox-open {
    overflow: hidden;
}

/* ============================================================================
   2. SECTION HEADINGS
   ============================================================================ */

/* Add "Configurations" text above banners section - Default (English) */
.s-block.s-block--banners.container::before {
    content: "Configurations";
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 1rem;
    text-align: center;
    font-family: inherit;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

/* Arabic translation */
html[lang="ar"] .s-block.s-block--banners.container::before,
[dir="rtl"] .s-block.s-block--banners.container::before {
    content: "المميزات";
    font-family: inherit;
}

/* Adjust section spacing across all screen sizes */
.s-block {
    margin-top: 2rem;
}

/* Increase spacing on larger screens */
@media (min-width: 640px) {
    .s-block {
        margin-top: 3rem;
    }
}

/* ============================================================================
   3. DETAILS BUTTON STYLES
   ============================================================================ */

.custom-buy-now-btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 1rem 3rem;
    background-color: #ffffff;
    color: #1a1a1a;
    font-size: 1.125rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.custom-buy-now-btn:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.custom-buy-now-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.swiper-slide.bg-dark .custom-buy-now-btn {
    background-color: var(--color-primary);
    color: #2d2625;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   4. HEADER REORGANIZATION - ABSOLUTE POSITIONING (DESKTOP ONLY)
   ============================================================================ */

/* Hide hamburger menu icon since we're not using mobile menu */
.sicon-menu,
i.sicon-menu,
[class*="sicon-menu"],
header .menu-btn,
header button[aria-label*="menu" i] {
    display: none !important;
}

/* ============================================================================
   GLOBAL STYLES (ALL SCREEN SIZES)
   ============================================================================ */

/* Background colors for header and main nav - apply to all screen sizes */
.store-header,
header.store-header {
    background: var(--color-primary) !important;
    z-index: 2;
}

.main-nav-container,
#mainnav.main-nav-container {
    background: var(--color-primary) !important;
    min-height: auto !important;
}

/* Consistent styling for all header elements - all screen sizes */

/* Language selector component - remove extra spacing */
salla-localization-modal {
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    width: auto !important;
    max-width: fit-content !important;
}

/* Utility classes */
.has-overlay:after {
    background-color: rgba(0, 0, 0, 0.2);
}

.line-clamp-2.description {
    -webkit-line-clamp: none;
    line-clamp: none;
}

/* Language selector button - match search input rounded design (compact) */
.header-buttons,
salla-localization-modal button,
salla-localization-modal button.btn--rounded-gray,
button.btn--rounded-gray,
.btn--rounded-gray {
    background: #2d2624 !important;
    background-color: #2d2624 !important;
    color: white !important;
    border: none !important;
    border-color: #2d2624 !important;
    border-radius: 18px !important;
    padding: 0.5rem 0.75rem !important;
    height: 36px !important;
    min-width: auto !important;
    width: auto !important;
    max-width: fit-content !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
}

/* Search input */
.s-search-input,
input[type="search"],
salla-search input {
    background: #2d2624 !important;
    color: white !important;
    border: none !important;
}

/* Search max-width only on desktop */
@media (min-width: 769px) {
    .s-search-input,
    input[type="search"],
    salla-search input {
        max-width: 400px !important;
    }
}

/* Search input placeholder */
.s-search-input::placeholder,
input[type="search"]::placeholder,
salla-search input::placeholder {
    color: white !important;
    opacity: 0.8 !important;
}

/* Search icon */
salla-search svg,
salla-search i {
    color: white !important;
    fill: white !important;
}

/* User and cart icons */
.store-header .header-btn__icon,
.store-header .sicon-user-circle,
.store-header .sicon-shopping-bag,
.store-header i.icon {
    color: white !important;
    fill: white !important;
}

/* Cart count badge */
.s-cart-summary-total,
.s-cart-summary-total b,
header b {
    color: white !important;
}

/* Desktop only: Apply custom layout */
@media (min-width: 769px) {
    /* Make header a flex container with three sections */
    header.custom-header-layout {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: relative !important;
        /* min-height: 170px !important; */
        padding: 0.5rem !important;
    }

    /* Position top navbar on the LEFT side */
    .custom-topnav-layout {
        position: relative !important;
        order: -1 !important; /* Moves to the left */
        background: transparent !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Logo and main content positioned at 75% for better balance */
    header.custom-header-layout > div:not(.top-navbar),
    header.custom-header-layout > .container {
        position: absolute !important;
        left: 75% !important;
        transform: translateX(-50%) !important;
        display: flex !important;
        align-items: center !important;
        width: 50% !important;
    }

    /* Move navbar-brand (logo) more to the left for better visual centering */
    header.custom-header-layout .navbar-brand {
        position: absolute !important;
        left: -5.3rem !important;
        width: auto !important;
        max-width: none !important;
    }

    /* Logo image sizing - desktop base (increased to 150px) */
    header.custom-header-layout .navbar-brand img {
        width: auto !important;
        height: 150px !important;
        max-height: 150px !important;
        max-width: 300px !important;
        object-fit: contain !important;
    }

    /* User/Cart icons stay on the RIGHT */
    header.custom-header-layout > div:last-child {
        order: 1 !important;
        margin-left: auto !important;
    }

    /* Style language selector and search in their new position */
    .custom-topnav-layout salla-search {
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .custom-topnav-layout salla-localization-modal {
        /* Removed display: inline-flex for proper alignment */
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure proper vertical alignment */
    .custom-topnav-layout salla-localization-modal button,
    .custom-topnav-layout button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* ========================================================================
       RTL (Arabic) SPECIFIC ADJUSTMENTS FOR DESKTOP
       ======================================================================== */

    /* RTL: Position top navbar on the RIGHT side (swap left/right) */
    [dir="rtl"] .custom-topnav-layout,
    html[lang="ar"] .custom-topnav-layout {
        order: 1 !important;
    }

    /* RTL: Logo positioned from the RIGHT instead of LEFT */
    [dir="rtl"] header.custom-header-layout > div:not(.top-navbar),
    [dir="rtl"] header.custom-header-layout > .container,
    html[lang="ar"] header.custom-header-layout > div:not(.top-navbar),
    html[lang="ar"] header.custom-header-layout > .container {
        left: auto !important;
        right: 75% !important;
        transform: translateX(50%) !important;
    }

    /* RTL: Move navbar-brand (logo) to the right */
    [dir="rtl"] header.custom-header-layout .navbar-brand,
    html[lang="ar"] header.custom-header-layout .navbar-brand {
        left: auto !important;
        right: -5.3rem !important;
    }

    /* RTL: User/Cart icons on the LEFT */
    [dir="rtl"] header.custom-header-layout > div:last-child,
    html[lang="ar"] header.custom-header-layout > div:last-child {
        order: -1 !important;
        margin-left: 0 !important;
        margin-right: auto !important;
    }
}

/* Mobile only: Keep positioning context for absolute logo */
@media (max-width: 768px) {
    /* Header needs to be relative for absolute logo positioning */
    header.custom-header-layout,
    header.store-header {
        position: relative !important;
        min-height: 120px !important;
    }

    /* Navbar brand container for absolute positioning */
    .navbar-brand {
        position: relative !important;
    }

    .custom-topnav-layout {
        position: static !important;
        transform: none !important;
        display: block !important;
        z-index: auto !important;
    }
}

/* Hide mobile menu duplicates on all screen sizes */
#mobile-menu salla-localization-modal,
#mobile-menu salla-search,
.mobile-menu salla-localization-modal,
.mobile-menu salla-search,
nav.mm-spn--main salla-localization-modal,
nav.mm-spn--main salla-search {
    display: none !important;
}

/* ============================================================================
   5. RESPONSIVE DESIGN FOR DETAILS BUTTON
   ============================================================================ */

@media (max-width: 768px) {
    .custom-buy-now-btn {
        padding: 0.875rem 2rem;
        font-size: 1rem;
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .custom-buy-now-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
}

/* ============================================================================
   6. RESPONSIVE LOGO SIZING (ALL BREAKPOINTS)
   ============================================================================ */

/* Extra small devices (phones, up to 479px) */
@media (max-width: 479px) {
    .navbar-brand img {
        max-width: 300px !important;
        height: 135px !important;
        max-height: 200px !important;
        object-fit: contain !important;
        position: absolute !important;
        left: -3em !important;
    }

    /* RTL: Logo positioned from the right */
    [dir="rtl"] .navbar-brand img,
    html[lang="ar"] .navbar-brand img {
        left: auto !important;
        right: -3em !important;
    }
}

/* Small devices (landscape phones, 480px and up) */
@media (min-width: 480px) and (max-width: 768px) {
    .navbar-brand img {
        max-width: 300px !important;
        height: 150px !important;
        max-height: 200px !important;
        object-fit: contain !important;
        position: absolute !important;
        left: -3em !important;
    }

    /* RTL: Logo positioned from the right */
    [dir="rtl"] .navbar-brand img,
    html[lang="ar"] .navbar-brand img {
        left: auto !important;
        right: -3em !important;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .navbar-brand img {
        max-width: 300px !important;
        height: 135px !important;
        max-height: 200px !important;
        object-fit: contain !important;
        position: absolute !important;
        left: 2em !important;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .navbar-brand img {
        max-width: 320px !important;
        height: 120px !important;
        max-height: 120px !important;
        object-fit: contain !important;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .navbar-brand img {
        max-width: 350px !important;
        height: 140px !important;
        max-height: 140px !important;
        object-fit: contain !important;
    }
}