/* ═══════════════════════════════════════════════════════════
   Zander Hub · Formularios — Vista pública (form.php)
   Estética: fondo blanco, cuadrícula sutil, card, amarillo Zander.
   Scope: página standalone sin auth. NO mezclar con panel interno.
   ═══════════════════════════════════════════════════════════ */

/* ── Reset mínimo ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ── */
:root {
    /* Escala tipográfica (mirrors hub tokens — sin ajuste de hub porque es página standalone) */
    --ts-caption: 11.5px;
    --ts-label:   12.5px;
    --ts-sm:      13px;
    --ts-base:    14px;
    --ts-md:      15px;
    --ts-lg:      17px;
    --ts-xl:      21px;
    --ts-2xl:     27px;

    --zf-accent:      #fcc61c;
    --zf-accent-dark: #d4a000;
    --zf-accent-15:   rgba(252, 198, 28, 0.15);
    --zf-accent-35:   rgba(252, 198, 28, 0.35);
    --zf-ink:         #111111;
    --zf-muted:       #888888;
    --zf-border:      #cccccc;
    --zf-surface:     #ffffff;
    --zf-bg:          #f9f9f9;
    --zf-error:       #dc2626;
    --zf-error-bg:    #fff5f5;
    --zf-error-bdr:   #fca5a5;
    --zf-ok:          #22c55e;
    --zf-font:        'Nunito', sans-serif;
    /* Dinámica por formulario — se sobreescribe en línea desde PHP */
    --zf-color:       #fcc61c;
    --zf-color-15:    rgba(252, 198, 28, 0.15);
    --zf-color-35:    rgba(252, 198, 28, 0.35);
}

/* ── Body con cuadrícula de fondo ── */
body {
    font-family: var(--zf-font);
    background-color: #fafafa;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 20px;
    color: var(--zf-ink);
}

/* ── Contenedor ── */
.zf-wrap {
    width: 100%;
    max-width: 640px;
}

/* ── Cabecera de marca ── */
.zf-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
    text-decoration: none;
}

.zf-brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: block;
}

.zf-brand-wordmark {
    font-size: var(--ts-lg);
    font-weight: 900;
    color: var(--zf-ink);
    letter-spacing: -0.3px;
}

/* ── Card principal ── */
.zf-card {
    background: var(--zf-surface);
    border-radius: 20px;
    padding: 44px 48px 40px;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.08);
}

/* ── Cabecera del formulario ── */
.zf-title {
    font-size: var(--ts-2xl);
    font-weight: 900;
    color: var(--zf-ink);
    margin-bottom: 6px;
    line-height: 1.2;
}

.zf-desc {
    font-size: var(--ts-md);
    color: var(--zf-muted);
    line-height: 1.6;
    margin-bottom: 32px;
}

/* ── Caja informativa tipo alerta bienvenida ── */
.zf-intro {
    background: #f5f5f5;
    border-left: 4px solid var(--zf-color);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 24px;
    font-size: var(--ts-base);
    color: #444;
    line-height: 1.6;
}

/* ── Separadores de sección ── */
.form-section-title {
    font-size: var(--ts-caption);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--zf-color);
    border-bottom: 2px solid var(--zf-color);
    padding-bottom: 6px;
    margin: 32px 0 20px;
}

.form-section-title:first-child {
    margin-top: 0;
}

/* ── Fila de 2 columnas ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 0;
}

/* ── Grupo de campo ── */
.form-group {
    position: relative;
    margin-bottom: 28px;
}

/* ── Inputs / textarea / select — línea inferior ── */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--zf-border);
    border-radius: 0;
    padding: 10px 0 8px;
    color: var(--zf-ink);
    font-family: var(--zf-font);
    font-size: var(--ts-md);
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #bbb;
    font-weight: 400;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-bottom-color: var(--zf-color);
}

/* ── Estados de validación ── */
.form-input.input-ok    { border-bottom-color: var(--zf-ok); }
.form-input.input-error { border-bottom-color: var(--zf-error); }

.field-hint {
    display: block;
    font-size: var(--ts-label);
    font-weight: 600;
    margin-top: 4px;
    min-height: 16px;
    transition: color 0.2s;
}

/* ── Select con flecha personalizada ── */
.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #bbb;
    pointer-events: none;
    transition: border-top-color 0.2s;
}

.select-wrap:focus-within::after {
    border-top-color: var(--zf-color);
}

.form-select {
    cursor: pointer;
    padding-right: 20px;
}

.form-select option {
    color: var(--zf-ink);
    background: #fff;
}

/* ── Textarea ── */
.form-textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.5;
}

/* ── Label de campo (para checkboxes en grupos) ── */
.form-group > label:not(.form-check):not(.file-upload-label) {
    display: block;
    font-size: var(--ts-base);
    font-weight: 700;
    margin-bottom: 10px;
    color: #555;
}

/* ── Grupos de radio/checkbox ── */
.form-check-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 6px 0;
}

.form-check-group.inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--ts-md);
    font-weight: 600;
    color: #333;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--zf-color);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Consentimiento RGPD ── */
.form-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 32px;
    margin-top: 4px;
}

.form-consent input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--zf-color);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.form-consent label {
    font-size: var(--ts-base);
    color: #555;
    line-height: 1.6;
    cursor: pointer;
}

.form-consent a {
    color: var(--zf-ink);
    font-weight: 700;
    text-decoration: underline;
}

/* ── Subida de archivos — línea dashed ── */
.file-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1.5px dashed var(--zf-border);
    padding: 10px 0 8px;
    cursor: pointer;
    color: #999;
    font-size: var(--ts-base);
    font-weight: 600;
    transition: border-color 0.2s, color 0.2s;
}

.file-upload-label svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.file-upload-label:hover,
.file-upload-label.has-file {
    border-bottom-color: var(--zf-color);
    color: #333;
}

.file-upload-label.has-file svg {
    opacity: 1;
}

.file-upload-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-input {
    display: none;
}

/* ── Zona de arrastre (drag & drop) ── */
.file-drop {
    border: 1.5px dashed var(--zf-border);
    border-radius: 12px;
    padding: 22px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-top: 4px;
}

.file-drop:hover {
    border-color: var(--zf-color);
    background: var(--zf-color-15);
}

.file-drop input[type="file"] { display: none; }

.file-drop p {
    font-size: var(--ts-sm);
    color: #aaa;
    margin-top: 4px;
    font-weight: 600;
}

.file-drop strong { color: var(--zf-color); font-weight: 800; }

.file-list {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.file-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: var(--ts-label);
    font-weight: 700;
    color: #555;
}

/* ── Botones de servicio dinámicos (onboarding-web-seo / corporativa) ── */
.zf-svc-card {
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    position: relative;
}

.zf-svc-card-label {
    font-size: var(--ts-sm);
    font-weight: 700;
    margin-bottom: 10px;
    color: #444;
}

.zf-svc-card .form-input  { margin-bottom: 8px; }
.zf-svc-card .form-textarea { min-height: 70px; }

.zf-add-svc-btn {
    background: transparent;
    border: 1.5px dashed #ccc;
    color: #888;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--zf-font);
    font-size: var(--ts-base);
    width: 100%;
    text-align: center;
    transition: border-color 0.2s, color 0.2s;
}

.zf-add-svc-btn:hover {
    border-color: var(--zf-color);
    color: var(--zf-ink);
}

.zf-svc-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: var(--ts-label);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Mensaje de error global ── */
.zf-error-box {
    background: var(--zf-error-bg);
    border: 1px solid var(--zf-error-bdr);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: var(--ts-base);
    font-weight: 600;
    color: var(--zf-error);
    margin-bottom: 24px;
}

/* ── Botón enviar ── */
.zf-submit-wrap {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.zf-btn-submit {
    background: var(--zf-color);
    color: #000;
    border: none;
    border-radius: 100px;
    padding: 15px 52px;
    font-family: var(--zf-font);
    font-size: var(--ts-md);
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px var(--zf-color-35);
}

.zf-btn-submit:hover {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--zf-color-35);
}

.zf-btn-submit:active  { transform: translateY(0); }

.zf-btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Spinner pequeño dentro del botón ── */
@keyframes zf-spin { to { transform: rotate(360deg); } }

.zf-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: zf-spin 0.6s linear infinite;
    display: inline-block;
}

/* ── Pantalla de éxito ── */
.zf-success {
    text-align: center;
    padding: 56px 20px;
}

.zf-success-icon {
    width: 80px;
    height: 80px;
    background: var(--zf-color-15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.zf-success-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--zf-color);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.zf-success-title {
    font-size: var(--ts-2xl);
    font-weight: 900;
    color: var(--zf-ink);
    margin-bottom: 10px;
}

.zf-success-msg {
    font-size: var(--ts-md);
    color: var(--zf-muted);
    line-height: 1.7;
    max-width: 380px;
    margin: 0 auto;
}

/* ── Pantalla "próximamente" ── */
.zf-coming-soon {
    text-align: center;
    padding: 56px 20px;
}

.zf-coming-soon svg {
    width: 48px;
    height: 48px;
    stroke: #ccc;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 20px;
}

.zf-coming-soon h2 {
    font-size: var(--ts-xl);
    font-weight: 800;
    color: #333;
    margin-bottom: 8px;
}

.zf-coming-soon p {
    font-size: var(--ts-md);
    color: var(--zf-muted);
    line-height: 1.6;
}

/* ── Footer ── */
.zf-footer {
    text-align: center;
    margin-top: 20px;
    font-size: var(--ts-label);
    color: #bbb;
}

/* ── Modo embed (iframe sin marca ni padding) ── */
body.zf-embed {
    padding: 0;
    background-color: transparent;
    background-image: none;
}

body.zf-embed .zf-brand,
body.zf-embed .zf-footer {
    display: none;
}

body.zf-embed .zf-card {
    background: transparent;
    box-shadow: none;
    padding: 20px 0 4px;
    border-radius: 0;
}

body.zf-embed .zf-wrap {
    max-width: 100%;
}

/* ── 404 / error de formulario ── */
.zf-404 {
    text-align: center;
    padding: 64px 20px;
}

.zf-404 svg {
    width: 56px;
    height: 56px;
    stroke: #ddd;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 20px;
}

.zf-404 h2 {
    font-size: var(--ts-xl);
    font-weight: 900;
    color: #333;
    margin-bottom: 8px;
}

.zf-404 p {
    font-size: var(--ts-md);
    color: var(--zf-muted);
}

/* ── Responsive ── */
@media (max-width: 540px) {
    body { padding: 24px 16px; }
    .zf-card { padding: 28px 20px 24px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .zf-btn-submit { padding: 14px 36px; }
    .zf-title { font-size: var(--ts-xl); }
}

/* ── Accesibilidad: sin animaciones si el usuario lo prefiere ── */
@media (prefers-reduced-motion: reduce) {
    .zf-btn-submit,
    .form-input,
    .form-textarea,
    .form-select,
    .file-upload-label {
        transition: none;
    }
    .zf-btn-submit:hover { transform: none; }
    .zf-spinner { animation: none; }
}

/* ── Anti-zoom iOS/iPadOS: Safari hace zoom al enfocar un control con
   font-size < 16px. En táctil subimos los controles a 16px (desktop intacto). ── */
@media (pointer: coarse) {
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px;
    }
}
