/* SELECTOR DE SEXO */
.sexo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.sexo-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-soft);
}

@media (max-width: 359px) {
    .sexo-card {
        padding: 0.7rem 0.5rem;
    }
}

.sexo-card:hover {
    border-color: var(--secondary-color);
}

.sexo-card.active {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.sexo-icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
    display: block;
}

.sexo-label {
    font-family: var(--font-primary);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-color);
}

/* SLIDER DE ALTURA */
.altura-slider-wrap {
    position: relative;
    padding: 0.5rem 0;
}

.altura-display {
    text-align: center;
    font-family: var(--font-primary);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.altura-display small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--secondary-color) 0%, var(--secondary-color) 50%, var(--border-color) 50%);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.altura-marks {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
}

.altura-marks span {
    font-family: var(--font-primary);
    font-size: 0.72rem;
    color: var(--text-muted);
}

@media (max-width: 479px) {
    .altura-marks span {
        font-size: 0.6rem;
    }
}

/* SELECTOR DE COMPLEXIÓN */
.complexion-wrap {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.comp-btn {
    flex: 1;
    padding: 0.45rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-soft);
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comp-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.comp-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* TABLA DE FÓRMULAS */
.formulas-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

.formulas-tabla thead th {
    background: var(--primary-color);
    color: #fff;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.7rem 1rem;
    text-align: left;
}

.formulas-tabla thead th:first-child {
    border-radius: 6px 0 0 0;
}

.formulas-tabla thead th:last-child {
    border-radius: 0 6px 0 0;
    text-align: right;
}

.formulas-tabla tbody tr {
    transition: background var(--transition);
}

.formulas-tabla tbody tr:nth-child(even) {
    background: var(--bg-soft);
}

.formulas-tabla tbody tr:hover {
    background: #dbeafe;
}

.formulas-tabla tbody tr.formula-highlight {
    background: #eff6ff;
    border-left: 3px solid var(--secondary-color);
}

.formulas-tabla td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.formulas-tabla td:last-child {
    text-align: right;
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-color);
    white-space: nowrap;
}

@media (max-width: 479px) {

    .formulas-tabla thead th,
    .formulas-tabla td {
        padding: 0.5rem 0.6rem;
    }

    .formulas-tabla thead th {
        font-size: 0.68rem;
    }

    .formulas-tabla td {
        font-size: 0.82rem;
    }

    .formulas-tabla td:last-child {
        font-size: 0.9rem;
    }
}

.formula-nombre {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.formula-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.formula-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    background: #dbeafe;
    color: #1e40af;
    font-family: var(--font-primary);
    font-weight: 700;
    white-space: nowrap;
}

/* GRÁFICO COMPARATIVO SVG */
/* Wrapper con scroll para el gráfico en móvil */
#chartSection .chart-wrap,
#chartComparativa {
    display: block;
}

#chartComparativa {
    min-width: 0;
}

@media (max-width: 479px) {

    #chartSection {
        margin-left: -0.1rem;
        margin-right: -0.1rem;
        overflow: hidden;
        border-radius: 12px;
    }

    #chartComparativa {
        min-width: 350px;
        width: 100%;
        min-height: 200px;
    }

    /* Wrapper de scroll — usamos el chart-section como scroll container */
    #chartSection {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* LEYENDA DEL GRÁFICO (.chart-legend) */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
    font-family: var(--font-primary);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.chart-legend span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.chart-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 479px) {
    .chart-legend {
        gap: 0.4rem 0.6rem;
        font-size: 0.72rem;
    }
}

/* MEDIDOR VISUAL */
.medidor-wrap {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.silueta-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.peso-actual-label {
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.medidor-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    justify-content: center;
    min-width: 0;
}

.medidor-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 0;
    gap: 0.5rem;
}

.medidor-stat-label {
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.medidor-stat-label i {
    color: var(--secondary-color);
    width: 14px;
    flex-shrink: 0;
}

.medidor-stat-val {
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 540px) {
    .medidor-wrap {
        flex-direction: column;
    }

    .silueta-wrap {
        flex-direction: row;
        align-items: center;
    }
}

@media (max-width: 479px) {
    .medidor-stat {
        padding: 0.55rem 0.7rem;
    }

    .medidor-stat-label {
        font-size: 0.72rem;
    }

    .medidor-stat-val {
        font-size: 0.85rem;
    }
}

@media (max-width: 359px) {
    .medidor-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .medidor-stat-val {
        font-size: 0.9rem;
    }
}

/* BARRA IMC */
.imc-barra-wrap {
    margin-top: 0.5rem;
}

.imc-barra-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.imc-barra-labels span {
    font-family: var(--font-primary);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
}

@media (max-width: 479px) {
    .imc-barra-labels span {
        font-size: 0.58rem;
    }
}

.imc-barra-bg {
    position: relative;
    height: 18px;
    border-radius: 50px;
    overflow: visible;
    display: flex;
}

.imc-seg {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.imc-seg:first-child {
    border-radius: 50px 0 0 50px;
}

.imc-seg:last-child {
    border-radius: 0 50px 50px 0;
}

.imc-marker {
    position: absolute;
    top: -6px;
    width: 4px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: left 0.5s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.imc-marker::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid #fff;
}

.imc-categorias {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.imc-cat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    /* → FIX: cada chip no parte entre líneas */
    white-space: nowrap;
}

.imc-cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 479px) {
    .imc-cat {
        font-size: 0.65rem;
    }
}