/**
 * Wizard Form Styles v2.0
 * Incluye: áreas dinámicas, protección datos, sección autorización
 */

/* ==================== RESET Y VARIABLES ==================== */
:root {
    --primary: #1f286d;
    --primary-dark: #161d4f;
    --primary-light: #e8ebf7;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #dde1e7;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f4f6fa;
    --white: #ffffff;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== HEADER ==================== */
.header {
    background: var(--primary);
    color: white;
    padding: 0;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo img {
    height: 48px;
    width: auto;
    border-radius: 6px;
    background: white;
    padding: 4px;
}

.header-logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.header-logo .subtitle {
    font-size: 0.82rem;
    opacity: 0.85;
    margin-top: 2px;
}

/* ==================== LOADING ==================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active { display: flex; }

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== WIZARD STEPPER ==================== */
.wizard-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

.wizard-progress {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 35px;
    position: relative;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 200px;
}

.wizard-step::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--border);
    z-index: 0;
}

.wizard-step:last-child::before { display: none; }

.step-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.wizard-step.active .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 6px rgba(31, 40, 109, 0.15);
}

.wizard-step.completed .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.wizard-step.completed::before {
    background: var(--success);
}

.step-label {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}

.wizard-step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 25px;
    line-height: 1.5;
}

/* ==================== FORMS ==================== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin-bottom: 8px;
}

.form-row.three-cols { grid-template-columns: repeat(3, 1fr); }
.form-row.full-width { grid-template-columns: 1fr; }

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 0.92rem;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 40, 109, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.is-valid {
    border-color: var(--success);
}

.invalid-feedback {
    display: none;
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-control.is-invalid ~ .invalid-feedback,
.is-invalid + .invalid-feedback { display: block; }

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.required { color: var(--danger); font-weight: 700; }

/* ==================== CHECKBOXES ==================== */
.form-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
}

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

.form-check label {
    font-size: 0.88rem;
    line-height: 1.5;
    cursor: pointer;
}

/* ==================== RADIO BUTTONS ==================== */
.radio-group {
    display: flex;
    gap: 15px;
    margin-top: 6px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.radio-option input[type="radio"] {
    accent-color: var(--primary);
    cursor: pointer;
}

.radio-option label {
    font-size: 0.88rem;
    cursor: pointer;
    margin-bottom: 0;
}

/* ==================== PERSON TYPE TOGGLE ==================== */
.tipo-persona-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.tipo-persona-btn {
    flex: 1;
    text-align: center;
    padding: 16px 20px;
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s;
    background: var(--white);
}

.tipo-persona-btn:hover { border-color: var(--primary); }

.tipo-persona-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(31, 40, 109, 0.1);
}

.tipo-persona-btn .icon { font-size: 1.6rem; margin-bottom: 6px; }
.tipo-persona-btn .label { font-weight: 700; font-size: 0.92rem; color: var(--text); }
.tipo-persona-btn .desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ==================== SECCIONES PERSONA ==================== */
.seccion-juridica { transition: opacity 0.3s; }
.seccion-juridica.hidden { display: none; }

/* ==================== ÁREAS DE DESEMPEÑO DINÁMICAS ==================== */
.area-row {
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    animation: fadeIn 0.25s ease;
    opacity: 1;
    transition: opacity 0.25s, transform 0.25s;
}

.area-row-removing {
    opacity: 0;
    transform: translateY(-8px);
}

.area-row-content {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.area-select-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex: 1;
}

.area-row .form-group { margin-bottom: 0; }

.area-row select { font-size: 0.88rem; padding: 9px 12px; }

.btn-remove-area {
    background: none;
    border: 2px solid var(--danger);
    color: var(--danger);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-remove-area:hover {
    background: var(--danger);
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.areas-empty-msg {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.88rem;
    border: 2px dashed var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
}

/* ==================== DOCUMENTOS ==================== */
.doc-upload-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
    background: var(--white);
    transition: border-color 0.2s;
}

.doc-upload-item:hover { border-color: var(--primary); }

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.doc-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-obligatorio {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.badge-opcional {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.doc-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.doc-upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.doc-upload-zone.has-file {
    border-color: var(--success);
    background: #f0fdf4;
    border-style: solid;
}

.upload-icon { font-size: 1.8rem; margin-bottom: 6px; }

.upload-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.upload-text small { color: #94a3b8; }

.doc-template-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    margin-left: 8px;
}

.doc-template-link:hover { text-decoration: underline; }

/* ==================== SECCIÓN AUTORIZACIÓN ==================== */
.autorizacion-section {
    background: #f0f4ff;
    border: 1px solid #c8d4f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.autorizacion-section p {
    font-size: 0.88rem;
    color: #333;
    line-height: 1.7;
    margin: 0;
}

.autorizacion-section a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.autorizacion-section a:hover { text-decoration: underline; }

/* ==================== FORMATOS DESCARGABLES ==================== */
.formatos-section {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.formatos-section h4 {
    font-size: 0.95rem;
    color: #92400e;
    margin-bottom: 10px;
}

.formatos-section .nota {
    font-size: 0.82rem;
    color: #78350f;
    margin-bottom: 15px;
}

.formato-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #fde68a;
    border-radius: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 4px 6px 4px 0;
    transition: all 0.2s;
}

.formato-link:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

/* ==================== PROTECCIÓN DE DATOS ==================== */
.proteccion-datos-section {
    background: #f8f9fb;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

.proteccion-datos-section .legal-text {
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--text);
}

.proteccion-datos-section .legal-links {
    font-size: 0.84rem;
    margin-top: 8px;
    display: inline-block;
}

.proteccion-datos-section .legal-links a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.proteccion-datos-section .legal-links a:hover { text-decoration: underline; }

/* ==================== BOTONES ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover { background: var(--bg); }

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover { background: #059669; }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-lg { padding: 13px 28px; font-size: 0.95rem; }

/* ==================== NAVEGACIÓN WIZARD ==================== */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* ==================== ÉXITO ==================== */
.success-container,
.success-page {
    text-align: center;
    padding: 50px 30px;
    max-width: 600px;
    margin: 0 auto;
}

.success-icon,
.success-page .icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.success-container h2,
.success-page h2 {
    color: var(--success);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.success-container p,
.success-page p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.success-id,
.ref-number {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin: 20px auto;
    max-width: 300px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

/* ==================== FOOTER ==================== */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--white);
}

/* ==================== RESUMEN ==================== */
.resumen-section {
    margin-bottom: 15px;
}

.resumen-section h4 {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.resumen-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}

.resumen-row .label { color: var(--text-muted); }
.resumen-row .value { font-weight: 600; }

/* ==================== ALERTAS ==================== */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-info {
    background: var(--primary-light);
    border: 1px solid #bfc8e8;
    color: var(--primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .form-row.three-cols { grid-template-columns: 1fr; }
    .card { padding: 20px 16px; }
    .header-inner { padding: 14px 16px; }
    .header-logo h1 { font-size: 1rem; }
    .wizard-container { padding: 20px 12px 40px; }
    .step-label { font-size: 0.7rem; }

    .area-row-content {
        flex-direction: column;
    }

    .area-select-group {
        grid-template-columns: 1fr;
    }

    .area-row .btn-remove-area {
        align-self: flex-end;
    }

    .wizard-nav { gap: 10px; }
    .wizard-nav .btn { flex: 1; }

    .tipo-persona-toggle { flex-direction: column; }
    .tipo-persona-btn { padding: 12px 16px; }
}

@media (max-width: 480px) {
    .wizard-steps { gap: 0; }
    .step-circle { width: 32px; height: 32px; font-size: 0.8rem; }
    .step-label { display: none; }
    .header-logo img { height: 36px; }
}
