/**
 * Desktop Navigation Menu Styles
 * Hyvä Theme - Custom Mega Menu
 */

/* ========================================
   MAIN CONTAINER
   ======================================== */
.menu-desktop-container {
    background-color: #e1e8f0;
}

/* ========================================
   MEGA MENU DROPDOWN
   ======================================== */
.mega-menu {
    min-width: 300px;
    max-width: 900px;
}

.mega-menu-grid {
    display: grid;
    gap: 1rem 2rem; /* gap-y-4 gap-x-8 */
}

/* ========================================
   BRANDS DROPDOWN
   ======================================== */
.brands-dropdown {
    width: 680px;
}

/* ========================================
   BRAND CARDS
   ======================================== */
.brand-card {
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem;
    overflow: hidden;
    min-height: 110px;
    text-decoration: none;
}

.brand-card-image {
    background-color: #484848;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease;
}

.brand-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-card-footer {
    background-color: #676767;
    padding: 0.5rem;
    text-align: center;
    transition: background-color 0.25s ease;
}

.brand-card-footer span {
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Brand Card Hover Effects */
.brand-card:hover .brand-card-image {
    background-color: #676767;
}

.brand-card:hover .brand-card-footer {
    background-color: #484848;
}

/* ========================================
   LEVEL 2 LINKS (Bold Headers)
   ======================================== */
.menu-level-2-link {
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    color: #111827; /* text-gray-900 */
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

.menu-level-2-link:hover {
    background-color: #1da3dd !important;
    color: #ffffff !important;
}

/* ========================================
   LEVEL 3 LINKS (Sub-items)
   ======================================== */
.menu-level-3-link {
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem; /* text-sm */
    color: #4b5563; /* text-gray-600 */
    transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

.menu-level-3-link:hover {
    background-color: #1da3dd !important;
    color: #ffffff !important;
}

/* ========================================
   DEALS LINK (Special Styling)
   ======================================== */
.menu-deals-link {
    font-weight: 700;
    color: #b91c1c !important; /* text-red-700 */
    text-transform: uppercase;
}

.menu-deals-link:hover {
    color: #991b1b !important; /* darker red */
}

/* ========================================
   ACTIVE MENU STYLING
   ======================================== */
li.level-0[data-active] {
    border-color: var(--color-primary, #1da3dd);
}

li.level-0[data-active] > span > a {
    font-weight: 500;
}

/* Active submenu items */
.menu-level-2-link[aria-current="page"],
.menu-level-3-link[aria-current="page"] {
    text-decoration: underline;
    font-weight: 600;
}

/* ========================================
   DROPDOWN ANIMATIONS
   ======================================== */
.mega-menu,
.brands-dropdown {
    transform-origin: top;
}

/* Alpine.js transitions handled via x-transition */

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Large screens (1280px and below) */
@media (max-width: 1280px) {
    .mega-menu {
        max-width: 700px;
    }
    
    .brands-dropdown {
        width: 580px;
    }
}

/* Medium screens (1024px and below) */
@media (max-width: 1024px) {
    .mega-menu {
        max-width: 500px;
    }
    
    .brands-dropdown {
        width: 480px;
    }
    
    .brands-dropdown .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   ACCESSIBILITY FOCUS STATES
   ======================================== */
.menu-level-2-link:focus,
.menu-level-3-link:focus {
    outline: 2px solid #1da3dd;
    outline-offset: 2px;
}

.brand-card:focus {
    outline: 2px solid #1da3dd;
    outline-offset: 2px;
}

/* Level 0 focus */
li.level-0 > span > a:focus {
    outline: 2px solid #1da3dd;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

li.level-0 > span > button:focus {
    outline: 2px solid #1da3dd;
    outline-offset: 2px;
}

/* ========================================
   CHEVRON ICON STYLING
   ======================================== */
li.level-0 svg {
    transition: transform 0.2s ease-out;
}

/* ========================================
   SCROLLBAR STYLING (for long menus)
   ======================================== */
.mega-menu::-webkit-scrollbar {
    width: 6px;
}

.mega-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mega-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mega-menu::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ========================================
   UTILITY CLASSES (if needed)
   ======================================== */
.menu-hidden {
    display: none !important;
}

.menu-visible {
    display: block !important;
}

    /* Center menu and prevent wrapping */
    .menu-desktop-container {
        width: 100%;
    }
    
    .menu-desktop-container .menu-wrapper {
        width: 100%;
    }
    
    .menu-desktop-container nav {
        width: 100%;
    }
    
    /* Main menu styles - NEVER wraps, FULL TEXT always visible */
    .menu-desktop-container ul.main-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: nowrap !important;
        gap: 2rem;
        white-space: nowrap !important;
        width: 100%;
    }
    
    /* Menu items - don't shrink items */
    .menu-desktop-container ul.main-menu > li {
        flex-shrink: 0;
    }
    
    .menu-desktop-container ul.main-menu > li > span {
        display: flex;
        align-items: center;
        white-space: nowrap;
    }
    
    /* Full text - no ellipsis */
    .menu-desktop-container ul.main-menu > li > span > a.level-0 {
        white-space: nowrap;
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }
    
    .menu-desktop-container ul.main-menu > li > span > button {
        padding: 0.25rem;
        flex-shrink: 0;
    }
    
    /* XXL screens (1536px+) - Maximum spacing */
    @media (min-width: 1536px) {
        .menu-desktop-container ul.main-menu {
            gap: 2.5rem;
        }
        .menu-desktop-container ul.main-menu > li > span > a.level-0 {
            font-size: 1rem;
            padding: 0.5rem 1rem;
        }
    }
    

    /* XL screens (1280px - 1535px) - Less space */
@media (min-width: 1280px) and (max-width: 1535px) {
    .menu-desktop-container ul.main-menu {
        gap: 1.125rem;
    }
    .menu-desktop-container ul.main-menu > li > span > a.level-0 {
        font-size: 0.875rem;
        padding: 0.5rem 0.375rem;
    }
}

/* Large screens (1150px - 1279px) - Less space */
@media (min-width: 1150px) and (max-width: 1279px) {
    .menu-desktop-container ul.main-menu {
        gap: 0.75rem;
    }
    .menu-desktop-container ul.main-menu > li > span > a.level-0 {
        font-size: 0.85rem;
        padding: 0.5rem 0.25rem;
    }
}
    
    /* Medium-large screens (1080px - 1149px) - Smaller font */
    @media (min-width: 1080px) and (max-width: 1149px) {
        .menu-desktop-container ul.main-menu {
            gap: 0.625rem;
        }
        .menu-desktop-container ul.main-menu > li > span > a.level-0 {
            font-size: 0.85rem;
            padding: 0.5rem 0.25rem;
        }
        .menu-desktop-container ul.main-menu > li > span > button {
            padding: 0.125rem;
        }
        .menu-desktop-container ul.main-menu > li > span > button svg {
            width: 16px;
            height: 16px;
        }
    }

/* Smaller screens (1024px - 1079px) - More space */
@media (min-width: 1024px) and (max-width: 1079px) {
    .menu-desktop-container ul.main-menu {
        gap: 1rem;
    }
    .menu-desktop-container ul.main-menu > li > span > a.level-0 {
        font-size: 0.85rem;
        padding: 0.5rem 0.375rem;
    }
    .menu-desktop-container ul.main-menu > li > span > button {
        padding: 0.2rem;
    }
    .menu-desktop-container ul.main-menu > li > span > button svg {
        width: 14px;
        height: 14px;
    }
}