/* =========================================================
   MERTHERAPY - HEADER
   ========================================================= */

.mer-header,
.mer-header * {
    box-sizing: border-box;
}

.mer-header {
    position: relative;
    z-index: 9999;

    width: 100%;

    background: #fcfaf7;
    color: #2f2a28;

    font-family: "Manrope", Arial, sans-serif;
}


/* =========================================================
   FILA SUPERIOR
   ========================================================= */

.mer-header-top {
    width: 100%;

    background: rgba(252,250,247,.98);

    border-bottom: 1px solid rgba(47,42,40,.09);
}

.mer-header-top-inner {
    width: calc(100% - 90px);
    max-width: 1760px;

    min-height: 92px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 40px;
}


/* =========================================================
   LOGO
   ========================================================= */

.mer-header-logo {
    display: inline-flex;
    align-items: center;

    flex-shrink: 0;

    text-decoration: none;
}

.mer-header-logo img {
    display: block;

    width: 270px;
    max-width: 100%;

    height: auto;
}


/* =========================================================
   ACCIONES DERECHA
   ========================================================= */

.mer-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 29px;

    flex-shrink: 0;
}


/* =========================================================
   BUSCADOR
   ========================================================= */

.mer-searchbox {
    position: static;
}

.mer-searchbox summary {
    list-style: none;
}

.mer-searchbox summary::-webkit-details-marker {
    display: none;
}

.mer-header-search {
    display: inline-flex;
    align-items: center;

    gap: 10px;

    color: #625b57;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;

    cursor: pointer;

    transition:
        color .25s ease,
        opacity .25s ease;
}

.mer-header-search:hover,
.mer-searchbox[open] .mer-header-search {
    color: #18c5d1;
}

.mer-header-search svg {
    width: 21px;
    height: 21px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
}


/* PANEL BUSCADOR */

.mer-search-panel {
    position: absolute;

    top: 100%;
    right: max(45px, calc((100vw - 1760px) / 2));

    width: 390px;

    padding: 14px;

    background: #ffffff;

    border: 1px solid rgba(47,42,40,.10);

    box-shadow:
        0 20px 45px rgba(47,42,40,.12);

    z-index: 10000;

    animation: merSearchOpen .2s ease;
}

@keyframes merSearchOpen {

    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


.mer-search-form {
    display: grid;
    grid-template-columns: 1fr 52px;

    min-height: 54px;

    background: #fcfaf7;
}

.mer-search-form input {
    width: 100%;
    min-width: 0;

    padding: 0 18px;

    background: #fcfaf7;

    border: 1px solid rgba(47,42,40,.13);
    border-right: 0;

    border-radius: 0;

    outline: none;

    color: #2f2a28;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;

    transition:
        border-color .2s ease,
        background .2s ease;
}

.mer-search-form input:focus {
    background: #ffffff;
    border-color: #18c5d1;
}

.mer-search-form input::placeholder {
    color: #9a918b;
}

.mer-search-form button {
    width: 52px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;

    background: #18c5d1;
    color: #ffffff;

    cursor: pointer;

    transition:
        background .2s ease,
        transform .2s ease;
}

.mer-search-form button:hover {
    background: #12b5c0;
}

.mer-search-form button svg {
    width: 20px;
    height: 20px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;
    stroke-linecap: round;
}

.mer-sr-only {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;
    clip: rect(0,0,0,0);

    white-space: nowrap;

    border: 0;
}


/* =========================================================
   DIVISOR
   ========================================================= */

.mer-header-divider {
    display: block;

    width: 1px;
    height: 31px;

    background: rgba(47,42,40,.17);
}


/* =========================================================
   BOTÓN CTA
   ========================================================= */

.mer-header-cta {
    min-height: 54px;

    padding: 0 27px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    background: #18c5d1;
    color: #ffffff;

    border: 1px solid #18c5d1;

    text-decoration: none;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;

    line-height: 1;

    letter-spacing: .4px;

    transition:
        background .25s ease,
        border-color .25s ease,
        transform .25s ease,
        box-shadow .25s ease;
}

.mer-header-cta:hover {
    background: #12b5c0;
    border-color: #12b5c0;

    color: #ffffff;

    transform: translateY(-2px);

    box-shadow:
        0 8px 22px rgba(24,197,209,.18);
}

.mer-header-arrow {
    font-size: 18px;

    transition: transform .25s ease;
}

.mer-header-cta:hover .mer-header-arrow {
    transform: translate(3px,-3px);
}


/* =========================================================
   NAVEGACIÓN DESKTOP
   ========================================================= */

.mer-header-bottom {
    width: 100%;

    background: #fcfaf7;

    border-bottom: 1px solid rgba(47,42,40,.09);
}

.mer-header-nav {
    width: calc(100% - 90px);
    max-width: 1100px;

    min-height: 63px;

    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 45px;
}


/* ENLACES */

.mer-header-nav a {
    position: relative;

    min-height: 63px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #332e2b;

    text-decoration: none;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;

    line-height: 1;

    white-space: nowrap;

    transition:
        color .28s ease,
        transform .28s ease;
}


/* Hover elegante */

.mer-header-nav a::after {
    content: "";

    position: absolute;

    left: 50%;
    bottom: 13px;

    width: 0;
    height: 1.5px;

    background: #18c5d1;

    opacity: 0;

    transform: translateX(-50%);

    transition:
        width .3s ease,
        opacity .3s ease;
}

.mer-header-nav a:hover {
    color: #18c5d1;

    transform: translateY(-1px);
}

.mer-header-nav a:hover::after {
    width: 28px;
    opacity: 1;
}


/* =========================================================
   MENÚ MÓVIL
   ========================================================= */

.mer-mobile-menu {
    display: none;

    position: static;
}

.mer-mobile-menu summary {
    width: 45px;
    height: 45px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;

    cursor: pointer;

    list-style: none;

    border: 1px solid rgba(47,42,40,.13);

    background: transparent;
}

.mer-mobile-menu summary::-webkit-details-marker {
    display: none;
}

.mer-mobile-menu summary > span {
    display: block;

    width: 20px;
    height: 1.5px;

    background: #2f2a28;

    transition:
        transform .25s ease,
        opacity .25s ease;
}

.mer-mobile-menu[open] summary > span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.mer-mobile-menu[open] summary > span:nth-child(2) {
    opacity: 0;
}

.mer-mobile-menu[open] summary > span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}


/* PANEL */

.mer-mobile-panel {
    position: absolute;

    top: 100%;
    left: 0;
    right: 0;

    padding: 22px 24px 28px;

    background: #fcfaf7;

    border-top: 1px solid rgba(47,42,40,.08);
    border-bottom: 1px solid rgba(47,42,40,.12);

    box-shadow:
        0 18px 35px rgba(47,42,40,.09);
}


/* BUSCADOR MÓVIL */

.mer-mobile-search {
    width: 100%;

    margin-bottom: 22px;

    display: grid;

    grid-template-columns: 1fr 48px;
}

.mer-mobile-search input {
    width: 100%;

    min-width: 0;
    min-height: 50px;

    padding: 0 15px;

    border: 1px solid #dfd8d2;
    border-right: 0;

    border-radius: 0;

    outline: 0;

    background: #ffffff;

    color: #2f2a28;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 14px;
}

.mer-mobile-search input:focus {
    border-color: #18c5d1;
}

.mer-mobile-search button {
    border: 0;

    background: #18c5d1;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
}

.mer-mobile-search button svg {
    width: 20px;
    height: 20px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}


/* LINKS MÓVIL */

.mer-mobile-nav {
    display: flex;
    flex-direction: column;
}

.mer-mobile-nav a {
    display: flex;
    align-items: center;

    min-height: 51px;

    color: #332e2b;

    text-decoration: none;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;

    border-bottom: 1px solid rgba(47,42,40,.08);

    transition:
        color .2s ease,
        padding-left .2s ease;
}

.mer-mobile-nav a:hover {
    padding-left: 5px;

    color: #18c5d1;
}


/* CTA MÓVIL */

.mer-mobile-cta {
    width: 100%;
    min-height: 55px;

    margin-top: 24px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    background: #18c5d1;
    color: #ffffff;

    text-decoration: none;

    font-family: "Manrope", Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;

    letter-spacing: .3px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .mer-header-top-inner {
        width: calc(100% - 50px);

        min-height: 84px;
    }

    .mer-header-logo img {
        width: 235px;
    }

    .mer-header-nav {
        width: calc(100% - 50px);

        gap: 25px;
    }

    .mer-header-nav a {
        font-size: 14px;
    }

    .mer-header-cta {
        padding-left: 20px;
        padding-right: 20px;

        font-size: 12px;
    }

}


/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 850px) {

    .mer-header-top-inner {
        width: calc(100% - 36px);

        min-height: 76px;

        gap: 20px;
    }

    .mer-header-logo img {
        width: 205px;
    }

    .mer-header-actions,
    .mer-header-bottom {
        display: none;
    }

    .mer-mobile-menu {
        display: block;
    }

}


/* =========================================================
   MÓVIL PEQUEÑO
   ========================================================= */

@media (max-width: 480px) {

    .mer-header-top-inner {
        width: calc(100% - 30px);

        min-height: 72px;
    }

    .mer-header-logo img {
        width: 180px;
    }

    .mer-mobile-menu summary {
        width: 42px;
        height: 42px;
    }

}

/* =========================================================
   ACCIONES E-COMMERCE - MI CUENTA Y BOLSA
   Se conserva el estilo original del header de Mertherapy.
   ========================================================= */

.mer-header-actions .mer-header-account,
.mer-header-actions .mer-header-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex-shrink: 0;
    min-height: 44px;
    color: #625b57;
    font-family: "Manrope", Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    transition: color .25s ease, transform .25s ease;
}

.mer-header-account:hover,
.mer-header-cart:hover,
.mer-header .mer-cart-has-items {
    color: #159fa9;
}

.mer-header-account svg,
.mer-header-cart svg {
    display: block;
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mer-header-cart-icon {
    display: inline-flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 31px;
}

.mer-cart-count {
    position: absolute;
    top: -6px;
    right: -12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #fcfaf7;
    border-radius: 20px;
    background: #ede4df;
    color: #5f504b;
    font-family: "Manrope", Arial, sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: background .2s ease, color .2s ease;
}

.mer-cart-has-items .mer-cart-count {
    background: #18c5d1;
    color: #fff;
}

.mer-cart-count-pop {
    animation: merCartBadgePop .38s ease both;
}

@keyframes merCartBadgePop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.mer-mobile-tools {
    display: none;
}

/* Ajustar espacio de acciones en portátiles/tablets antes del menú móvil. */
@media (min-width: 851px) and (max-width: 1100px) {
    .mer-header-top-inner { gap: 16px; }
    .mer-header-actions { gap: 17px; }
    .mer-header-actions .mer-header-account,
    .mer-header-actions .mer-header-cart { font-size: 13px; gap: 7px; }
    .mer-header-actions .mer-header-cart svg,
    .mer-header-actions .mer-header-account svg { width: 21px; height: 21px; }
}

@media (min-width: 851px) and (max-width: 970px) {
    .mer-header-actions .mer-account-label,
    .mer-header-actions .mer-cart-label { display: none; }
    .mer-header-actions { gap: 19px; }
}

/* En móvil: logo | cuenta | bolsa | hamburguesa. */
@media (max-width: 850px) {
    .mer-mobile-tools {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 9px;
        min-width: 0;
        flex-shrink: 0;
    }

    .mer-mobile-tools .mer-mobile-icon {
        width: 39px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        color: #403833;
        text-decoration: none;
        border: 1px solid transparent;
        transition: color .2s ease, background .2s ease;
    }

    .mer-mobile-tools .mer-mobile-icon:hover {
        color: #159fa9;
        background: rgba(24,197,209,.05);
    }

    .mer-mobile-tools .mer-header-cart-icon { width: 27px; }
    .mer-mobile-tools .mer-cart-count { top: -7px; right: -11px; }
    .mer-mobile-tools .mer-mobile-menu { display: block; }
}

@media (max-width: 480px) {
    .mer-header-top-inner { gap: 8px; }
    .mer-header-logo img { width: 165px; }
    .mer-mobile-tools { gap: 5px; }
    .mer-mobile-tools .mer-mobile-icon { width: 36px; height: 40px; }
    .mer-mobile-tools .mer-mobile-icon svg { width: 21px; height: 21px; }
}

@media (max-width: 360px) {
    .mer-header-top-inner { width: calc(100% - 24px); gap: 5px; }
    .mer-header-logo img { width: 145px; }
    .mer-mobile-tools { gap: 3px; }
    .mer-mobile-tools .mer-mobile-icon { width: 34px; height: 39px; }
    .mer-mobile-menu summary { width: 38px; height: 39px; }
}

@media (prefers-reduced-motion: reduce) {
    .mer-cart-count-pop { animation: none; }
}
