/* =========================================
   Header & Navigation
   ========================================= */

/* --- Top Bar --- */
.top-bar {
    background-color: #F7FAFC;
    padding: 8px 0;
    font-family: var(--font-secondary);
    font-size: 10px;
    color: #6B7280;
    border-bottom: 1px solid #E5E7EB;
}

.top-bar-content {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.top-menu-list {
    display: flex;
    gap: 24px;
}

.top-menu-list li a {
    color: #6B7280;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s ease;
}

.top-menu-list li a:hover {
    color: var(--color-primary);
}

/* --- Global Header --- */
.global-header {
    position: relative;
    z-index: 1000;
}

/* --- Main Header --- */
.main-header {
    background-color: #ffffff;
    padding: 0;
    position: relative;
    z-index: 100;
    /* box-shadow: 0 4px 20px rgba(0,0,0,0.05); */
}

.main-header .container {
    position: relative; /* Context for Mega Menu */
}

.main-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 90px; /* Consistent height */
}

/* Column 1: Logo */
.header-col-left {
    flex-shrink: 0;
}

.logo img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Column 2: Navigation + Actions */
.header-col-right {
    display: flex;
    align-items: center;
    gap: 40px;
}

/* Navigation */
.main-navigation {
    height: 100%;
    display: flex;
    align-items: center;
}

.main-menu-list {
    display: flex;
    gap: 32px;
    align-items: center;
    margin: 0;
    padding: 0;
    height: 100%;
}

.main-menu-list > li {
    display: flex;
    align-items: center;
    height: 100%;
}

.main-menu-list > li > a {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.main-menu-list > li > a i {
    font-size: 12px;
    color: #9CA3AF;
    transition: transform 0.2s ease;
}

.main-menu-list > li:hover > a,
.main-menu-list > li.current-menu-item > a,
.main-menu-list > li.current_page_item > a {
    color: #6b7280;
}

.main-menu-list > li:hover > a i,
.main-menu-list > li.current-menu-item > a i,
.main-menu-list > li.current_page_item > a i {
    color: #6b7280;
}

.main-menu-list > li:hover > a i {
    transform: rotate(180deg);
}

/* --- Mega Menu Styles --- */
.mega-menu-item {
    position: static !important;
}

/* Ensure parent containers don't restrict full width */
.main-header .container {
    position: static !important;
}

.mega-menu-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #EAECF0;
    box-shadow: 0 20px 24px -4px rgba(16, 24, 40, 0.08), 0 8px 8px -4px rgba(16, 24, 40, 0.03);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease-out;
    z-index: 1100; /* Increased z-index */
}

.mega-menu-item:hover .mega-menu-wrapper {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-content {
    display: flex;
    padding: 20px 0;
    gap: 40px; /* Reduced from 64px to give more space to columns */
}

/* Mega Menu Sidebar */
.mega-menu-sidebar {
    width: 340px;
    flex-shrink: 0;
    padding: 24px;
    background: #F7FAFD;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.mega-menu-sidebar h3 {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: 18px;
    color: #101828;
    margin-bottom: 8px; /* Reduced spacing */
}

/* Industry Keywords List */
.industry-keywords {
    font-size: 13px;
    color: #98A2B3;
    line-height: 1.6;
    margin-bottom: 24px;
    font-style: italic;
}

.mega-menu-sidebar p {
    font-size: 14px;
    color: #667085;
    line-height: 1.6;
    margin-bottom: 24px;
}

.sidebar-btn {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    color: #003366; /* Dark Blue */
    text-decoration: none;
}

.sidebar-btn i {
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.sidebar-btn:hover i {
    transform: translateX(4px);
}

/* Mega Menu Grid System */
.mega-menu-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Default to 3 columns for Products */
    gap: 24px; /* Increased gap */
    align-content: start;
}

/* 2-Column Grid */
.mega-menu-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 32px;
    row-gap: 24px;
}

/* 3-Column Grid */
.mega-menu-grid.col-3 {
    grid-template-columns: repeat(3, 1fr);
    column-gap: 24px;
    row-gap: 24px;
}

/* Horizontal Card Style (Used in Services/Industries) */
.mega-menu-grid.col-3 .mega-card {
    flex-direction: row;
    align-items: flex-start;
    padding: 20px;
}

.mega-menu-grid.col-3 .mega-card .mega-icon {
    margin-right: 16px;
    margin-bottom: 0;
    width: 44px;
    height: 44px;
    font-size: 18px;
}

/* Mega Card Component */
.mega-card {
    display: flex;
    flex-direction: column; /* Default: Column for Products */
    align-items: flex-start;
    padding: 24px;
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid #EAECF0;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Horizontal Card (for Services/2-col) */
.mega-menu-grid.col-2 .mega-card {
    flex-direction: row;
    align-items: flex-start;
    padding: 16px;
}

.mega-menu-grid.col-2 .mega-card .mega-icon {
    margin-right: 16px;
    margin-bottom: 0;
    width: 44px;
    height: 44px;
    font-size: 18px;
}

/* Hover State for Link Cards */
a.mega-card:hover {
    background-color: #ffffff;
    border-color: #EAECF0;
    box-shadow: 0 10px 15px -3px rgba(16, 24, 40, 0.1), 0 4px 6px -2px rgba(16, 24, 40, 0.05);
}

/* Icon Box */
.mega-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Circular */
    background-color: #ffffff;
    color: var(--color-primary);
    font-size: 20px;
    margin-bottom: 20px;
    margin-right: 0;
    transition: all 0.2s ease;
}

.mega-icon.dashed-icon {
    border: 1px dashed #D0D5DD;
    background-color: #ffffff;
}

a.mega-card:hover .mega-icon {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
    transform: scale(1.05);
}

/* Card Content */
.mega-details {
    flex: 1;
    width: 100%;
}

.mega-details h4 {
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 700;
    color: #101828;
    margin-bottom: 8px;
    line-height: 1.4;
}

a.mega-card:hover .mega-details h4 {
    color: var(--color-primary);
}

.mega-details p {
    font-size: 14px;
    color: #667085;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Read More Link (restored) */
.read-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.read-more i {
    font-size: 11px;
    transition: transform 0.2s ease;
}

a.mega-card:hover .read-more i {
    transform: translateX(4px);
}

/* App Buttons (Inside Card & Sidebar) */
.app-buttons {
    display: flex;
    gap: 12px;
    margin-top: auto; /* Push to bottom if flex column */
    flex-wrap: wrap;
}

.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    background-color: #ffffff;
    border: 1px solid #D0D5DD;
    border-radius: 100px; /* Pill shape */
    text-decoration: none;
    transition: all 0.2s;
    min-width: 110px;
}

.btn-app i {
    font-size: 16px;
    color: #101828;
}

.btn-app:hover {
    background-color: #F9FAFB;
    border-color: #B2DDFF;
    color: var(--color-primary);
}

.btn-app:hover i {
    color: var(--color-primary);
}

/* Specific adjustment for small buttons if needed, currently same style */
.app-buttons.small .btn-app {
    padding: 8px 14px;
    font-size: 12px;
}

/* Sidebar "View All" Button Styles if not defined */
.btn-primary-dark {
    display: inline-block;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn-primary-dark:hover {
    color: #002244;
}

/* Sidebar List */
.mega-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.mega-list li {
    position: relative;
    padding-left: 16px;
    font-size: 13px;
    color: #667085;
    margin-bottom: 10px;
    line-height: 1.5;
}

.mega-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

/* Compact cards for first mega menu (Our Products) */
.main-menu-list > li.mega-menu-item:first-of-type .mega-card {
    padding: 16px;
}
.main-menu-list > li.mega-menu-item:first-of-type .mega-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-bottom: 12px;
}
.main-menu-list > li.mega-menu-item:first-of-type .mega-details h4 {
    margin-bottom: 6px;
}
.main-menu-list > li.mega-menu-item:first-of-type .mega-details p {
    margin-bottom: 12px;
    line-height: 1.45;
}

/* Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #6B7280;
    transition: color 0.2s ease;
}

.search-toggle:hover {
    color: var(--color-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1.2;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    border: 1px solid transparent;
    height: 44px; /* Explicit height to match input fields if any */
}

.btn-primary:hover {
    background-color: #002244;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(1, 55, 96, 0.15);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #EAECF0;
    box-shadow: 0 20px 24px -4px rgba(16, 24, 40, 0.08);
    z-index: 9999; /* Max z-index */
    display: none;
    padding: 30px 0;
}

.search-dropdown.is-active {
    display: block !important; /* Force display */
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-inner {
    width: 100%;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-form {
    position: relative;
    width: 100%;
}

.search-submit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #6B7280;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px;
    transition: color 0.2s;
}

.search-submit:hover {
    color: var(--color-primary);
}

/* Search Toggle Icons */
.search-toggle .close-icon {
    display: none;
}

.search-toggle.is-active .search-icon {
    display: none;
}

.search-toggle.is-active .close-icon {
    display: inline-block;
}

.search-field {
    width: 100%;
    border: none;
    border-bottom: 2px solid #E5E7EB;
    padding: 20px 0;
    font-family: var(--font-secondary);
    font-size: 17px;
    font-weight: 300;
    color: #111827;
    background: transparent;
    outline: none;
}

.search-field:focus {
    border-bottom-color: var(--color-primary);
}

.search-close {
    position: absolute;
    top: 40px;
    right: 40px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6B7280;
}

.search-close:hover {
    color: #111827;
}

/* --- Mobile Elements (Hidden on Desktop) --- */
.mobile-toggle,
.mobile-drawer,
.mobile-search-container,
.mobile-drawer-backdrop {
    display: none;
}

/* --- Responsive Header --- */
@media (max-width: 1024px) {
    .main-navigation,
    .top-bar {
        display: none;
    }

    .main-header-inner {
        height: 70px;
    }
    
    .search-toggle {
        display: none; /* User didn't request search on mobile, can enable if needed */
    }

    /* Adjust Header Actions */
    .header-actions {
        gap: 16px;
    }

    /* Contact Button Mobile Adjustment */
    .header-actions .btn-primary {
        width: auto;
        padding: 0 16px;
        font-size: 13px;
        height: 40px;
    }

    /* Hamburger Toggle Button */
    .mobile-toggle {
        display: block;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        width: 32px;
        height: 32px;
        position: relative;
        z-index: 2100; /* Above drawer */
    }

    /* Hamburger Animation (Spin-to-X) */
    .hamburger-box {
        width: 24px;
        height: 20px;
        display: inline-block;
        position: relative;
    }

    .hamburger-inner {
        display: block;
        top: 50%;
        margin-top: -1px;
    }

    .hamburger-inner, 
    .hamburger-inner::before, 
    .hamburger-inner::after {
        width: 24px;
        height: 2px;
        background-color: #101828;
        border-radius: 2px;
        position: absolute;
        transition: transform 0.15s ease;
    }

    .hamburger-inner::before, 
    .hamburger-inner::after {
        content: "";
        display: block;
    }

    .hamburger-inner::before {
        top: -8px;
    }

    .hamburger-inner::after {
        bottom: -8px;
    }

    /* Active State (X Shape) */
    .mobile-toggle.is-active .hamburger-inner {
        transform: rotate(45deg);
    }

    .mobile-toggle.is-active .hamburger-inner::before {
        top: 0;
        opacity: 0;
    }

    .mobile-toggle.is-active .hamburger-inner::after {
        bottom: 0;
        transform: rotate(-90deg);
    }

    /* Mobile Drawer */
    .mobile-drawer {
        display: flex; /* Flex layout */
        flex-direction: column;
        position: fixed;
        top: 0;
        left: -100%; /* Slide from Left */
        width: 80%; /* Fallback */
        max-width: 380px; /* "Half screen" on tablet, max width on phone */
        height: 100vh;
        background-color: #ffffff;
        z-index: 2000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0,0,0,0.1); /* Shadow on right side */
    }

    /* @media (min-width: 600px) moved to end of file */

    .mobile-drawer.is-active {
        left: 0;
    }

    /* Drawer Inner */
    .drawer-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* Drawer Header (Logo) */
    .drawer-header {
        padding: 24px;
        border-bottom: 1px solid #EAECF0;
        flex-shrink: 0;
    }

    .drawer-logo img {
        display: block;
        width: 120px;
        height: auto;
    }

    /* Navigation Scroll Area */
    .mobile-navigation {
        flex: 1;
        overflow-y: auto;
    }

    /* Drawer Content */
    .mobile-menu-list {
        padding: 0 24px 24px;
        margin: 0;
        list-style: none;
    }

    .mobile-menu-list > li {
        border-bottom: 1px solid #EAECF0;
    }

    .mobile-menu-list > li > a,
    .mobile-link-wrapper > a {
        display: block;
        padding: 16px 0;
        font-family: var(--font-primary);
        font-size: 16px;
        font-weight: 600;
        color: #101828;
        text-decoration: none;
    }
    
    /* Mobile Search (Sticky Bottom) */
    .mobile-search-container {
        padding: 24px;
        border-top: 1px solid #EAECF0;
        background: #fff;
        flex-shrink: 0;
    }

    .mobile-search-inner {
        position: relative;
    }

    .mobile-search-field {
        width: 100%;
        height: 44px;
        padding: 0 40px 0 16px;
        border: 1px solid #D0D5DD;
        border-radius: 8px;
        font-family: var(--font-primary);
        font-size: 14px;
        color: #101828;
        outline: none;
        transition: border-color 0.2s;
    }

    .mobile-search-field:focus {
        border-color: #7F56D9; /* Primary color fallback */
        box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.1);
    }

    .mobile-search-submit {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: #667085;
        cursor: pointer;
        padding: 8px;
    }

    .mobile-search-submit:hover {
        color: #101828;
    }

    /* Mobile Submenu Accordion */
    .mobile-link-wrapper {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-dropdown-toggle {
        background: none;
        border: none;
        padding: 16px;
        margin-right: -16px; /* Extend hit area */
        cursor: pointer;
        color: #667085;
    }

    .mobile-dropdown-toggle i {
        transition: transform 0.3s ease;
    }

    .mobile-submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        padding-left: 12px;
    }

    .mobile-submenu.is-open {
        max-height: 1000px; /* Arbitrary large height */
        padding-bottom: 16px;
    }

    .mobile-submenu ul {
        list-style: none;
        padding: 0;
        margin: 0;
        border-left: 2px solid #EAECF0;
    }

    .mobile-submenu li a {
        padding: 10px 16px;
        font-size: 14px;
        color: #475467;
        display: block;
        text-decoration: none;
    }

    .mobile-submenu li a:hover {
        color: var(--color-primary);
    }

    /* Backdrop */
    .mobile-drawer-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 1900;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-drawer-backdrop.is-active {
        opacity: 1;
        visibility: visible;
    }
}

/* Responsive Adjustments */
@media (max-width: 1024px) and (min-width: 600px) {
    .mobile-drawer {
        width: 50%;
    }
}
