/**
 * RBZ Mega Menu Builder - Frontend Styles
 * Navy & Gold RBZ Design System
 */

/* ========== MEGA MENU CONTAINER ========== */
.rbz-mega-menu-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    position: relative;
    margin: 0;
}

.rbz-mega-menu-container {
    position: relative;
}

/* Ensure proper stacking context */
.rbz-mega-menu-wrapper {
    position: relative;
    z-index: 100;
}

.rbz-mega-menu-wrapper > .rbz-mega-tabs {
    position: relative;
    z-index: 1001;
}

.rbz-mega-menu-wrapper > .rbz-mega-panels {
    position: absolute;
    width: 100%;
}

/* ========== TABS ========== */
.rbz-mega-tabs {
    display: flex;
    background: #071448;
    padding: 0;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.rbz-mega-tabs::-webkit-scrollbar {
    display: none;
}

.rbz-mega-tab {
    flex: 0 0 auto;
    min-width: auto;
    padding: 16px 24px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    text-decoration: none;
    font-family: inherit;
}

/* Ensure anchor tabs behave like button tabs */
a.rbz-mega-tab {
    text-decoration: none;
}

/* Dropdown arrow for tabs with submenus */
.rbz-mega-tab.menu-item-has-children .rbz-tab-text::after {
    content: '▼';
    margin-left: 6px;
    font-size: 10px;
    opacity: 0.7;
}

.rbz-mega-tab:hover {
    background: rgba(255, 255, 255, 0.08);
}

.rbz-mega-tab.active {
    background: rgba(230, 173, 27, 0.15);
    color: #e6ad1b;
}

.rbz-tab-icon {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.rbz-tab-text {
    white-space: nowrap;
}

/* ========== PANELS ========== */
.rbz-mega-panels {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(7, 20, 72, 0.15);
    border-top: 1px solid rgba(7, 20, 72, 0.08);
    display: none;
}

.rbz-mega-panels.has-active {
    display: block;
}

.rbz-mega-menu-panel {
    display: none !important;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    min-height: 200px;
}

.rbz-mega-menu-panel.active {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

/* Ensure panels appear above content */
.rbz-mega-panels.has-active {
    display: block;
}

.rbz-mega-menu-content {
    padding: 40px 60px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== COLUMNS ========== */
.rbz-mega-menu-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px;
}

.rbz-mega-column {
    position: relative;
}

.rbz-column-title {
    font-size: 11px;
    font-weight: 700;
    color: #071448;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e6ad1b;
}

.rbz-column-title a,
.rbz-column-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 11px;
}

.rbz-column-title a:hover,
.rbz-column-link:hover {
    color: #e6ad1b;
}

/* ========== SUB MENU ========== */
.rbz-mega-column .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rbz-mega-column .sub-menu li {
    margin-bottom: 8px;
}

.rbz-mega-column .sub-menu a {
    display: block;
    padding: 8px 0;
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s ease;
    position: relative;
    padding-left: 16px;
}

.rbz-mega-column .sub-menu a::before {
    content: '›';
    position: absolute;
    left: 0;
    opacity: 0.5;
    transition: all 0.2s ease;
    color: #e6ad1b;
    font-weight: 700;
    font-size: 16px;
}

.rbz-mega-column .sub-menu a:hover {
    color: #071448;
    padding-left: 20px;
}

.rbz-mega-column .sub-menu a:hover::before {
    opacity: 1;
    left: 4px;
}

/* Featured items */
.rbz-mega-column .menu-item.featured > a {
    background: linear-gradient(135deg, #071448, #0a1d5c);
    color: white;
    font-weight: 600;
}

.rbz-mega-column .menu-item.featured > a:hover {
    background: linear-gradient(135deg, #e6ad1b, #d4a017);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991px) {
    .rbz-mega-menu-columns {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .rbz-mega-menu-content {
        padding: 32px 32px;
    }
    
    .rbz-mega-tab {
        padding: 14px 20px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .rbz-mega-menu-columns {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .rbz-mega-tabs {
        flex-wrap: wrap;
    }
    
    .rbz-mega-tab {
        padding: 12px 18px;
        font-size: 13px;
    }
    
    .rbz-mega-menu-content {
        padding: 28px 24px;
    }
    
    .rbz-column-title {
        font-size: 10px;
        margin-bottom: 12px;
    }
    
    .rbz-column-title a,
    .rbz-column-link {
        font-size: 10px;
    }
    
    .rbz-mega-column .sub-menu a {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .rbz-mega-tab {
        padding: 12px 16px;
        font-size: 12px;
    }
    
    .rbz-tab-icon {
        display: none;
    }
    
    .rbz-mega-menu-content {
        padding: 24px 16px;
    }
    
    .rbz-mega-column .sub-menu a {
        font-size: 12px;
        padding: 6px 0;
        padding-left: 14px;
    }
}

/* ========== LOADING STATE ========== */
.rbz-mega-menu-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

.rbz-mega-menu-panel.loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rbz-mega-menu-panel.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #e6ad1b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== ACCESSIBILITY ========== */
.rbz-mega-tab:focus {
    outline: 2px solid #e6ad1b;
    outline-offset: -2px;
}

.rbz-mega-column .sub-menu a:focus {
    outline: 2px solid #e6ad1b;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .rbz-mega-tabs {
        border-bottom-width: 4px;
    }
    
    .rbz-mega-tab.active::after {
        height: 4px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .rbz-mega-tab,
    .rbz-mega-menu-panel,
    .rbz-mega-column .sub-menu a {
        transition: none;
    }
}
