/* --------------------------------------------------------------------------
   InfoPixal Tabbed Mega Menu Premium Styling
   -------------------------------------------------------------------------- */

/* Let the parent li keep its relative positioning so standard layout flows normally */
.ip-mega-menu-parent {
    position: relative !important;
}

/* Full Width Mega Menu Dropdown Box */
.ip-mega-menu-dropdown {
    display: none; /* Hide from layout calculation on page load */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(3, 27, 51, 0.12);
    border-top: 1px solid #e2e8f0;
    border-bottom: 4px solid #0A355C;
    border-radius: 0;
    z-index: 99999 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
                visibility 0.3s;
    font-family: 'Outfit', sans-serif !important;
    overflow: hidden;
}

/* Show Dropdown on Hover of Top Level Parent */
.ip-mega-menu-parent:hover .ip-mega-menu-dropdown {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Inner Layout Wrapper */
.ip-mega-menu-wrapper {
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    min-height: 520px;
    background: #ffffff;
}

/* ==========================================================================
   LEFT SIDEBAR: TABS & PROMO CARDS
   ========================================================================== */
.ip-mega-menu-sidebar {
    width: 260px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Sidebar Tab list */
.ip-mega-menu-tabs {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 28px 0 !important;
}
.ip-mega-menu-tab-item {
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
}
.ip-mega-menu-tab-item a {
    display: flex;
    align-items: center;
    padding: 14px 18px !important;
    background: transparent;
    border-radius: 8px;
    color: #475569 !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box;
    border: 1px solid transparent !important;
    width: 100% !important;
}

/* Hover & Active States */
.ip-mega-menu-tab-item a:hover {
    background: rgba(10, 53, 92, 0.05) !important;
    color: #0A355C !important;
    border-color: rgba(10, 53, 92, 0.1) !important;
}
.ip-mega-menu-tab-item.active a {
    background: linear-gradient(135deg, #0A355C 0%, #031B33 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(10, 53, 92, 0.25) !important;
    border-color: #0A355C !important;
}

/* Arrow inside active tab */
.ip-mega-menu-tab-item .ip-tab-arrow {
    margin-left: auto;
    font-size: 18px;
    font-weight: 400;
    opacity: 0.6;
    transition: transform 0.2s ease;
}
.ip-mega-menu-tab-item.active .ip-tab-arrow {
    transform: translateX(4px);
    opacity: 1;
}

/* Tab Icon */
.ip-mega-menu-tab-item .ip-tab-icon {
    margin-right: 12px;
    font-size: 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

/* Promo Cards Box */
.ip-mega-menu-promo-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Card 1: Blue Card */
.ip-promo-card-blue {
    background: linear-gradient(135deg, #0A355C 0%, #031B33 100%);
    padding: 20px;
    border-radius: 14px;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(3, 27, 51, 0.18);
    position: relative;
    overflow: hidden;
}
.ip-promo-card-blue::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}
.ip-promo-card-blue .ip-promo-brand {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #38bdf8;
    display: block;
    margin-bottom: 8px;
}
.ip-promo-card-blue p {
    font-size: 12px;
    line-height: 1.5;
    color: #e2e8f0;
    margin: 0 0 14px 0 !important;
    font-weight: 500;
    font-family: 'Inter', sans-serif !important;
}
.ip-promo-card-blue .ip-promo-link {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease;
}
.ip-promo-card-blue .ip-promo-link:hover {
    transform: translateX(4px);
}

/* Card 2: Light Card */
.ip-promo-card-light {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 16px 20px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
    text-decoration: none !important;
}
.ip-promo-card-light:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 20px rgba(10, 53, 92, 0.06);
}
.ip-promo-card-light .ip-promo-icon {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #0A355C;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ip-promo-card-light p {
    font-size: 11px;
    line-height: 1.4;
    color: #475569;
    margin: 0 !important;
    font-weight: 600;
    flex: 1;
    font-family: 'Inter', sans-serif !important;
}
.ip-promo-card-light .ip-promo-link {
    font-size: 12px;
    font-weight: 700;
    color: #0A355C !important;
    text-decoration: none !important;
    white-space: nowrap;
    transition: transform 0.2s ease;
}
.ip-promo-card-light:hover .ip-promo-link {
    transform: translateX(4px);
    color: #165691 !important;
}

/* ==========================================================================
   RIGHT CONTENT: TAB PANELS & SUBMENU COLUMNS
   ========================================================================== */
.ip-mega-menu-content-panels {
    flex: 1;
    padding: 24px 20px;
    box-sizing: border-box;
    background: #ffffff;
}

/* Tab Panels */
.ip-mega-menu-panel {
    display: none;
    height: 100%;
}
.ip-mega-menu-panel.active {
    display: block;
    animation: ipFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ipFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mega Menu Grid - Default 4 columns */
.ip-mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px 16px;
    align-content: start;
}

/* If exactly 2 items: 2 columns */
.ip-mega-menu-grid:has(> :nth-child(2)):not(> :nth-child(3)) {
    grid-template-columns: repeat(2, 1fr);
}

/* If exactly 3 items: 3 columns */
.ip-mega-menu-grid:has(> :nth-child(3)):not(> :nth-child(4)) {
    grid-template-columns: repeat(3, 1fr);
}

/* If exactly 5 items: 5 columns */
.ip-mega-menu-grid:has(> :nth-child(5)):not(> :nth-child(6)) {
    grid-template-columns: repeat(5, 1fr);
}

/* If exactly 6 items: 6 columns */
.ip-mega-menu-grid:has(> :nth-child(6)):not(> :nth-child(7)) {
    grid-template-columns: repeat(6, 1fr);
}

/* If exactly 10 items (Valves & Valve Automation layout):
   First row has 6 columns, second row has 4 columns spanning full width */
.ip-mega-menu-grid:has(> :nth-child(10)):not(> :nth-child(11)) {
    grid-template-columns: repeat(60, 1fr) !important;
}
.ip-mega-menu-grid:has(> :nth-child(10)):not(> :nth-child(11)) > .ip-mega-menu-col {
    grid-column: span 10 !important;
}
.ip-mega-menu-grid:has(> :nth-child(10)):not(> :nth-child(11)) > .ip-mega-menu-col:nth-child(n+7) {
    grid-column: span 15 !important;
}

/* If exactly 11 items (Valves & Valve Automation layout - 6 in Row 1, 5 in Row 2):
   First row has 6 columns, second row has 5 columns spanning full width */
.ip-mega-menu-grid:has(> :nth-child(11)):not(> :nth-child(12)) {
    grid-template-columns: repeat(60, 1fr) !important;
}
.ip-mega-menu-grid:has(> :nth-child(11)):not(> :nth-child(12)) > .ip-mega-menu-col {
    grid-column: span 10 !important;
}
.ip-mega-menu-grid:has(> :nth-child(11)):not(> :nth-child(12)) > .ip-mega-menu-col:nth-child(n+7) {
    grid-column: span 12 !important;
}

/* Columns */
.ip-mega-menu-col {
    display: flex;
    flex-direction: column;
}

/* Column Header */
.ip-col-header {
    margin: 0 0 14px 0 !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #0A355C !important;
    box-sizing: border-box;
}
.ip-col-header a {
    display: flex;
    align-items: center;
    text-decoration: none !important;
    color: #0A355C !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}
.ip-col-header a:hover {
    color: #165691 !important;
}
.ip-col-icon {
    margin-right: 10px;
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #165691;
    transition: transform 0.2s ease, color 0.2s ease;
}
.ip-col-header a:hover .ip-col-icon {
    transform: scale(1.15);
    color: #0A355C;
}

/* Column links list */
.ip-col-links {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.ip-col-links li {
    margin: 0 0 10px 0 !important;
    padding: 0 !important;
}
.ip-col-links li a {
    font-size: 14px !important;
    color: #475569 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    display: inline-block !important;
    transition: all 0.25s ease !important;
    line-height: 1.4 !important;
    font-family: 'Inter', sans-serif !important;
}
.ip-col-links li a:hover {
    color: #0A355C !important;
    transform: translateX(6px);
}

/* ==========================================================================
   BOX PATTERN FOR COLUMNS WITHOUT SUB-PRODUCTS
   ========================================================================== */
.ip-mega-menu-col.has-no-children.ip-mega-menu-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    height: auto !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0 !important;
    cursor: pointer;
}

.ip-mega-menu-col.has-no-children.ip-mega-menu-box:hover {
    background: #ffffff !important;
    border-color: #0A355C !important;
    box-shadow: 0 6px 16px rgba(10, 53, 92, 0.08) !important;
    transform: translateY(-3px);
}

.ip-mega-menu-col.has-no-children.ip-mega-menu-box .ip-col-header {
    border-bottom: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
}

.ip-mega-menu-col.has-no-children.ip-mega-menu-box .ip-col-header a {
    display: flex;
    align-items: center;
    color: #475569 !important; /* Slightly softer color by default */
    font-weight: 700 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    transition: color 0.25s ease;
}

.ip-mega-menu-col.has-no-children.ip-mega-menu-box .ip-col-icon {
    color: #475569 !important; /* Matches text */
    font-size: 20px;
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.ip-mega-menu-col.has-no-children.ip-mega-menu-box:hover .ip-col-header a {
    color: #0A355C !important;
}

.ip-mega-menu-col.has-no-children.ip-mega-menu-box:hover .ip-col-icon {
    color: #165691 !important;
}

/* Styling for 'More Products' link under column lists */
.ip-col-links li.ip-more-products-item {
    margin-top: 12px !important;
}
.ip-more-products-link {
    font-size: 13px !important;
    color: #0A355C !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.25s ease !important;
    font-family: 'Inter', sans-serif !important;
}
.ip-more-products-link:hover {
    color: #165691 !important;
    transform: translateX(6px) !important;
}

