/* ==========================================================================
   YASKAWA MODERN THEME OVERRIDES
   Contains styles for the modernized header, mega-menu, and country picker.
   ========================================================================== */

/* --- HEADER STYLES --- */
#modern-site-header {
    height: auto !important;
}
#modern-yaskawa-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 1030; /* Ensure it stays above everything */
    height: auto !important; /* Override old .navbar { height: 140px } */
    border-bottom: none !important; /* Override old .navbar { border-bottom: 1px solid gray } */
}
.modern-meta-nav a {
    color: #005CA9;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}
.modern-meta-nav a:hover {
    color: #003a6b;
}
.meta-nav-pipe {
    color: #ccc;
    margin-left: 20px;
    font-size: 0.9rem;
}

/* Clean up main nav layout in new container */
.modern-header-mainNav .navbar-nav {
    flex-direction: row;
    margin-bottom: 0;
}
.modern-header-mainNav .navbar-nav .nav-item {
    margin-left: 25px;
}
.modern-header-mainNav .navbar-nav .nav-link.level-1 {
    padding: 20px 0 17px 0 !important;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    text-transform: uppercase;
    transition: color 0.2s;
}
.modern-header-mainNav .navbar-nav .nav-link.level-1:hover {
    color: var(--menu-theme-color, #005CA9) !important;
}


/* --- MEGAMENU OVERRIDES --- */

.nav-item.theme-robotics { --menu-theme-color: #26EBDE; }
.nav-item.theme-ac-drives { --menu-theme-color: #00C224; }
.nav-item.theme-motion-control { --menu-theme-color: #8F94FF; }
.nav-item.theme-default { --menu-theme-color: #005CA9; }

/* Force ancestors to be static so the absolute dropdown uses a centered offset parent */
.header__mainNav,
#menu.navbar-collapse,
.navbar-nav,
.navbar-nav .nav-item.megamenu {
    position: static !important;
}

/* Remove old blue background from active states */
.navbar-nav .active,
.navbar-nav .nav-item.active,
.navbar-nav .nav-link.active,
.navbar-nav .nav-item.active .nav-link,
.navbar-nav .nav-item .nav-link.active {
    background-color: transparent !important;
}

/* Base styles for level-1 (Main tabs) */
.navbar-nav .nav-item .level-1 {
    transition: color 200ms, border-bottom-color 200ms !important;
    border-bottom: 3px solid transparent !important;
    padding-bottom: 17px !important;
    color: #000 !important;
}

/* Hover & Active states for level-1 */
.navbar-nav .nav-item:hover .level-1,
.navbar-nav .nav-item.active .level-1,
.navbar-nav .nav-item.show .level-1,
.navbar-nav .nav-item .level-1[aria-expanded="true"],
.navbar-nav .nav-item .level-1.active {
    color: var(--menu-theme-color, #005CA9) !important;
    border-bottom-color: var(--menu-theme-color, #005CA9) !important;
    background-color: transparent !important;
}

/* Fix dropdown menu layout - perfect viewport centering */
.navbar-nav .dropdown-menu.new-megamenu {
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 2rem 0 !important; /* Reduced top/bottom padding */
    background: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
    z-index: 1050 !important; /* Stay above all page content including slider controls */
}

.new-megamenu .container {
    max-width: 1140px;
    margin: 0 auto;
}


/* --- COUNTRY PICKER STYLES --- */

.modern-country-picker-toggle {
    background: transparent !important;
    border: none !important;
    padding: 0 10px !important;
    width: auto !important;
    cursor: pointer;
    transition: background-color 0.2s;
}
.modern-country-picker-toggle:hover {
    background-color: #f0f0f0;
}
.modern-country-picker {
    z-index: 10001 !important;
    width: 450px !important;
    padding: 20px !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
    left: auto !important;
    right: 0 !important;
    background: #fff !important;
    font-size: 0.9rem;
}

.modern-country-picker__headline {
    font-weight: 700;
    color: #005CA9;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 5px;
}
.modern-country-picker__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.modern-country-picker__item {
    display: flex;
    align-items: center;
    padding: 5px 0;
    break-inside: avoid;
}
.modern-country-picker__item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}
.modern-country-picker__item a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

/* Force slider controls and floating sidebar to stay below the megamenu */
.slider-nav, .slider-dot, .slick-arrow, .slick-dots, .owl-nav, .owl-dots, .carousel-control-prev, .carousel-control-next, .carousel-indicators, aside.sidebar, .sidebar-contact {
    z-index: 10 !important;
}

/* Constrain the slider section stacking context so its children cannot escape above the header/megamenu */
.large-headerswiper,
.small-headerswiper,
.content-swiper {
    position: relative;
    z-index: 0; /* Creates a stacking context capped below the header */
}

/* Bug 1 fix: Remove the white gap between the fixed header and the page content (slider/banner).
   The old header was 140px and main used margin-top:140px to compensate.
   The modern header is auto-height, so we reset main's margin-top and
   let a small JS snippet dynamically set it to match the actual header height. */
#page > main {
    margin-top: 0 !important;
    box-shadow: none !important; /* Remove shadow that creates a visual gap at top */
}

/* Remove bottom padding from header container so nav links sit flush at the bottom edge */
.modern-header-container {
    padding-bottom: 0 !important;
}
.modern-country-picker__item a:hover {
    color: #005CA9;
    font-weight: 500;
}

/* --- ADDITIONAL MEGAMENU STYLES --- */

.megamenu-masonry {
    column-count: 3;
    column-gap: 40px;
}
@media (max-width: 991px) {
    .megamenu-masonry {
        column-count: 1;
    }
}

.megamenu-section {
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 15px !important; /* Much tighter section spacing */
    display: block;
    width: 100%;
}

.megamenu-section-lonely {
    margin-bottom: 15px !important;
}

.megamenu-section-lonely a {
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    padding: 0 !important;
    display: inline-block;
}

/* Fix the misaligned image which was absolutely positioned by old CSS */
.navbar-nav .dropdown-menu.new-megamenu .nav-image {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    height: 120px !important;
    width: 100% !important;
    margin-top: 15px !important;
    border-radius: 4px;
}

.level-2-heading {
    margin-bottom: 8px !important; /* Tighter heading margin */
}

.level-2-heading a {
    color: #000 !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important; /* Smaller heading font size */
    text-decoration: none !important;
    padding: 0 !important; /* Strip bootstrap nav-link padding */
    display: inline-block;
}

.level-3-items {
    display: flex;
    flex-direction: column;
    gap: 0px !important; /* Remove gap completely for compact look */
}

.level-3-items .dropdown-item {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.level-3-items .level-3 {
    padding: 1px 0 1px 12px !important; /* Tighter padding */
    border-left: 2px solid var(--menu-theme-color, #005CA9) !important;
    color: #000 !important;
    font-weight: normal !important;
    font-size: 0.85rem !important; /* Smaller font size */
    line-height: 1.3 !important; /* Tighter line height */
    transition: color 200ms !important;
    display: inline-block !important;
}

.level-3-items .level-3:after {
    display: none !important; /* Hide old chevrons */
}

.level-3-items .level-3:hover {
    color: var(--menu-theme-color, #005CA9) !important;
    text-decoration: none !important;
}

/* ==========================================================================
   MEGA FOOTER STYLES
   ========================================================================== */

:root {
    --footer-navy: #1C2341;
    --footer-navy-dark: #12172b;
    --footer-robotics: #26EBDE;
    --footer-acdrives: #00C224;
    --footer-motion: #8F94FF;
    --footer-controls: #005CA9;
}

/* ── Base ── */
.footer-mega {
    background-color: var(--footer-navy);
    color: #fff;
    position: relative;
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    max-width: none;
}

/* ── Gradient bar ── */
.footer-mega-gradient-bar {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg,
        var(--footer-robotics),
        var(--footer-acdrives),
        var(--footer-motion),
        var(--footer-controls));
}

/* ── Container ── */
.footer-mega-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Footer Top ── */
.footer-mega-top {
    padding: 60px 0 30px;
}

/* ── CSS Grid Layout ── */
.footer-mega-grid {
    display: grid;
    grid-template-columns: 260px repeat(4, 1fr);
    gap: 20px 35px;
}

/* ── Branding column (spans 2 rows) ── */
.footer-mega-col-branding {
    grid-row: 1 / 3;
    padding-right: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-mega-logo {
    filter: brightness(0) invert(1);
    max-height: 36px;
    margin-bottom: 20px;
}

.footer-mega-tagline {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
    line-height: 1.7;
    margin: 0 0 24px;
}

/* ── Company links (horizontal under tagline) ── */
.footer-mega-company-links ul {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.footer-mega-company-links ul li a {
    color: #fff !important;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
    position: relative;
}

.footer-mega-company-links ul li a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--footer-controls);
    transition: width 0.3s ease;
}

.footer-mega-company-links ul li a:hover::after {
    width: 100%;
}

/* ── Social icons ── */
.footer-mega-social-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-mega-social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-mega-social-icons a:hover {
    background: var(--footer-controls);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 92, 169, 0.4);
}

/* ── Navigation link columns ── */
.footer-mega-col-links {
    min-width: 0; /* prevent grid blowout */
}

.footer-mega-col-links h5 {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 10px;
    color: #fff;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.footer-mega-col-links h5 a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-mega-col-links h5 a:hover {
    color: var(--footer-controls);
}

.footer-mega-col-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-mega-col-links ul li {
    margin-bottom: 7px;
}

.footer-mega-col-links ul li a {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.4;
    transition: all 0.25s ease;
    display: inline-block;
}

.footer-mega-col-links ul li a:hover {
    color: #fff;
    padding-left: 4px;
}

/* ==========================================================================
   MEGA FOOTER – OLD SNIPPET INTEGRATION OVERRIDES
   ========================================================================== */

.footer-mega-snippet-bottom > footer {
    display: contents;
}

.footer-mega-snippet-bottom .footer-columns {
    display: none !important;
}

.footer-mega-snippet-bottom .footer-informations {
    background-color: var(--footer-navy-dark) !important;
    border-top: none !important;
    padding: 18px 0 !important;
    font-size: 0.82rem !important;
    color: rgba(255, 255, 255, 0.45) !important;
    max-width: none !important;
}

.footer-mega-snippet-bottom .footer-informations .container {
    max-width: 1200px !important;
}

.footer-mega-snippet-bottom .footer-informations .row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.footer-mega-snippet-bottom .footer-informations a {
    color: rgba(255, 255, 255, 0.45) !important;
    text-decoration: none !important;
    transition: color 0.3s !important;
}

.footer-mega-snippet-bottom .footer-informations a:hover {
    color: #fff !important;
}

.footer-mega-snippet-bottom .footer-informations ul li {
    display: inline-block;
}

.footer-mega-snippet-bottom .footer-informations ul li:after {
    border-right-color: rgba(255, 255, 255, 0.2) !important;
}

/* ==========================================================================
   MEGA FOOTER – RESPONSIVE
   ========================================================================== */

@media (max-width: 1100px) {
    .footer-mega-grid {
        grid-template-columns: 240px repeat(3, 1fr);
    }
    .footer-mega-col-branding {
        grid-row: 1 / 4; /* span more rows for smaller screens */
    }
}

@media (max-width: 991px) {
    .footer-mega-top {
        padding: 40px 0 20px;
    }
    .footer-mega-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px 30px;
    }
    .footer-mega-col-branding {
        grid-column: 1 / -1; /* full width */
        grid-row: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-right: 0;
        padding-bottom: 30px;
    }
    .footer-mega-social-icons {
        margin-bottom: 10px;
    }
}

@media (max-width: 575px) {
    .footer-mega-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-mega-snippet-bottom .footer-informations .row {
        flex-direction: column !important;
        text-align: center !important;
    }

    .footer-mega-company-links ul {
        flex-wrap: wrap;
    }
}

