/* =========================================
   HEADER & FOOTER STYLES (Kamasa B2B Precision)
   Context: Consolidated File
   ========================================= */

:root {
    /* Colors (Design System) */
    --k-header-yellow: #ffed00;
    /* Precision match to brand color */
    --k-header-yellow-rgb: 255, 237, 0;
    --k-header-black: #000000;
    --k-header-white: #FFFFFF;

    /* Typography */
    --k-font-primary: var(--k-font-base, 'Myriad Pro', sans-serif);

    /* Transitions & Shadows */
    --k-transition-fluid: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    --k-header-shadow: none;
    --k-dropdown-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --k-mega-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15);
}

/* ==================== KAMASA TOP BAR (GLOBAL CONSISTENCY) ==================== */
.kamasa-topbar {
    background-color: #474747 !important;
    /* Precision matching the gray bar */
    padding: 8px 0 !important;
    font-size: 13px !important;
    position: relative !important;
    z-index: 1000000 !important;
    width: 100% !important;
    display: block !important;
}

.kamasa-topbar-flex {
    max-width: 1440px !important;
    margin: 0 auto !important;
    padding: 0 30px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 40px !important;
}

.kamasa-topbar-text {
    color: #FFFFFF !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.kamasa-topbar-text strong {
    color: var(--k-header-yellow);
    font-weight: 800;
}

.kamasa-topbar-btn {
    display: inline-block !important;
    /* Force inline-block to prevent 100% width overrides */
    width: auto !important;
    min-width: 180px !important;
    background-color: var(--k-header-yellow) !important;
    color: #000000 !important;
    text-decoration: none !important;
    padding: 6px 20px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    border: none !important;
    transition: background-color 0.3s ease !important;
    line-height: 1 !important;
    text-align: center !important;
}

.kamasa-topbar-btn:hover {
    filter: brightness(1.1);
    transform: scale(1.03);
}

/* Reset for Header Context */
.k-header * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.site-header,
#masthead,
.k-header,
.k-navbar {
    width: 100%;
    background-color: var(--k-header-yellow) !important;
    position: relative;
    z-index: 99999 !important;
    overflow: visible !important;
    font-family: var(--k-font-primary);
    font-weight: 800;
    color: var(--k-header-black);
    margin-bottom: 0 !important;
}

/* Fix Global Spacing and Stacking */
.site-content,
.site-main,
.site,
.wp-site-blocks,
main,
#primary,
#content {
    margin-top: 0 !important;
    padding-top: 0 !important;
    position: relative !important;
}

/* MAIN HEADER AREA (Single Row) */
.k-header-main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.k-header-left {
    flex-shrink: 0;
}

.k-header-center {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    padding-left: 60px;
    /* Space between logo and center-left nav */
}

.k-header-right {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-shrink: 0;
}

/* Logo */
.k-header__logo-img {
    display: flex;
    align-items: center;
    padding: 5px 0;
}

.k-header__logo-img img {
    display: block;
    height: 45px;
    /* Refined for parity */
    width: auto;
    min-width: 180px;
    /* Force minimum visibility for SVG */
    object-fit: contain;
}

/* NAVIGATION LINKS (Uppercase & Bold) */
.k-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 35px;
    /* Spacing between main items */
}

.k-nav-item {
    color: var(--k-header-black) !important;
    text-decoration: none !important;
    font-size: 14px;
    /* Increased for legibility */
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* Added for benchmark matching */
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.k-nav-item:hover,
.k-nav-item:focus,
.k-nav-item:focus-visible,
.k-nav-item:focus-within,
.k-nav-item.active {
    color: #ffffff !important;
    opacity: 1;
}

.k-nav-item:hover > span,
.k-nav-item:focus > span,
.k-nav-item:focus-visible > span,
.k-nav-item:focus-within > span,
.k-nav-item.active > span,
.k-nav-item:hover > i,
.k-nav-item:focus > i,
.k-nav-item:focus-visible > i,
.k-nav-item:focus-within > i,
.k-nav-item.active > i {
    color: #ffffff !important;
    opacity: 1;
}

.k-header__lang-picker:hover #currentLangDisplay,
.k-header__lang-picker:focus #currentLangDisplay,
.k-header__lang-picker:focus-visible #currentLangDisplay,
.k-header__lang-picker:focus-within #currentLangDisplay {
    color: #ffffff !important;
}

/* Chevron for Productos */
.k-icon-chevron {
    font-size: 12px;
    margin-left: -4px;
    margin-top: 2px;
}

/* SEARCH TRIGGER */
.k-search-trigger-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.k-search-trigger-icon:hover {
    transform: scale(1.1);
}

.k-search-trigger-icon .dashicons-search {
    font-size: 22px;
    color: var(--k-header-black) !important;
    width: 22px;
    height: 22px;
}

/* ==================== EXPANDING SEARCH BAR ==================== */
.k-search-expandable {
    position: relative;
    display: flex;
    align-items: center;
}

#searchInput {
    position: absolute;
    right: 100%;
    width: 0;
    opacity: 0;
    pointer-events: none;

    height: 38px;
    background: #ffffff;
    border-radius: 6px;
    border: none;
    padding: 0;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition:
        width 0.35s ease,
        opacity 0.25s ease,
        padding 0.25s ease;

    z-index: 20;
    color: #444;
    font-size: 14px;
    font-weight: 500;
}

.k-search-expandable.active #searchInput {
    width: 300px;
    opacity: 1;
    pointer-events: auto;
    padding: 0 45px 0 14px;
    /* Space for the icon area if needed, but grow LEFT */
}

/* Override existing active class if it conflicts, but here we grow leftwards */
.k-search-expandable.active #searchInput {
    width: 300px;
    opacity: 1;
    pointer-events: auto;
    padding: 0 14px;
}

/* Z-INDEX CONTROL (Ensure logo always on top and search overlays nav) */
.k-header-left {
    position: relative;
    z-index: 30 !important;
    /* logo always on top */
}

.k-header-center {
    position: relative;
    z-index: 10;
}

/* UTILITY NAV (Right) */
.k-header__lang-picker {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    margin-left: 5px;
}

.k-header__quote-shortcut {
    gap: 8px;
    margin-left: 2px;
}

.k-header__quote-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.k-header__quote-count {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #000000;
    color: #ffed00;
    font-size: 11px;
    line-height: 18px;
    justify-content: center;
    font-weight: 900;
}

/* Correct the Lang Picker Display */
#currentLangDisplay {
    padding: 5px 0;
}

/* ACCOUNT DROPDOWN */
.k-header__account {
    position: relative;
    overflow: visible !important;
}

.k-header__account .k-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    background: #000000;
    min-width: 180px;
    border-radius: 4px;
    padding: 10px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 10000;
}

.k-header__account:hover .k-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.k-dropdown::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
}

.k-dropdown a {
    display: block;
    padding: 10px 20px;
    color: #FFFFFF !important;
    text-decoration: none !important;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

.k-dropdown a:hover {
    background: #ffed00;
    color: #000000 !important;
}

/* ==================== MEGA MENU (3-LEVEL WHITE THEME) ==================== */
.k-progressive-menu-container {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100000;
    overflow: visible !important;
    pointer-events: none;
}

.k-nav-item:hover .k-progressive-menu-container {
    pointer-events: auto !important;
    z-index: 100000 !important;
}

/* Puente invisible para evitar que se pierda el hover al bajar el mouse */
.k-progressive-menu-container::before {
    content: "";
    position: absolute;
    top: -40px; /* Cubre todo el gap vertical hacia el nav-item */
    left: 0;
    width: 100%;
    height: 40px;
}

.k-mega-menu {
    display: flex;
    align-items: flex-start !important;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10000;
    background-color: transparent !important; /* No shared background */
    box-shadow: none !important;
    border: none !important;
    opacity: 0;
    visibility: hidden;
    transform: none !important; /* Neutralized composite layer 3D translation */
    transition: var(--k-transition-fluid);
    pointer-events: none;
    gap: 2px; /* Small gap to separate independent column shadows Slightly */
}

/* Force inner columns to top layer context */
.k-col,
.k-col-cat,
.k-col-line,
.k-col-subline {
    position: relative;
    z-index: 10000;
}

.k-nav-item:hover .k-mega-menu,
.k-nav-item.active .k-mega-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
}

.k-col {
    width: 240px;
    height: auto !important;
    max-height: 85vh;
    overflow-y: auto;
    list-style: none;
    padding: 10px 0;
    background-color: #ffffff; /* Background moves here */
    box-shadow: var(--k-mega-shadow); /* Shadow moves here */
    border-radius: 8px; /* Rounded corners for each independent column */
    border: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

/* Specific column adjustments */
.k-col-line,
.k-col-subline {
    width: 260px;
    display: none; 
}

.k-col-line.active,
.k-col-subline.active {
    display: block !important;
}

/* Base item styling */
.k-mega-item {
    width: 100%;
    transition: background 0.15s ease, color 0.15s ease;
}

.k-mega-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: var(--k-header-black) !important;
    text-decoration: none !important;
    font-size: 13.5px; /* Slightly reduced for better wrapping */
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.3;
    white-space: normal; /* Allow wrapping */
    text-align: left;
}

/* Icon positioning */
.k-mega-item a .dashicons {
    font-size: 16px;
    opacity: 0.3;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

/* HOVER EFFECT ON ALL LEVELS */
.k-mega-item:hover,
.k-mega-item.active {
    background-color: var(--k-header-yellow) !important;
}

.k-mega-item:hover a,
.k-mega-item.active a {
    color: var(--k-header-black) !important;
}

.k-mega-item:hover a .dashicons,
.k-mega-item.active a .dashicons {
    opacity: 1;
    transform: translateX(4px);
}

/* Scrollbar styling */
.k-col::-webkit-scrollbar {
    width: 4px;
}
.k-col::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* ==================== FOOTER REFACTOR (Kamasa Bold) ==================== */
/* ==================== ENTERPRISE FOOTER (REFACTORED) ==================== */
.k-footer {
    border-top: 4px solid #ffed00;
}

.k-footer-main {
    background: #000000;
    color: #ffffff;
    padding: 60px 0 40px;
}

.k-footer-container {
    width: min(100% - 64px, 1180px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(320px, 1.55fr) minmax(140px, 0.55fr) minmax(140px, 0.55fr) minmax(150px, 0.55fr);
    column-gap: clamp(28px, 3vw, 52px);
    row-gap: 24px;
    align-items: start;
}

.k-footer-col {
    flex: 1;
    min-width: 200px;
    align-self: start;
}

.k-footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    min-height: 120px;
    align-self: start;
    padding-top: 8px;
    padding-right: 0;
}

.k-footer-brand img {
    display: block;
    width: clamp(120px, 8vw, 160px);
    height: auto;
    max-width: 100%;
    filter: brightness(0) saturate(100%) invert(77%) sepia(93%) saturate(1272%) hue-rotate(359deg) brightness(104%) contrast(103%);
}

.k-footer-col h4 {
    font-size: 14px;
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #ffffff;
}

.k-footer-col p {
    font-size: 14px;
    color: #bbbbbb;
    line-height: 1.6;
    margin-bottom: 8px;
}

.k-footer-col a {
    display: block;
    color: #bbbbbb;
    text-decoration: none;
    margin-bottom: 10px;
    font-size: 14px;
    transition: color 0.2s ease;
}

.k-footer-col a:hover {
    color: #ffed00;
}

.k-footer-divider-row {
    margin-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.k-footer-legal-row {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.k-footer-legal-row a {
    color: #bbbbbb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: color 0.2s ease;
}

.k-footer-legal-row a:hover {
    color: #ffed00;
}

/* Social Icons */
.k-footer-social {
    max-width: 280px;
}

.k-social-icons {
    display: flex;
    gap: 12px;
}

.k-social-icons a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #ffffff;
    border-radius: 2px;
    color: #000000 !important;
    transition: all 0.3s ease;
}

.k-social-icons a:hover {
    background: #ffed00;
    transform: translateY(-3px);
}

.k-social-icons .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* NEW GREY BAR (LEGAL) */
.k-footer-bottom {
    background: #414141;
    color: #bbbbbb;
    font-size: 12px;
    padding: 15px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.k-footer-bottom-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Account Dropdown */
.k-has-dropdown {
    position: relative;
}

.k-account-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    background: #000000;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    border-radius: 4px;
}

.k-has-dropdown:hover .k-account-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.k-account-dropdown a {
    display: block;
    padding: 10px 20px;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    text-align: left;
}

.k-account-dropdown a:hover {
    background: #ffed00;
    color: #000000 !important;
}

.desktop-only-link {
    display: flex;
}

.k-footer-links {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.k-footer-links a {
    color: #bbbbbb;
    text-decoration: none;
    transition: color 0.2s ease;
}

.k-footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .k-footer-container {
        width: min(100% - 40px, 100%);
        grid-template-columns: 1.4fr 1fr;
        grid-template-areas:
            "contact logo"
            "empresa clientes";
        row-gap: 32px;
    }

    .k-footer-col:nth-child(1) {
        grid-area: contact;
    }

    .k-footer-col:nth-child(2) {
        grid-area: empresa;
    }

    .k-footer-col:nth-child(3) {
        grid-area: clientes;
    }

    .k-footer-brand {
        grid-area: logo;
        justify-content: flex-start;
        align-items: flex-start;
        align-self: start;
        min-width: 0;
        min-height: auto;
        padding-top: 0;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    .k-footer-container {
        width: min(100% - 32px, 100%);
        grid-template-columns: 1fr;
        grid-template-areas: none;
        row-gap: 28px;
        text-align: center;
    }

    .k-footer-col:nth-child(1),
    .k-footer-col:nth-child(2),
    .k-footer-col:nth-child(3),
    .k-footer-brand {
        grid-area: auto;
    }

    .k-social-icons {
        justify-content: center;
    }

    .k-footer-brand {
        justify-content: center;
        align-items: center;
        min-height: auto;
        margin-top: 0;
        padding-top: 8px;
    }

    .k-footer-brand img {
        width: clamp(115px, 42vw, 160px);
    }

    .k-footer-bottom-container {
        flex-direction: column;
        text-align: center;
    }

    .k-footer-legal-row {
        gap: 14px 20px;
    }

    .k-footer-links {
        justify-content: center;
        gap: 15px;
    }
}
