/* ── MP Forms — Estilos de campos especiales ──────────────────────────────── */

/* Sí / No / N/A */
.form-yesno-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-yesno-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-yesno-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 8px 16px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    background: #fff;
    color: #374151;
}

.form-yesno-label:hover {
    border-color: #6b7280;
    background: #f9fafb;
}

.form-yesno-input:checked + .form-yesno-label {
    border-color: currentColor;
    font-weight: 600;
}

.form-yesno-item:nth-child(1) .form-yesno-input:checked + .form-yesno-label {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.form-yesno-item:nth-child(2) .form-yesno-input:checked + .form-yesno-label {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.form-yesno-item:nth-child(3) .form-yesno-input:checked + .form-yesno-label {
    background: #f3f4f6;
    border-color: #6b7280;
    color: #374151;
}

/* Valoración con estrellas */
.form-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 4px;
    width: fit-content;
}

.form-rating-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-rating-star {
    font-size: 28px;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.1s ease;
    line-height: 1;
}

.form-rating:hover .form-rating-star,
.form-rating-input:checked ~ .form-rating-star {
    color: #f59e0b;
}

.form-rating-star:hover ~ .form-rating-star {
    color: #d1d5db;
}

/* Slider / Rango */
.form-range-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-range-track {
    position: relative;
}

.form-range {
    width: 100%;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.4);
    transition: background 0.15s;
}

.form-range::-webkit-slider-thumb:hover {
    background: #2563eb;
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #3b82f6;
    cursor: pointer;
}

.form-range-value {
    display: inline-block;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    min-width: 40px;
}

.form-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
}

/* Archivo adjunto */
.form-file {
    width: 100%;
    padding: 8px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background: #f9fafb;
    transition: border-color 0.15s;
}

.form-file:hover,
.form-file:focus {
    border-color: #3b82f6;
    background: #eff6ff;
    outline: none;
}

/* Texto legal: una línea, con «Ver completo» al final --------------------- */

/* La columna es un flex item y, sin esto, NO baja de su contenido mínimo: como
   el aviso va en una sola línea (nowrap), ese mínimo es larguísimo y estira la
   columna hasta desbordar el formulario entero. */
.form-col[data-tipo="legal"] {
    min-width: 0;
}

.mp-legal {
    max-width: 100%;
    /* Tipografía y color los pone el tema en su skin: este aviso convive con el
       consentimiento de al lado y debe leerse igual que él. */
    color: inherit;
    font-size: inherit;
}

/* El summary es la fila: primero el texto, y el enlace SIEMPRE al final de
   ella. Con `order` se pinta el texto antes aunque en el HTML vaya después,
   que es lo que exige <details>: el summary tiene que ser el primer hijo. */
.mp-legal__summary {
    display: flex;
    flex-wrap: nowrap;   /* cerrado es UNA fila: el enlace va al final del renglón */
    align-items: baseline;
    gap: .4em;
    cursor: pointer;
    list-style: none;   /* fuera el triángulo del sistema */
}

.mp-legal__summary::-webkit-details-marker {
    display: none;
}

.mp-legal__summary:focus-visible {
    outline: 2px solid var(--mpf-accent, #3b82f6);
    outline-offset: 2px;
}

.mp-legal__toggle {
    order: 2;
    flex: 0 0 auto;     /* nunca se encoge: el texto es quien cede */
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

.mp-legal__text {
    order: 1;
    flex: 1 1 0;
    min-width: 0;       /* sin esto un flex item no baja de su contenido y no recorta */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-legal__text p {
    display: inline;
    margin: 0;
}

.mp-legal__text a {
    color: inherit;
    text-decoration: underline;
}

/* Abierto: el texto sale del renglón y se lee entero. */
.mp-legal[open] .mp-legal__summary {
    flex-wrap: wrap;
}

.mp-legal[open] .mp-legal__text {
    flex: 1 1 100%;     /* ocupa su propia fila y deja el enlace debajo */
    white-space: normal;
    overflow: visible;
    margin-top: 8px;
    max-height: 220px;  /* un aviso largo no debe empujar el botón fuera de pantalla */
    overflow-y: auto;
    padding-left: 10px;
    border-left: 2px solid #e5e7eb;
}

.mp-legal[open] .mp-legal__text p {
    display: block;
    margin: 0 0 8px;
}

.mp-legal[open] .mp-legal__text p:last-child {
    margin-bottom: 0;
}

/* El enlace alterna según el estado */
.mp-legal__toggle--menos { display: none; }
.mp-legal[open] .mp-legal__toggle--mas   { display: none; }
.mp-legal[open] .mp-legal__toggle--menos { display: inline; }
