/* ===========================
   MEGA MENU STYLES (MODERN v2)
   =========================== */

/* Dropdown Container */
.mega-dropdown {
    position: relative !important;
}

/* The actual dropdown box */
.mega-menu-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 750px;
    /* Slightly wider for modern spacing */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: visible;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-top: 10px;
    color: var(--text-dark);
    /* Ensure text is dark in Light Mode */
    text-align: left;
}

/* Invisible Bridge */
.mega-menu-content::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.mega-dropdown:hover .mega-menu-content {
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Sidebar (Left Column) */
.mega-sidebar {
    width: 200px;
    background: rgba(248, 250, 252, 0.8);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.mega-cat-btn {
    text-align: left;
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #475569 !important;
    /* Force dark grey for light mode */
    transition: all 0.2s ease;
    font-size: 0.95rem;
    width: 100%;
    position: relative;
    font-family: var(--font-heading);
    border-left: 3px solid transparent;
}

.mega-cat-btn:hover {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.mega-cat-btn.active {
    color: var(--primary-color);
    background: #fff;
    border-left-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Content Area (Right Column) */
.mega-links-container {
    flex: 1;
    padding: 2rem;
    min-height: 350px;
    background: transparent;
}

.mega-links-group {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mega-links-group.active {
    display: block;
}

.mega-group-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
    opacity: 0.5;
}

/* Modern Grid with "Card" Items */
.mega-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.mega-grid a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.95rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    font-weight: 600;
}

/* Icon Container Style */
.mega-grid a i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

/* Hover Effects */
.mega-grid a:hover {
    background: #fff;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
}

.mega-grid a:hover i {
    background: var(--primary-color);
    color: #fff;
    transform: scale(1.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   DARK MODE ADAPTION
   =========================== */
[data-theme="dark"] .mega-menu-content {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .mega-sidebar {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .mega-cat-btn {
    color: #94a3b8 !important;
    /* Force light text in dark mode to override light mode rule */
}

[data-theme="dark"] .mega-cat-btn:hover,
[data-theme="dark"] .mega-cat-btn.active {
    background: #1e293b;
    color: #fff !important;
    /* Force white on active/hover */
    box-shadow: inset 4px 0 0 var(--accent-color);
    border-left-color: var(--accent-color);
}

[data-theme="dark"] .mega-links-container {
    background: transparent;
}

[data-theme="dark"] .mega-group-title {
    color: var(--text-muted);
}

[data-theme="dark"] .mega-grid a {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .mega-grid a i {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

[data-theme="dark"] .mega-grid a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .mega-grid a:hover i {
    background: var(--accent-color);
    color: #0f172a;
    /* Dark text on bright accent */
}

/* ===========================
   MOBILE ACCORDION STYLES (MODERN v2)
   =========================== */

.mobile-accordion {
    margin-bottom: 0.8rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.mobile-accordion[open] {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: rgba(79, 70, 229, 0.1);
}

.mobile-accordion summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    background: transparent;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.mobile-accordion summary::-webkit-details-marker {
    display: none;
}

.mobile-accordion[open] summary {
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary-color);
    border-bottom: 1px solid rgba(79, 70, 229, 0.1);
}

.mobile-accordion .arrow {
    font-size: 0.8rem;
    color: var(--text-light);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-accordion[open] .arrow {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* Content Area - GRID LAYOUT */
.accordion-content {
    background: #fff;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

/* Links as "Cards" */
.accordion-content .drawer-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.5rem;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.accordion-content .drawer-link i {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
    filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.2));
}

.accordion-content .drawer-link:hover,
.accordion-content .drawer-link:active {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
    color: var(--primary-color);
}

/* Standalone Links (Single Row) */
.drawer-link.standalone {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    padding: 1rem 1.2rem;
    margin: 0.5rem 0;
    gap: 1rem;
    font-weight: 600;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.drawer-link.standalone i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}


/* Dark Mode Adjustments */
[data-theme="dark"] .mobile-accordion {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .mobile-accordion[open] {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
}

[data-theme="dark"] .mobile-accordion summary {
    color: #e2e8f0;
}

[data-theme="dark"] .mobile-accordion[open] summary {
    background: rgba(245, 158, 11, 0.1);
    /* Gold/Accent tint */
    color: var(--accent-color);
    border-bottom-color: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .mobile-accordion[open] .arrow {
    color: var(--accent-color);
}

[data-theme="dark"] .accordion-content {
    background: #1e293b;
}

[data-theme="dark"] .accordion-content .drawer-link {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .accordion-content .drawer-link i {
    color: var(--accent-color);
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.2));
}

[data-theme="dark"] .accordion-content .drawer-link:hover,
[data-theme="dark"] .accordion-content .drawer-link:active {
    background: #334155;
    border-color: var(--accent-color);
    color: #fff;
}

[data-theme="dark"] .drawer-link.standalone {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}