/**
 * Estilos del formulario WP Insolvency Evaluator v2.
 * Diseño moderno y responsive sin dependencias externas.
 *
 * @package WP_Insolvency_Evaluator
 */

/* ── Tokens de diseño ───────────────────────────────────────────────────────── */
:root {
    --wpie-blue: #2563eb;
    --wpie-blue-dark: #1d4ed8;
    --wpie-blue-light: #eff6ff;
    --wpie-green: #16a34a;
    --wpie-red: #dc2626;
    --wpie-amber: #d97706;
    --wpie-text: #1e293b;
    --wpie-muted: #64748b;
    --wpie-border: #e2e8f0;
    --wpie-bg: #f8fafc;
    --wpie-white: #ffffff;
    --wpie-r: 8px;
    --wpie-r-sm: 5px;
    --wpie-shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
    --wpie-shadow-md: 0 4px 12px rgba(0, 0, 0, .1);
    --wpie-trans: all .2s ease;
    --wpie-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Wrapper Principal (Estilo Tarjeta App) ────────────────────────────────── */
.wpie-wrapper {
    font-family: var(--wpie-font);
    color: var(--wpie-text);
    max-width: 880px;
    margin: 2rem auto 3rem;
    padding: 35px 40px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    box-sizing: border-box;
}

.wpie-wrapper *,
.wpie-wrapper *::before,
.wpie-wrapper *::after {
    box-sizing: border-box;
}

@media (max-width: 620px) {
    .wpie-wrapper {
        padding: 20px 20px;
        margin: 1rem auto;
        border-radius: 12px;
    }
}

/* ── Secciones / Fieldsets ──────────────────────────────────────────────────── */
.wpie-section {
    border: 1px solid var(--wpie-border);
    border-radius: var(--wpie-r);
    padding: 22px 28px 18px;
    margin-bottom: 22px;
    background: var(--wpie-white);
    box-shadow: var(--wpie-shadow-sm);
    transition: box-shadow .2s ease;
}

.wpie-section:hover {
    box-shadow: var(--wpie-shadow-md);
}

.wpie-section__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--wpie-blue);
    padding: 0 8px;
}

/* ── Grid 2 columnas ────────────────────────────────────────────────────────── */
.wpie-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 22px;
}

@media (max-width: 620px) {
    .wpie-grid {
        grid-template-columns: 1fr;
    }
}

.wpie-field--full {
    grid-column: 1 / -1;
}

/* ── Campos ─────────────────────────────────────────────────────────────────── */
.wpie-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wpie-label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--wpie-text);
}

.wpie-req {
    color: var(--wpie-red);
    margin-left: 2px;
}

.wpie-hint {
    font-size: .8rem;
    color: var(--wpie-muted);
}

.wpie-hint--block {
    margin-bottom: 12px;
}

/* ── Inputs, Selects, Textareas (Estilo Fintech) ───────────────────────────── */
.wpie-input,
.wpie-select,
.wpie-textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: var(--wpie-font);
    color: var(--wpie-text);
    background-color: #f8fafc;
    /* Gris ultra claro */
    border: 1.5px solid var(--wpie-border);
    border-radius: var(--wpie-r);
    /* 8px */
    outline: none;
    transition: var(--wpie-trans);
    -webkit-appearance: none;
    appearance: none;
    line-height: 1.5;
}

.wpie-input::placeholder,
.wpie-textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.wpie-input:hover,
.wpie-select:hover,
.wpie-textarea:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.wpie-input:focus,
.wpie-select:focus,
.wpie-textarea:focus {
    border-color: var(--wpie-blue);
    background-color: var(--wpie-white);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .15);
    /* Anillo más premium */
}

.wpie-input--error {
    border-color: var(--wpie-red) !important;
    background-color: #fef2f2 !important;
}

/* Flecha personalizada para selects */
.wpie-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2364748b' d='M5.23 7.21a.75.75 0 011.06.02L10 11.169l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 32px;
    cursor: pointer;
}

.wpie-textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
}

/* Ocultar flechas en inputs numéricos (Chrome) */
.wpie-input[type="number"]::-webkit-inner-spin-button,
.wpie-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.wpie-input[type="number"] {
    -moz-appearance: textfield;
}

/* ── Radio buttons ──────────────────────────────────────────────────────────── */
.wpie-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wpie-radio-lbl {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px solid var(--wpie-border);
    border-radius: 20px;
    font-size: .875rem;
    cursor: pointer;
    background: var(--wpie-bg);
    transition: var(--wpie-trans);
}

.wpie-radio-lbl:hover {
    border-color: var(--wpie-blue);
    background: var(--wpie-blue-light);
}

.wpie-radio-lbl:has(input:checked) {
    border-color: var(--wpie-blue);
    background: var(--wpie-blue-light);
    color: var(--wpie-blue);
    font-weight: 600;
}

/* ── Checkboxes de alerta ───────────────────────────────────────────────────── */
.wpie-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.wpie-check-lbl {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 13px;
    border: 1.5px solid var(--wpie-border);
    border-radius: var(--wpie-r-sm);
    font-size: .875rem;
    line-height: 1.4;
    cursor: pointer;
    background: var(--wpie-bg);
    transition: var(--wpie-trans);
}

.wpie-check-lbl:hover {
    border-color: var(--wpie-amber);
    background: #fffbeb;
}

.wpie-check-lbl:has(input:checked) {
    border-color: var(--wpie-amber);
    background: #fffbeb;
    color: #92400e;
    font-weight: 600;
}

.wpie-check-lbl input[type="checkbox"] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    margin-top: 2px;
    accent-color: var(--wpie-amber);
    cursor: pointer;
}

.wpie-check-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wpie-check-title {
    font-weight: 500;
}

.wpie-check-desc {
    font-size: 0.75rem;
    color: var(--wpie-muted);
    line-height: 1.3;
}

.wpie-check-lbl:has(input:checked) .wpie-check-desc {
    color: #92400e;
    opacity: 0.8;
}

/* ── Botón de envío (CTA Premium) ──────────────────────────────────────────── */
.wpie-submit-row {
    text-align: center;
    padding: 15px 0 10px;
    margin-top: 20px;
}

.wpie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    /* En móviles ocupará 100%, en desktop 400px */
    padding: 18px 30px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-family: var(--wpie-font);
    color: var(--wpie-white);
    background: var(--wpie-blue);
    background-image: linear-gradient(135deg, var(--wpie-blue) 0%, rgb(30, 80, 199) 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, .4);
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 12px;
}

.wpie-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 14px 24px -6px rgba(37, 99, 235, .5);
    background-image: linear-gradient(135deg, rgb(43, 107, 245) 0%, var(--wpie-blue-dark) 100%);
}

.wpie-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 4px 10px -4px rgba(37, 99, 235, .4);
}

.wpie-btn:disabled,
.wpie-btn--loading {
    opacity: .72;
    cursor: not-allowed;
    transform: none !important;
}

/* Spinner animado */
.wpie-btn__spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpie-spin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes wpie-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Mensaje de respuesta AJAX ──────────────────────────────────────────────── */
.wpie-response {
    padding: 16px 20px;
    border-radius: var(--wpie-r);
    font-size: .95rem;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 18px;
    border-left: 4px solid transparent;
}

.wpie-response--success {
    background: #f0fdf4;
    border-color: var(--wpie-green);
    color: #14532d;
}

.wpie-response--error {
    background: #fef2f2;
    border-color: var(--wpie-red);
    color: #7f1d1d;
}