/* Light Premium Mega Menu Styles - Brand Story Edition */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Roboto:wght@400;500&family=Lora:wght@600;700&display=swap');

.mega-menu-container {
    background: #ffffff !important;
    border-radius: 24px;
    overflow: visible;
    /* Required for the hover bridge */
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.15);
    height: auto;
    margin-top: 0px;
    /* Stick to the navbar */
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    font-family: 'Montserrat', sans-serif;
    position: relative;
    top: -2px;
    /* Slight overlap to prevent hover gaps */
}

/* Localized Hover Bridge: Ensures mouse movement from link to menu stays active */
body.no-scroll {
    overflow: hidden !important;
}

.dropdown-mega {
    position: static;
}

.dropdown-mega>.nav-link {
    position: relative;
}



.mega-split-container {
    display: flex;
    min-height: fit-content;
    /* Reduced from 500px */
    height: auto;
    overflow: visible;
    /* Rounding logic moved here */
    border-radius: 24px;
    background: #fff;
}

/* Generic Column Styles */
.mega-col {
    height: auto;
    overflow: visible;
    padding: 20px 25px;
    /* Reduced vertical padding */
}

/* Sidebar Column (Left) */
.mega-col-1 {
    width: max-content;
    background: #ffffff;
    border-right: 1px solid #f0f0f0;
    /* Match parent rounding */
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
}

/* Content Column (Right) */
.mega-col-2 {
    flex: 1;
    background: #ffffff;
    /* Match parent rounding */
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
}

/* Column Labels (MODELS/TOOLS style) */
.mega-col-header {
    margin-bottom: 10px;
    /* Reduced from 15px */
}

.mega-col-label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Card Style for Navigation (Left Column) */
.mega-item-entry {
    display: block;
    padding: 12px 16px;
    /* Reduced vertical padding */
    border-radius: 16px;
    margin-bottom: 10px;
    /* Reduced from 12px */
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8f9fa;
    border: 2px solid transparent;
}

.mega-item-entry .entry-tag {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #E43D12;
    opacity: 0.6;
    margin-bottom: 4px;
    display: block;
}

.mega-item-entry .entry-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
    display: block;
}

.mega-item-entry .entry-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    display: block;
    font-family: 'Roboto', sans-serif;
}

/* Active/Hover states with Brand Tints */
.mega-item-entry:hover,
.mega-item-entry.active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(228, 61, 18, 0.08);
}

.mega-item-entry.active {
    background: #fff5f3 !important;
    border-color: #fcece9 !important;
}

/* Specific Card Colors for variants if needed */
.mega-item-entry[data-target="spec-metal"]:hover {
    background: #f0f7ff;
    border-color: #e6f1ff;
}

.mega-item-entry[data-target="spec-digital"]:hover {
    background: #fffcf0;
    border-color: #fff9e6;
}

/* List Style for Specialties (Right Column) */
.specialties-pane {
    display: none;
    animation: megaFadeIn 0.4s ease;
}

.specialties-pane.active {
    display: block;
}

.specialty-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Reduced from 10px */
}

.specialty-link {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 12px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    position: relative;
    color: #333;
}

.specialty-grid-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.specialty-grid-links .specialty-link {
    background: #f8f9fa;
    border: 1px solid transparent;
}

.specialty-grid-links .specialty-link:hover {
    background: #fff;
    border-color: #ffe6e0;
    color: #E43D12;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(228, 61, 18, 0.08);
}


/* Specialty Flyout System (Level 3) */
.specialty-item-wrapper {
    position: relative;
}

.flyout-indicator {
    margin-left: auto;
    font-size: 10px;
    color: #ccc;
    transition: all 0.2s ease;
}

.specialty-link:hover .flyout-indicator {
    color: #E43D12;
    transform: translateX(3px);
}

.mega-flyout-menu {
    position: absolute;
    top: 0;
    /* Pushes it completely outside the 700px main box */
    /* Wrapper ends ~25px before box edge, so 100% + 30px ensures it clears the gap */
    left: calc(100% + 30px);
    width: 260px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 30px 20px 70px -15px rgba(0, 0, 0, 0.2);
    padding: 16px;
    display: none;
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.08);
    animation: megaFlyIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.specialty-item-wrapper:hover .mega-flyout-menu {
    display: block;
}

/* Hover Bridge for Flyout */
.mega-flyout-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: -40px;
    /* Bridge covers the new 30px gap + buffer */
    width: 40px;
    height: 100%;
    background: transparent;
}

.flyout-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.flyout-list li {
    margin-bottom: 4px;
}

.flyout-list a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.flyout-list a:hover {
    background: #fff5f3;
    color: #E43D12;
    padding-left: 16px;
}

@keyframes megaFlyIn {
    from {
        opacity: 0;
        transform: translateX(15px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.specialty-link:hover {
    background: #fcfcfc;
}

.specialty-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #f0f0f0;
    margin-right: 15px;
    color: #333;
    font-size: 16px;
    transition: all 0.3s ease;
}

.specialty-link:hover .specialty-icon-box {
    border-color: #E43D12;
    color: #E43D12;
    background: #fff5f3;
}

.specialty-content {
    flex: 1;
}

.specialty-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    display: block;
    margin-bottom: 2px;
}

.specialty-desc {
    font-size: 12px;
    color: #777;
    font-family: 'Roboto', sans-serif;
    display: block;
}

@keyframes megaFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Category Headers - Hiding them for this clean design */
.mega-category-header {
    display: none;
}

.mega-category-items {
    margin-bottom: 10px;
}

/* Desktop Width - Hover Only */
@media (min-width: 992px) {

    /* Create a hover bridge so moving mouse from link to menu doesn't break hover */
    .dropdown-mega>.nav-link::after {
        content: '';
        position: absolute;
        bottom: -15px;
        left: 0;
        width: 100%;
        height: 15px;
        display: block;
        z-index: 10;
        background: transparent;
    }

    /* Use both :hover and .show class for stability */
    .dropdown-mega:hover .mega-menu-container,
    .dropdown-mega.show .mega-menu-container,
    .mega-menu-container.show {
        display: block !important;
        pointer-events: auto;
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .mega-menu-container {
        display: none;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        position: absolute;
        width: 700px;
        left: 50% !important;
        transform: translateX(-50%) translateY(10px);
        z-index: 1000;
        top: 100%;
        transition: all 0.3s ease;
    }

    .mega-menu-container.location-mega-wrapper {
        width: 800px;
    }

    /* Disable Bootstrap's default click behavior on desktop */
    .dropdown-mega .dropdown-toggle::after {
        display: inline-block;
    }

    /* Ensure the nav-link doesn't change color on click if it's not active */
    .dropdown-mega .nav-link:focus {
        color: inherit;
    }
}

/* Global: Hide mobile elements on desktop */
.mobile-menu-close {
    display: none;
}

/* Mobile Menu */
@media (max-width: 991px) {

    /* Hide overlay */
    .mobile-menu-overlay {
        display: none !important;
    }

    /* Mobile navbar - slide from LEFT */
    .navbar-collapse {
        position: fixed !important;
        top: 0 !important;
        left: -300px !important;
        width: 300px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        background: #2a2118 !important;
        z-index: 9999 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        display: block !important;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3) !important;
        padding: 60px 0 20px 0 !important;
    }

    .navbar-collapse.show {
        left: 0 !important;
    }

    .navbar-collapse.collapsing {
        left: -300px !important;
        height: 100vh !important;
        display: block !important;
    }

    .navbar-collapse .navbar-nav {
        padding: 0 !important;
        width: 100% !important;
        flex-direction: column !important;
    }

    .navbar-collapse .nav-item {
        width: 90% !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .navbar-collapse .nav-link {
        padding: 15px 20px !important;
        color: #fff !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        background: transparent !important;
    }

    .navbar-collapse .nav-link:hover,
    .navbar-collapse .nav-link.show {
        color: #E43D12 !important;
    }

    /* Close button */
    .mobile-menu-close {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        background: transparent !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 4px !important;
        font-size: 20px !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        z-index: 10001 !important;
    }

    /* Mega menu dropdown */
    .mega-menu-container {
        position: relative !important;
        width: 100% !important;
        max-height: 0 !important;
        overflow: hidden !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        transition: max-height 0.3s ease !important;
    }

    .mega-menu-container.show {
        max-height: 5000px !important;
        overflow-y: auto !important;
    }

    /* Hide complex structure - show everything as list */
    .mega-split-container {
        display: block !important;
        background: transparent !important;
    }

    .mega-col-1 {
        display: none !important;
    }

    .mega-col-2 {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .mega-col-header {
        display: none !important;
    }

    /* Show ALL specialty panes */
    .specialties-pane {
        display: block !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .specialty-list {
        display: block !important;
    }

    /* Sub-links */
    .specialty-link {
        display: flex !important;
        padding: 12px 20px 12px 35px !important;
        color: #ccc !important;
        text-decoration: none !important;
        background: transparent !important;
        width: 95%;
        flex-wrap: wrap;
    }

    .specialty-link:hover {
        color: #E43D12 !important;
    }

    /* Hide icons and descriptions */
    .specialty-icon-box,
    .specialty-desc {
        display: none !important;
    }

    .specialty-content {
        display: block !important;
    }

    .specialty-title {
        color: inherit !important;
    }

    /* Flyout arrow */
    .flyout-indicator {
        display: inline-block !important;
        margin-left: 10px !important;
        color: #888 !important;
    }

    .specialty-item-wrapper.active .flyout-indicator {
        color: #E43D12 !important;
    }

    /* Flyout sub-submenu */
    .mega-flyout-menu {
        display: none !important;
        position: relative !important;
        width: 100% !important;
        left: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .specialty-item-wrapper.active .mega-flyout-menu {
        display: block !important;
    }

    .flyout-list {
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }

    .flyout-list li {
        margin: 0 !important;
    }

    .flyout-list a {
        display: block !important;
        padding: 10px 20px 10px 55px !important;
        color: #aaa !important;
        text-decoration: none !important;
    }

    .flyout-list a:hover {
        color: #E43D12 !important;
    }

    /* Location grid links */
    .specialty-grid-links {
        display: block !important;
    }

    .specialty-grid-links .specialty-link {
        display: block !important;
        padding: 12px 20px 12px 35px !important;
        color: #ccc !important;
        background: transparent !important;
    }

    .specialty-grid-links .specialty-link:hover {
        color: #E43D12 !important;
    }

    /* Mobile Category Header - Simple Version */
    .mobile-mega-section-header {
        padding: 15px 20px !important;
        margin-left: 15px !important;
        /* Align with main menu items */
        background: transparent !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    .mobile-cat-title {
        color: #fff !important;
        text-decoration: none !important;
        font-weight: 400 !important;
        font-size: 17px !important;
        /* Slightly smaller to fit better */
        flex: 1;
        font-family: 'Montserrat', sans-serif;
    }

    .mobile-cat-toggle {
        padding: 5px 15px;
        color: #fff !important;
        opacity: 0.8;
        cursor: pointer;
    }

    .mobile-cat-toggle i {
        font-size: 14px;
        transition: transform 0.3s ease;
    }

    .mobile-mega-section-header.active .mobile-cat-toggle i {
        transform: rotate(180deg);
    }

    .mobile-mega-collapsible {
        display: none;
        margin-left: 50px;
        /* Stronger indentation for clear hierarchy */
        border-left: 1px solid rgba(228, 61, 18, 0.5);
        /* Subtle vertical line */
        padding-left: 5px;
        margin-bottom: 10px;
        margin-top: 5px;
    }

    .mobile-mega-section-header.active+.mobile-mega-collapsible {
        display: block;
    }

    /* Specialty items inside mobile collapsible */
    .mobile-mega-collapsible .specialty-link,
    .mobile-mega-collapsible .specialty-grid-links .specialty-link {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 15px !important;
        /* Tighter padding for mobile */
        color: #fff !important;
        font-size: 15px !important;
        font-weight: 300 !important;
        border: none !important;
        opacity: 0.85;
        text-decoration: none !important;
        background: transparent !important;
        width: 100% !important;
    }

    .mobile-mega-collapsible .specialty-link::after {
        content: '\f054';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 11px;
        opacity: 0.5;
        margin-left: 10px;
    }

    .specialty-grid-links {
        display: block !important;
    }

    .specialty-grid-links .specialty-link:hover {
        /* background: #fff; */
        border-color: none;
        color: #E43D12;
        transform: unset;
        box-shadow: unset;
    }

    /* Fix for standard dropdowns (About Us) in mobile menu */
    .dropdown-menu {
        background: transparent !important;
        border: none !important;
        padding-left: 20px !important;
        box-shadow: none !important;
        margin-top: 0 !important;
        position: static !important;
        float: none !important;
        width: 100% !important;
        transform: none !important;
        display: none;
    }

    .dropdown-menu.show {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .dropdown-item {
        color: #fff !important;
        padding: 10px 15px !important;
        background: transparent !important;
        font-weight: 400;
        white-space: normal;
        font-size: 17px !important;
        margin: 0;
        /* Handle long text */
    }

    .dropdown-item:hover,
    .dropdown-item:active {
        color: #E43D12 !important;
        background: transparent !important;
    }

}

/* Desktop cleanup */
@media (min-width: 992px) {

    /* Hide default Bootstrap caret */
    .nav-item.dropdown .dropdown-toggle::after,
    .nav-item.dropdown .custom-dropdown-toggle::after {
        display: none !important;
    }
}