/* === PDP — Popup "Guía de tallas" / "¿Cuál es mi talla?" ===
 * Magento_Catalog::product/view/elg-size-guide.phtml (port del componente PWA
 * YBRecomendadorTalla). Mismos colores que el PWA: #223041 pestañas/tabla,
 * #0f233f botones, #ff3705 talla recomendada. */

html.elg-sg-lock { overflow: hidden; }

.elg-sg {
    position: fixed;
    inset: 0;
    z-index: 9200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.elg-sg.is-open {
    pointer-events: auto;
    opacity: 1;
}
.elg-sg-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4,29,64,0.45);
}
.elg-sg-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(1280px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--color-bg);
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    padding: 3.5rem 2rem 2rem;
    color: #223041;
    transform: translate(-50%, -46%) scale(0.98);
    transition: transform 0.25s ease;
}
.elg-sg.is-open .elg-sg-panel { transform: translate(-50%, -50%) scale(1); }
.elg-sg-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #223041;
    cursor: pointer;
    transition: opacity 0.2s;
}
.elg-sg-close:hover { opacity: 0.6; }
.elg-sg-close svg { width: 1.75rem; height: 1.75rem; }

/* Layout: imagen a la izquierda, contenido a la derecha */
.elg-sg-body {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}
.elg-sg-image {
    flex: 0 0 370px;
    max-width: 370px;
    align-self: center;
}
.elg-sg-image img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
}
.elg-sg-content {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}

/* Pestañas */
.elg-sg-tabs {
    display: flex;
    justify-content: center;
    margin: 0 0 1.5rem;
}
.elg-sg-tab {
    width: 50%;
    max-width: 240px;
    height: 64px;
    border: 1px solid #223041;
    background: #fff;
    color: #223041;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.elg-sg-tab + .elg-sg-tab { border-left: 0; }
.elg-sg-tab.is-active {
    background: #223041;
    color: #fff;
}

/* === Guía: botones de talla + tabla === */
.elg-sg-sizes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 0 0 1.5rem;
}
.elg-sg-size {
    min-width: 68px;
    height: 48px;
    padding: 0 1rem;
    border: 1px solid #223041;
    background: #fff;
    color: #223041;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}
.elg-sg-size.is-active {
    background: #223041;
    color: #fff;
}
.elg-sg-table-wrap { overflow-x: auto; }
.elg-sg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    font-weight: 600;
}
.elg-sg-table th,
.elg-sg-table td {
    padding: 1rem 0.75rem;
    text-align: center;
    border: 1px solid #eee;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.elg-sg-table thead th {
    background: #f5f5f3;
    font-weight: 700;
}
.elg-sg-table .elg-sg-table-label { font-weight: 700; }
.elg-sg-table .is-highlight {
    background: #223041;
    color: #fff;
    font-weight: 700;
}
.elg-sg-note {
    margin: 1.25rem 0 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: left;
}

/* Calzado: "¿Cómo medir tu PIE?" debajo de la tabla */
.elg-sg-calzado { margin-top: 1.5rem; text-align: left; }
.elg-sg-calzado-title { margin: 0; font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; }
.elg-sg-calzado .elg-sg-note { margin-top: 0.5rem; font-weight: 400; }

/* Bloque CMS 'guia-de-tallas' (fallback sin medidas propias) */
.elg-sg-cms { text-align: left; }
.elg-sg-cms img { max-width: 100%; height: auto; }
.elg-sg-cms [data-toggle="collapse"] { cursor: pointer; }
/* La utilidad Tailwind .collapse (visibility: collapse) choca con la clase
 * Bootstrap "collapse" del bloque CMS; abrir/cerrar lo lleva el display. */
.elg-sg-cms .collapse { visibility: visible; }

/* === Recomendador: formulario === */
.elg-sg-heading { margin: 0 0 1.25rem; }
.elg-sg-heading-title {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}
.elg-sg-heading-icon { width: 36px; height: 36px; }
.elg-sg-heading-subtitle {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    font-weight: 700;
}
.elg-sg-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 2rem;
    text-align: left;
}
.elg-sg-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.elg-sg-label {
    font-size: 0.875rem;
    font-weight: 700;
}
.elg-sg-input {
    width: 100%;
    height: 58px;
    padding: 0 0.75rem;
    border: 1px solid #aaa;
    border-radius: 5px;
    background-color: #fff;
    color: #223041;
    font-size: 1rem;
    font-weight: 600;
}
.elg-sg-input:focus {
    outline: none;
    border-color: #223041;
}
.elg-sg-actions {
    margin-top: 2rem;
    text-align: center;
}
.elg-sg-btn {
    min-height: 60px;
    padding: 0 1.75rem;
    border: 1px solid #0f233f;
    background: #0f233f;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.2s;
}
.elg-sg-btn:hover { opacity: 0.9; }
.elg-sg-error {
    margin: 0.75rem 0 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #d32f2f;
}
.elg-sg-btn:disabled { opacity: 0.5; cursor: default; }

/* === Recomendador: resultado === */
.elg-sg-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
}
.elg-sg-result-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    line-height: 2;
}
.elg-sg-result-size {
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    line-height: 96px;
    font-weight: 800;
    color: #ff3705;
}
.elg-sg-percentages {
    width: 100%;
    max-width: 300px;
    margin: 0.75rem 0;
}
.elg-sg-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}
.elg-sg-slide-size {
    min-width: 35px;
    font-size: 1.25rem;
    font-weight: 700;
}
.elg-sg-slide-size.is-recommended { color: #ff3705; }
.elg-sg-bar {
    width: calc(100% - 30px);
    max-width: 230px;
    margin: 0.75rem;
}
.elg-sg-bar-pct {
    font-size: 0.9375rem;
    text-align: start;
}
.elg-sg-bar-arrow {
    width: 0;
    height: 0;
    border-inline-start: 5px solid transparent;
    border-inline-end: 5px solid transparent;
    border-block-start: 5px solid #000;
}
.elg-sg-bar-line {
    width: 100%;
    border-top: 2px solid currentColor;
}
.elg-sg-result .elg-sg-btn { margin-top: 0.5rem; }
.elg-sg-link {
    margin-top: 0.75rem;
    padding: 0.625rem 0.875rem;
    border: 0;
    background: transparent;
    color: #223041;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* Talla recomendada marcada en el desplegable de tallas del PDP */
.elg-pdp-size-btn.is-recommended .elg-pdp-size-label::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 0.4rem;
    border-radius: 50%;
    background: #ff3705;
    vertical-align: middle;
}

/* === Móvil: contenido arriba, imagen abajo y solo en la guía con medidas
 * (como el PWA, que en móvil oculta la foto del producto) === */
@media (max-width: 767px) {
    .elg-sg-panel {
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 3.5rem 1rem 1.5rem;
        transform: none;
    }
    .elg-sg.is-open .elg-sg-panel { transform: none; }
    .elg-sg-body {
        flex-direction: column;
        gap: 1rem;
    }
    .elg-sg-image {
        order: 2;
        flex: none;
        width: 100%;
        max-width: 295px;
        margin: 0 auto;
        display: none;
    }
    .elg-sg-body.has-medidas .elg-sg-image { display: block; }
    .elg-sg-content { width: 100%; }
    .elg-sg-tab {
        height: 52px;
        font-size: 1rem;
    }
    .elg-sg-sizes { gap: 0.5rem; }
    .elg-sg-size { min-width: 52px; height: 42px; padding: 0 0.5rem; }
    .elg-sg-table th,
    .elg-sg-table td { padding: 0.625rem 0.375rem; font-size: 0.75rem; }
    .elg-sg-heading-title { font-size: 1.375rem; }
    .elg-sg-fields { gap: 1rem; }
    .elg-sg-input { height: 48px; }
}
