/* Hyvä Theme Mega Menu CSS */
/* Compatible with Tailwind CSS and Hyvä structure */
/* For bonline/bnaia theme */

/* Mega Menu Dropdown Container */
.mega-bnaia-dropdown {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    border: 1px solid #e5e7eb;
    min-width: 800px;
    max-width: 1200px;
}

/* Show mega menu on hover - works with Hyvä's hover states */
.navigation-item:hover .mega-bnaia-dropdown,
.nav-item:hover .mega-bnaia-dropdown,
[x-data]:hover .mega-bnaia-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mega Menu Content Grid */
.mega-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

/* Individual Columns */
.mega-column {
    padding: 20px;
    border-left: 1px solid #f3f4f6;
}

.mega-column:first-child {
    border-left: none;
}

/* Category Sections */
.mega-category {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f3f4f6;
}

.mega-category:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* Category Titles */
.category-title {
    display: block;
    font-weight: 700;
    font-size: 16px;
    color: #1f2937;
    text-decoration: none;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 2px solid #3b82f6;
    transition: all 0.3s ease;
    position: relative;
}

.category-title:hover {
    color: #3b82f6;
    text-decoration: none;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

.category-title:hover::after {
    width: 100%;
}

/* Category Lists */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin: 0;
    padding: 0;
}

.category-list > li > a {
    display: block;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 0;
    transition: all 0.3s ease;
    position: relative;
    padding-right: 15px;
}

.category-list > li > a::before {
    content: '▶';
    position: absolute;
    right: 0;
    color: #3b82f6;
    font-size: 10px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.category-list > li > a:hover {
    color: #3b82f6;
    text-decoration: none;
    padding-right: 20px;
}

.category-list > li > a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* Submenu Styling */
.has-submenu > a {
    position: relative;
}

.has-submenu > a i.fa-chevron-left {
    float: left;
    margin-left: 8px;
    font-size: 10px;
    transition: transform 0.3s ease;
}

.has-submenu:hover > a i.fa-chevron-left {
    transform: rotate(-90deg);
}

.submenu {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0 0 0 15px;
    border-right: 2px solid #e5e7eb;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.has-submenu:hover .submenu {
    max-height: 300px;
}

.submenu li {
    margin: 4px 0;
}

.submenu a {
    display: block;
    color: #9ca3af;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 0;
    transition: all 0.3s ease;
    position: relative;
}

.submenu a:hover {
    color: #8b5cf6;
    text-decoration: none;
    padding-right: 12px;
}

.submenu a::before {
    content: '→';
    position: absolute;
    right: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 10px;
}

.submenu a:hover::before {
    opacity: 1;
}

/* Responsive Design for Hyvä */
@media (max-width: 1024px) {
    .mega-bnaia-dropdown {
        min-width: 600px;
        max-width: 90vw;
        right: -100px;
    }
    
    .mega-content {
        grid-template-columns: repeat(2, 1fr);
        max-height: 60vh;
    }
    
    .mega-column {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .mega-bnaia-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        border: none;
        min-width: auto;
        max-width: none;
        background: #f9fafb;
    }
    
    .mega-content {
        grid-template-columns: 1fr;
        max-height: none;
        overflow-y: visible;
    }
    
    .mega-column {
        padding: 10px 15px;
        border-left: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .mega-column:last-child {
        border-bottom: none;
    }
    
    .category-title {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .category-list > li > a {
        font-size: 13px;
        padding: 5px 0;
    }
    
    .submenu {
        padding-right: 10px;
        border-right: 1px solid #e5e7eb;
    }
}

@media (max-width: 480px) {
    .mega-column {
        padding: 8px 12px;
    }
    
    .category-title {
        font-size: 14px;
    }
    
    .category-list > li > a {
        font-size: 12px;
    }
    
    .submenu a {
        font-size: 11px;
    }
}

/* Hyvä Theme Integration Helpers */
/* Works with Alpine.js x-show and x-transition */
[x-cloak] .mega-bnaia-dropdown {
    display: none;
}

/* RTL Support for Arabic content */
[dir="rtl"] .mega-bnaia-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .mega-column {
    border-left: none;
    border-right: 1px solid #f3f4f6;
}

[dir="rtl"] .mega-column:first-child {
    border-right: none;
}

[dir="rtl"] .category-list > li > a::before {
    content: '◀';
    right: auto;
    left: 0;
}

[dir="rtl"] .category-list > li > a:hover {
    padding-right: 0;
    padding-left: 20px;
}

[dir="rtl"] .has-submenu > a i.fa-chevron-left {
    float: right;
    margin-left: 0;
    margin-right: 8px;
}

[dir="rtl"] .submenu {
    padding: 0 15px 0 0;
    border-right: none;
    border-left: 2px solid #e5e7eb;
}

[dir="rtl"] .submenu a::before {
    content: '←';
    right: auto;
    left: 0;
}

[dir="rtl"] .submenu a:hover {
    padding-right: 0;
    padding-left: 12px;
}

/* Smooth scrolling for long menus */
.mega-content {
    scroll-behavior: smooth;
}

/* Custom scrollbar styling */
.mega-content::-webkit-scrollbar {
    width: 6px;
}

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

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

.mega-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Loading state support */
.mega-bnaia-dropdown.loading {
    opacity: 0.6;
    pointer-events: none;
}

.mega-bnaia-dropdown.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 