/* ============================================
   MEGA MENU STYLES
   Dropdown menu for Services navigation
   ============================================ */

/* Navigation item with dropdown */
.nav-item.has-dropdown {
    position: relative;
}

.nav-item.has-dropdown>.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Dropdown arrow indicator */
.nav-link .dropdown-arrow {
    display: inline-block;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.nav-item.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Mega Menu Container */
.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    background: var(--surface-color, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    margin-top: 0.5rem;
    padding: var(--space-sm, 12px) 0;
}

/* Show mega menu on hover */
.nav-item.has-dropdown:hover .mega-menu,
.nav-item.has-dropdown:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mega Menu Header */
.mega-menu-header {
    padding: var(--space-sm, 12px) var(--space-md, 16px);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    margin-bottom: var(--space-xs, 8px);
}

.mega-menu-title {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

/* Mega Menu Grid */
.mega-menu-grid {
    display: grid;
    gap: 0;
}

/* Service Item */
.mega-menu-item {
    padding: var(--space-sm, 12px) var(--space-md, 16px);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm, 12px);
    text-decoration: none;
    color: var(--text-color, #1f2937);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.mega-menu-item:hover,
.mega-menu-item:focus {
    background: var(--primary-color-10, rgba(37, 99, 235, 0.05));
    border-left-color: var(--primary-color, #2563eb);
    outline: none;
}

/* Service Icon */
.mega-menu-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color-10, rgba(37, 99, 235, 0.1));
    border-radius: var(--radius-sm, 6px);
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.mega-menu-item:hover .mega-menu-icon {
    background: var(--primary-color, #2563eb);
    transform: scale(1.1);
}

.mega-menu-item:hover .mega-menu-icon {
    filter: brightness(0) invert(1);
}

/* Service Content */
.mega-menu-content {
    flex: 1;
    min-width: 0;
}

.mega-menu-item-title {
    font-size: var(--font-size-base, 0.9375rem);
    font-weight: 600;
    color: var(--text-color, #1f2937);
    margin: 0 0 0.25rem;
    transition: color 0.2s ease;
}

.mega-menu-item:hover .mega-menu-item-title {
    color: var(--primary-color, #2563eb);
}

.mega-menu-item-desc {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-muted, #6b7280);
    margin: 0;
    line-height: 1.4;
}

/* View All Link */
.mega-menu-footer {
    padding: var(--space-xs, 8px) var(--space-md, 16px);
    border-top: 1px solid var(--border-color, #e5e7eb);
    margin-top: var(--space-xs, 8px);
}

.mega-menu-view-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs, 8px) var(--space-sm, 12px);
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--primary-color, #2563eb);
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
    transition: all 0.2s ease;
}

.mega-menu-view-all:hover {
    background: var(--primary-color-10, rgba(37, 99, 235, 0.05));
}

.mega-menu-view-all::after {
    content: '→';
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.mega-menu-view-all:hover::after {
    transform: translateX(4px);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet and below */
@media (max-width: 1024px) {
    .mega-menu {
        min-width: 260px;
    }

    .mega-menu-icon {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }
}

/* Mobile */
@media (max-width: 767px) {

    /* On mobile, mega menu becomes a panel in the mobile nav */
    .nav-item.has-dropdown {
        position: relative;
    }

    .mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin-top: 0;
        padding: 0;
        background: transparent;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-item.has-dropdown.active .mega-menu {
        max-height: 500px;
    }

    .mega-menu-header {
        display: none;
    }

    .mega-menu-item {
        padding: var(--space-sm, 12px) var(--space-lg, 24px);
        border-left: none;
        border-bottom: 1px solid var(--border-color, #e5e7eb);
    }

    .mega-menu-item:last-child {
        border-bottom: none;
    }

    .mega-menu-footer {
        border-top: 1px solid var(--border-color, #e5e7eb);
        margin-top: var(--space-sm, 12px);
        padding-top: var(--space-sm, 12px);
    }

    /* Mobile dropdown toggle */
    .nav-link .dropdown-arrow {
        margin-left: auto;
    }

    .nav-item.has-dropdown.active .dropdown-arrow {
        transform: rotate(180deg);
    }
}

/* Dark mode support (if you have it) */
@media (prefers-color-scheme: dark) {
    .mega-menu {
        background: #1f2937;
        border-color: #374151;
    }

    .mega-menu-item {
        color: #f9fafb;
    }

    .mega-menu-item:hover {
        background: rgba(59, 130, 246, 0.1);
    }

    .mega-menu-item-title {
        color: #f9fafb;
    }

    .mega-menu-item-desc {
        color: #9ca3af;
    }
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {

    .mega-menu,
    .mega-menu-icon,
    .dropdown-arrow {
        transition: none;
    }
}