/**
 * Professional Mega Menu CSS
 * Clean, modern mega menu with Tailwind integration
 */

/* Header Sticky Behavior */
.site-header {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header.is-sticky {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

/* Mega Menu Base */
.mega-menu-item {
    position: relative;
}

.mega-menu-trigger {
    position: relative;
    z-index: 10;
}

/* Mega Menu Dropdown */
.mega-menu-dropdown {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 50;
    width: 100%;
}

.mega-panel-inner {
    border-radius: 32px;
    overflow: hidden;
}

.mega-panel-grid {
    gap: 0;
}

.mega-panel-main {
    background: #fff;
}

.mega-hero {
    min-height: 260px;
}

.mega-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mega-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(6,33,56,0.2) 0%, rgba(6,33,56,0.9) 100%);
}

.mega-hero-content {
    position: absolute;
    inset: auto 0 0 0;
    padding: 2rem;
}

.cert-cta-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 1.5rem;
    align-items: center;
}

.cert-cta-media {
    height: 160px;
}

.cert-cta-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mega-columns {
    margin-top: 1rem;
}

.mega-link-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.1rem 1.25rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(6, 33, 56, 0.05);
}

.mega-link-card:hover {
    border-color: #dbeafe;
    box-shadow: 0 4px 14px rgba(6, 33, 56, 0.08);
    transform: translateY(-2px);
}

.mega-link-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #062138;
    margin-bottom: 0.25rem;
}

.mega-link-card-desc {
    font-size: 0.8rem;
    color: #4b5563;
    line-height: 1.4;
}

.mega-group {
    min-height: 100%;
}

.mega-group-link {
    display: block;
    padding: 0.35rem 0.25rem;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

.mega-group-link:hover {
    background: #f3f4f6;
}

.mega-group-link-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
}

.mega-group-link-desc {
    display: block;
    font-size: 0.7rem;
    color: #6b7280;
    line-height: 1.3;
}

.mega-side-panel {
    background: #f9fafb;
}

.mega-side-link {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #374151;
    text-decoration: none;
}

.mega-side-link:hover {
    color: #0067b1;
}

.mega-menu-dropdown.is-active,
.mega-menu-item:hover .mega-menu-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Dropdown Container */
.mega-menu-content {
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

/* Menu Grid */
.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0;
}

/* Menu Columns */
.mega-menu-column {
    padding: 2rem;
    border-right: 1px solid #f3f4f6;
}

.mega-menu-column:last-child {
    border-right: none;
}

/* Column Headers */
.mega-menu-column h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #062138;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Menu Links */
.mega-menu-link {
    display: flex;
    align-items: start;
    gap: 0.75rem;
    padding: 0.5rem;
    margin: -0.5rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mega-menu-link:hover {
    background: #f9fafb;
}

/* Link Icons */
.mega-menu-icon {
    width: 2rem;
    height: 2rem;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mega-menu-link:hover .mega-menu-icon {
    background: #dbeafe;
    color: #0067b1;
}

.mega-menu-icon svg {
    width: 1rem;
    height: 1rem;
    color: #6b7280;
    transition: color 0.2s ease;
}

.mega-menu-link:hover .mega-menu-icon svg {
    color: #0067b1;
}

/* Link Content */
.mega-menu-link-content {
    flex: 1;
}

.mega-menu-link-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.125rem;
    transition: color 0.2s ease;
}

.mega-menu-link:hover .mega-menu-link-title {
    color: #0067b1;
}

.mega-menu-link-desc {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Featured Section */
.mega-menu-featured {
    background: #f9fafb;
    padding: 1.5rem;
}

.mega-menu-featured-image {
    width: 100%;
    height: 200px;
    background: #e5e7eb;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mega-menu-featured-image svg {
    width: 3rem;
    height: 3rem;
    color: #9ca3af;
}

/* Industries Grid */
.industries-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem;
}

.industry-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.industry-item:hover {
    transform: translateY(-2px);
}

.industry-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.5rem;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.industry-item:hover .industry-icon {
    background: #dbeafe;
    color: #0067b1;
}

.industry-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
}

/* Simple Menu Items */
.simple-menu-item {
    padding: 0.5rem 1rem;
    color: #374151;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.simple-menu-item:hover {
    color: #0067b1;
}

/* Mobile Menu */
#mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    z-index: 9999;
    overflow-y: auto;
    transform: translateX(100%);
}

#mobile-menu.is-active,
#mobile-menu.menu-open {
    transform: translateX(0);
}

/* Mobile Menu Overlay - use ID selector to match HTML */
#mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    pointer-events: auto;
}

#mobile-menu-overlay.hidden {
    display: none;
}

/* Legacy class selector for backwards compatibility */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
}

body.menu-open .mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Toggle */
#mobile-menu-toggle {
    display: none;
    padding: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

#mobile-menu-toggle:hover {
    background: #f9fafb;
}

#mobile-menu-toggle.is-active .menu-icon {
    display: none;
}

#mobile-menu-toggle.is-active .close-icon {
    display: block;
}

#mobile-menu-toggle .close-icon {
    display: none;
}

/* Responsive */
@media (max-width: 1023px) {
    #mobile-menu-toggle {
        display: block;
    }
    
    .desktop-menu {
        display: none !important;
    }
}

/* Remove scrollbar from mega menu */
.mega-menu-dropdown::-webkit-scrollbar {
    display: none;
}

.mega-menu-dropdown {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Ensure dropdown stays within viewport */
.mega-menu-dropdown {
    max-width: 100%;
    margin-left: 0;
}

/* Center the dropdown content */
.mega-menu-dropdown .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 1024px) {
    .mega-menu-dropdown {
        max-width: 1200px;
    }
}

/* CTA Button in header */
.header-cta a {
    
    align-items: center;
    padding: 0.5rem 1rem;
    background: #e1523d;
    color: white;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.header-cta a:hover {
    background: #d73924;
}

/* Moved from inline header styles to reduce on-page CSS */
@media (min-width: 1024px) {
    .desktop-menu {
        display: flex !important;
    }
}

/* Additional mobile menu transforms handled above */

.mega-menu-item:hover .mega-menu-dropdown,
.mega-menu-item:focus-within .mega-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.mega-menu-link:hover {
    background-color: #f9fafb;
    color: #0067b1;
}

.mega-menu-link-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.mega-menu-link-desc {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.mega-menu-dropdown {
    pointer-events: none;
}

.mega-menu-item:hover .mega-menu-dropdown,
.mega-menu-item:focus-within .mega-menu-dropdown {
    pointer-events: auto;
}

@media (min-width: 1024px) {
    .mega-menu-dropdown {
        left: 0 !important;
        right: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
}

.mega-menu-column {
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.mega-menu-column:nth-child(1) { animation-delay: 0.1s; }
.mega-menu-column:nth-child(2) { animation-delay: 0.2s; }
.mega-menu-column:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-header.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* ==========================================
   Services Mega Menu - Sticky Columns
   Column 1 & 3 stay fixed, Column 2 scrolls
   ========================================== */

/* Services mega menu dropdown - prevent parent from scrolling */
[data-service-mega] {
    overflow: hidden !important;
}

/* Services mega menu grid container */
[data-service-mega] > .grid {
    overflow: hidden;
}

/* Column 1 (Left - Parent tabs: Indian Registration, Testing, Quality) */
[data-service-mega] > .grid > div:first-child {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100%;
    overflow-y: auto;
}

/* Column 2 (Center - Submenu items: scrollable) */
[data-service-mega] > .grid > div:nth-child(2) {
    overflow-y: auto;
    max-height: 368px; /* 400px - padding */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

[data-service-mega] > .grid > div:nth-child(2)::-webkit-scrollbar {
    width: 6px;
}

[data-service-mega] > .grid > div:nth-child(2)::-webkit-scrollbar-track {
    background: transparent;
}

[data-service-mega] > .grid > div:nth-child(2)::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

[data-service-mega] > .grid > div:nth-child(2)::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Column 3 (Right - Preview panel with tagline) */
[data-service-mega] > .grid > div:nth-child(3) {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100%;
    overflow-y: auto;
}

/* ==========================================
   Services Mega Menu - L1 Tabs with Taglines
   ========================================== */

/* L1 tab active state - highlight title */
.service-l1-tab.bg-gray-100 span.font-semibold {
    color: #0067b1;
}

/* L1 tab hover state - show tagline color change */
.service-l1-tab:hover span.text-gray-500 {
    color: #4b5563;
}

/* L1 tab active state - tagline slightly darker */
.service-l1-tab.bg-gray-100 span.text-gray-500 {
    color: #6b7280;
}
