/* ============================================================
   T-Móvil Forms — CSS compartido para todos los formularios
   Layout 2 columnas desktop / 1 columna móvil
   ============================================================ */

:root {
    --tmf-black:  #1a1a1a;
    --tmf-red:    #e4002b;
    --tmf-blue:   #0052cc;
    --tmf-green:  #00875a;
    --tmf-amber:  #974f0c;
    --tmf-gray:   #6b778c;
    --tmf-light:  #f4f5f7;
    --tmf-border: #dfe1e6;
    --tmf-white:  #ffffff;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.tmf-form-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--tmf-black);
    background: var(--tmf-white);
}

/* ── Topbar ──────────────────────────────────────────────── */
.tmf-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tmf-form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--tmf-black);
    margin: 0;
    line-height: 1.2;
    flex: 1;
}

.tmf-btn-nav-top {
    display: inline-block;
    flex-shrink: 0;
    color: var(--tmf-blue);
    border: 1.5px solid var(--tmf-blue);
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
    line-height: 1.4;
}

.tmf-btn-nav-top:hover {
    background: var(--tmf-blue);
    color: var(--tmf-white);
    text-decoration: none;
}

/* ── Instrucción obligatoria en rojo ─────────────────────── */
.tmf-required-notice {
    color: var(--tmf-red);
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 20px;
}

/* ── Alertas ─────────────────────────────────────────────── */
.tmf-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.5;
    display: none;
}

.tmf-alert.visible { display: block; }

.tmf-alert-error {
    background: #ffebe6;
    color: #8e0000;
    border-left: 4px solid var(--tmf-red);
}

.tmf-alert-warning {
    background: #fffae6;
    color: var(--tmf-amber);
    border-left: 4px solid #f0c33c;
}

.tmf-alert-warning a { color: var(--tmf-blue); }

/* ── Barra de progreso ───────────────────────────────────── */
.tmf-progress {
    height: 4px;
    background: var(--tmf-border);
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
    display: none;
}

.tmf-progress.visible { display: block; }

.tmf-progress-bar {
    height: 100%;
    background: var(--tmf-blue);
    width: 0%;
    transition: width .35s ease;
    border-radius: 2px;
}

/* ── Heading de sección (separador visual entre bloques) ─── */
.tmf-section-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--tmf-black);
    padding: 4px 0 10px;
    margin: 10px 0 4px;
    border-bottom: 2px solid var(--tmf-border);
}

/* ── Grid 2 columnas ─────────────────────────────────────── */
.tmf-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
}

.tmf-col-full {
    grid-column: 1 / -1;
}

/* ── Campo individual ────────────────────────────────────── */
.tmf-field {
    margin-bottom: 18px;
}

/* ── Etiquetas ───────────────────────────────────────────── */
.tmf-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--tmf-black);
    margin-bottom: 6px;
}

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

/* ── Inputs / selects / textarea ─────────────────────────── */
.tmf-input,
.tmf-select,
.tmf-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    border: 1.5px solid var(--tmf-border);
    border-radius: 6px;
    font-size: 16px;
    color: var(--tmf-black);
    background: var(--tmf-white);
    font-family: inherit;
    transition: border-color .18s, box-shadow .18s;
    -webkit-appearance: none;
    appearance: none;
}

.tmf-input:focus,
.tmf-select:focus,
.tmf-textarea:focus {
    outline: none;
    border-color: var(--tmf-blue);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, .12);
}

.tmf-input.tmf-error,
.tmf-select.tmf-error,
.tmf-textarea.tmf-error { border-color: var(--tmf-red); }

.tmf-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%236b778c' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
    cursor: pointer;
}

.tmf-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* ── Error por campo ─────────────────────────────────────── */
.tmf-field-error {
    display: none;
    color: var(--tmf-red);
    font-size: 12px;
    margin-top: 4px;
}

.tmf-field-error.visible { display: block; }

/* ── Zona de foto ────────────────────────────────────────── */
.tmf-photo-field {
    position: relative;
    border: 2px dashed var(--tmf-border);
    border-radius: 6px;
    background: var(--tmf-light);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color .18s, background .18s;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.tmf-photo-field:hover,
.tmf-photo-field.drag-over {
    border-color: var(--tmf-blue);
    background: #f0f4ff;
}

.tmf-photo-field.tmf-error { border-color: var(--tmf-red); }

.tmf-photo-field input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.tmf-photo-placeholder { pointer-events: none; width: 100%; }

.tmf-photo-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 6px;
    line-height: 1;
}

.tmf-photo-hint {
    font-size: 13px;
    color: var(--tmf-gray);
    font-weight: 500;
    margin: 0;
}

.tmf-photo-hint small {
    display: block;
    font-size: 11px;
    color: #aab;
    margin-top: 3px;
}

.tmf-photo-preview {
    display: none;
    position: relative;
    width: 100%;
    pointer-events: none;
}

.tmf-photo-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.tmf-photo-preview-name {
    font-size: 11px;
    color: var(--tmf-gray);
    margin: 5px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tmf-photo-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
}

.tmf-photo-preview-remove:hover { background: rgba(0, 0, 0, .85); }

.tmf-photo-field.has-file .tmf-photo-placeholder { display: none; }
.tmf-photo-field.has-file .tmf-photo-preview    { display: block; }

/* ── Botón submit negro, ancho completo ──────────────────── */
.tmf-btn-submit {
    display: block;
    width: 100%;
    background: var(--tmf-black);
    color: var(--tmf-white);
    border: none;
    border-radius: 6px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background .18s, transform .1s;
    font-family: inherit;
    letter-spacing: .3px;
    margin-top: 4px;
}

.tmf-btn-submit:hover:not(:disabled) { background: #333; }
.tmf-btn-submit:active:not(:disabled) { transform: scale(.99); }
.tmf-btn-submit:disabled { background: #888; cursor: not-allowed; }

.tmf-btn-secondary {
    background: var(--tmf-white);
    color: var(--tmf-black);
    border: 1.5px solid var(--tmf-border);
    margin-bottom: 12px;
}

.tmf-btn-secondary:hover:not(:disabled) {
    background: var(--tmf-light);
}

.tmf-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tmf-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

.tmf-btn-submit.loading .tmf-spinner { display: inline-block; }

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

/* ── Pantalla de éxito ───────────────────────────────────── */
.tmf-success {
    display: none;
    text-align: center;
    padding: 40px 0 20px;
}

.tmf-success.visible { display: block; }

.tmf-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #e3fcef;
    color: var(--tmf-green);
    font-size: 36px;
    margin-bottom: 16px;
}

.tmf-success h2 {
    font-size: 22px;
    color: var(--tmf-black);
    margin: 0 0 10px;
    font-weight: 700;
}

.tmf-success p {
    color: var(--tmf-gray);
    font-size: 14px;
    margin: 0 0 28px;
    line-height: 1.5;
}

/* ── Aviso de login ──────────────────────────────────────── */
.tmf-login-notice {
    background: #fffae6;
    border: 1px solid #f0c33c;
    border-radius: 8px;
    padding: 22px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
}

/* ── Input readonly ──────────────────────────────────────── */
.tmf-input-readonly {
    background: var(--tmf-light);
    color: var(--tmf-gray);
    cursor: default;
}

/* ── Radio group ─────────────────────────────────────────── */
.tmf-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    padding: 4px 0 2px;
}

.tmf-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--tmf-black);
    cursor: pointer;
    user-select: none;
}

.tmf-radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--tmf-blue);
    cursor: pointer;
    flex-shrink: 0;
}

/* Repeater */
.tmf-repeater-item {
    border: 1.5px solid var(--tmf-border);
    border-radius: 6px;
    padding: 16px;
    margin: 0 0 16px;
    background: var(--tmf-white);
}

.tmf-repeater-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.tmf-repeater-head strong {
    font-size: 15px;
    color: var(--tmf-black);
}

.tmf-repeater-remove {
    border: 1.5px solid var(--tmf-red);
    background: var(--tmf-white);
    color: var(--tmf-red);
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.tmf-repeater-remove:hover {
    background: #ffebe6;
}

/* ── Select2 integration ─────────────────────────────────── */
.select2-container--default .select2-selection--single {
    height: 46px;
    border: 1.5px solid var(--tmf-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 16px;
    font-family: inherit;
    background: var(--tmf-white);
    transition: border-color .18s, box-shadow .18s;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default .select2-selection--single:focus {
    border-color: var(--tmf-blue);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, .12);
    outline: none;
}

.select2-container--default.tmf-error .select2-selection--single {
    border-color: var(--tmf-red);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding: 0;
    color: var(--tmf-black);
    font-size: 16px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--tmf-gray);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px;
    right: 10px;
}

.select2-dropdown {
    border: 1.5px solid var(--tmf-blue);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    font-family: inherit;
    font-size: 15px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--tmf-blue);
}

.select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--tmf-border);
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 15px;
    font-family: inherit;
}

/* ── Responsivo ──────────────────────────────────────────── */
@media ( max-width: 767px ) {
    .tmf-grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .tmf-col-full { grid-column: 1; }

    .tmf-form-title { font-size: 22px; }

    .tmf-topbar { gap: 10px; }

    .tmf-btn-nav-top {
        padding: 7px 14px;
        font-size: 13px;
    }

    .tmf-form-wrap { padding: 14px 12px 32px; }
}
