/**
 * Formulario de Postulación a Becas Inclusivas — IEmpresa
 * Diseño unificado, luminoso y accesible con paleta institucional IEmpresa
 */

:root {
    --primary: #F15A24;
    --primary-hover: #FF8200;
    --primary-subtle: #FFF3EE;
    --primary-gradient: linear-gradient(135deg, #F15A24 0%, #FF8200 100%);
    --brand-blue: #002D56;
    --brand-blue-mid: #0B4F8A;
    --brand-blue-subtle: #EDF3F8;
    --brand-prestige: #0A1F44;
    --surface-bg: #FFFFFF;
    --subtle-bg: #F8FAFC;
    --border-color: #DCE3EC;
    --text-main: #0A1F44;
    --text-muted: #52627A;
    --success-color: #15803D;
    --success-bg: #F0FDF4;
    --success-border: #86EFAC;
    --error-color: #DC2626;
    --error-bg: #FEF2F2;
    --error-border: #FCA5A5;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background-color: #163C63;
    line-height: 1.6;
}

/* Degradado institucional moderno en tono medio (Azul Empresa -> Naranja cálido) para contraste claro con el formulario blanco */
#site-content {
    min-height: 100vh;
    position: relative;
    background-color: #163C63;
    background-image:
        radial-gradient(circle at 14% 20%, rgba(241, 90, 36, 0.28) 0%, transparent 46%),
        radial-gradient(circle at 88% 82%, rgba(255, 130, 0, 0.32) 0%, transparent 48%),
        linear-gradient(135deg, #0E3156 0%, #1C4D7A 46%, #7C4B42 78%, #CC5E2A 100%);
    background-attachment: fixed;
    transition: filter 0.2s ease, background-color 0.2s ease;
}

.page-wrapper {
    padding: 1.15rem 1rem 2.25rem;
}

/* Tarjeta Principal Unificada */
.form-container {
    max-width: 1020px;
    margin: 0 auto;
    background: var(--surface-bg);
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 24px 55px rgba(8, 22, 44, 0.32), 0 6px 16px rgba(8, 22, 44, 0.14);
    overflow: hidden;
}

.banner-wrapper {
    background: var(--brand-blue);
    overflow: hidden;
}

.banner {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: -3.6%;
}

/* Cabecera Institucional con juego de colores IEmpresa (Azul Empresa -> Naranja Instituto) */
.form-header {
    text-align: center;
    padding: 1.85rem 2rem;
    background: linear-gradient(125deg, #002D56 0%, #0B4F8A 55%, #F15A24 100%);
    color: #ffffff;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.32rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.34);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.65rem;
}

.header-badge i {
    color: #FFD166;
}

.form-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
}

.form-header p {
    font-size: 0.94rem;
    margin: 0 auto;
    max-width: 640px;
    opacity: 0.94;
}

/* Cuerpo Unificado: Rail Lateral de Pasos + Formulario */
.form-body-grid {
    display: grid;
    grid-template-columns: 245px minmax(0, 1fr);
    align-items: stretch;
}

.stepper-rail {
    background: var(--subtle-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1.15rem;
    display: flex;
    flex-direction: column;
}

.rail-heading {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-left: 0.35rem;
}

/* Stepper Vertical Integrado */
.stepper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.step-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1.5px solid transparent;
    opacity: 0.72;
    transition: transform 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, opacity 0.22s ease;
}

.step-item.completed {
    opacity: 0.92;
}

.step-item.active {
    opacity: 1;
    background: #FFFFFF;
    border-color: rgba(241, 90, 36, 0.38);
    border-left: 4px solid var(--primary);
    transform: translateX(8px);
    box-shadow: 0 8px 20px rgba(241, 90, 36, 0.16), 0 2px 6px rgba(10, 31, 68, 0.08);
    z-index: 2;
}

/* Indicador direccional que conecta el paso activo hacia el formulario */
.step-item.active::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #FFFFFF;
    border-top: 1.5px solid rgba(241, 90, 36, 0.38);
    border-right: 1.5px solid rgba(241, 90, 36, 0.38);
    transform: translateY(-50%) rotate(45deg);
    border-radius: 0 2px 0 0;
}

.step-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #E2E8F0;
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: all 0.22s ease;
}

.step-circle .step-check {
    display: none;
    font-size: 1.05rem;
}

.step-item.active .step-circle {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(241, 90, 36, 0.18);
}

.step-item.completed .step-circle {
    background: var(--brand-blue);
    color: #ffffff;
}

.step-item.completed .step-number {
    display: none;
}

.step-item.completed .step-check {
    display: inline-block;
}

.step-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.step-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1.2;
}

.step-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.step-item.active .step-label {
    color: var(--primary);
}

.step-item.completed .step-label {
    color: var(--brand-blue);
}

.step-connector {
    width: 3px;
    height: 18px;
    margin-left: 1.55rem;
    background: #E2E8F0;
    border-radius: 999px;
    transition: background-color 0.25s ease;
}

.step-connector.completed {
    background: var(--primary);
}

.rail-tip {
    margin-top: auto;
    padding: 0.75rem 0.8rem;
    border-radius: 10px;
    background: var(--brand-blue-subtle);
    border: 1px solid #C6D8E8;
    font-size: 0.74rem;
    color: var(--brand-blue);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.4;
}

.rail-tip i {
    color: var(--primary);
    font-size: 1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

/* Contenido de Pasos (Cuerpo Unificado) */
.step {
    display: none;
    padding: 1.5rem 1.85rem 1.75rem;
    background: #FFFFFF;
}

.step.active {
    display: block;
    animation: fadeSlideIn 0.3s ease;
}

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

.section-block {
    margin-bottom: 1.9rem;
}

.section-block:last-of-type {
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: 1.15rem;
    padding-left: 0.75rem;
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.section-title i {
    color: var(--primary);
}

.section-title:focus:not(:focus-visible) {
    outline: none;
}

/* Campos de Formulario */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

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

.info-icon {
    color: var(--primary-hover);
    font-size: 0.92rem;
    margin-left: 0.25rem;
    cursor: pointer;
}

.tooltip-inner {
    background-color: var(--brand-blue);
    font-size: 0.78rem;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid #CBD5E1;
    padding: 0.62rem 0.88rem;
    font-size: 0.91rem;
    color: var(--text-main);
    background-color: #FFFFFF;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.22rem rgba(0, 45, 86, 0.14);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--error-color);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 45, 86, 0.18);
}

/* Sección de Documentos PDF */
.docs-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.docs-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid #FDD4C4;
    transition: all 0.2s ease;
}

.docs-counter.complete {
    background: var(--success-bg);
    color: var(--success-color);
    border-color: var(--success-border);
}

.docs-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    background: var(--brand-blue-subtle);
    border: 1px solid #C6D8E8;
    border-left: 4px solid var(--brand-blue);
    color: var(--brand-blue);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.docs-notice i {
    font-size: 1.08rem;
    color: var(--primary);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.upload-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-card {
    position: relative;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.upload-card.has-file {
    border-color: var(--success-border);
    background: var(--success-bg);
}

.upload-card.has-error {
    border-color: var(--error-border);
    background: var(--error-bg);
}

.upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.upload-card-top {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.75rem;
}

.upload-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--primary-subtle);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.upload-card.has-file .upload-icon-box {
    background: #DCFCE7;
    color: var(--success-color);
}

.upload-meta {
    flex: 1;
    min-width: 0;
}

.upload-meta h3 {
    font-size: 0.94rem;
    font-weight: 700;
    margin: 0 0 0.12rem;
    color: var(--text-main);
}

.upload-meta p {
    font-size: 0.79rem;
    color: var(--text-muted);
    margin: 0;
}

.upload-badge {
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--brand-blue);
    background: var(--brand-blue-subtle);
    border: 1px solid #C6D8E8;
    padding: 0.22rem 0.62rem;
    border-radius: 999px;
    white-space: nowrap;
}

.upload-dropzone {
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    background: var(--subtle-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.upload-dropzone:hover,
.upload-dropzone:focus-visible,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.upload-card.has-file .upload-dropzone {
    border-style: solid;
    border-color: var(--success-border);
    background: #ffffff;
    padding: 0.7rem 0.92rem;
}

.upload-card.has-error .upload-dropzone {
    border-color: var(--error-color);
    background: #ffffff;
}

.dropzone-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dropzone-empty i {
    font-size: 1.25rem;
    color: var(--brand-blue);
}

.dropzone-empty strong {
    color: var(--primary);
}

.dropzone-filled {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.file-pdf-icon {
    font-size: 1.45rem;
    color: #DC2626;
    flex-shrink: 0;
}

.file-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 600;
}

.btn-remove-file {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #FECACA;
    background: #FEF2F2;
    color: var(--error-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-remove-file:hover {
    background: var(--error-color);
    color: #ffffff;
    border-color: var(--error-color);
}

.upload-error {
    margin-top: 0.5rem;
    font-size: 0.79rem;
    font-weight: 600;
    color: var(--error-color);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Caja de Políticas */
.policy-box {
    background: var(--subtle-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-bottom: 1.5rem;
}

.policy-box .form-check-label {
    font-size: 0.83rem;
    color: var(--text-main);
    line-height: 1.55;
    cursor: pointer;
}

/* Botones */
.step-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.btn-brand {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.72rem 1.55rem;
    font-size: 0.93rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(241, 90, 36, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-brand:hover,
.btn-brand:focus {
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(241, 90, 36, 0.36);
}

.btn-brand:disabled {
    opacity: 0.65;
    transform: none;
    cursor: not-allowed;
}

.btn-prev {
    border-radius: 10px;
    padding: 0.7rem 1.3rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-color: var(--border-color);
    color: var(--brand-blue);
    background: #ffffff;
}

.btn-prev:hover {
    background: var(--brand-blue-subtle);
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.page-footer {
    text-align: center;
    margin-top: 1.35rem;
    font-size: 0.79rem;
}

.page-footer span {
    display: inline-block;
    padding: 0.4rem 1.15rem;
    border-radius: 999px;
    background: rgba(0, 45, 86, 0.88);
    color: #ffffff;
    font-weight: 600;
}

/* Modal de Progreso de Envío (SweetAlert2) */
.upload-progress-wrap {
    margin-top: 0.5rem;
    text-align: left;
}

.upload-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.upload-progress-stage {
    color: var(--text-main);
    font-weight: 600;
}

.upload-progress-percent {
    color: var(--primary);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.upload-progress-track {
    width: 100%;
    height: 12px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
}

.upload-progress-bar {
    width: 5%;
    height: 100%;
    border-radius: 999px;
    background: var(--primary-gradient);
    background-size: 200% 100%;
    transition: width 0.35s ease;
    animation: progressShimmer 1.6s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.upload-progress-hint {
    margin-top: 0.85rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Responsividad */
@media (max-width: 820px) {
    .form-body-grid {
        grid-template-columns: 1fr;
    }

    .stepper-rail {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 0.9rem 1rem;
    }

    .rail-heading,
    .rail-tip,
    .step-sub {
        display: none;
    }

    .stepper {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
    }

    .step-item {
        flex-direction: column;
        text-align: center;
        gap: 0.3rem;
        padding: 0.45rem 0.5rem;
        min-width: 84px;
    }

    .step-item.active {
        transform: translateY(-2px);
        border-left-width: 1.5px;
        border-bottom: 3px solid var(--primary);
    }

    .step-item.active::after {
        display: none;
    }

    .step-label {
        font-size: 0.72rem;
    }

    .step-connector {
        width: 28px;
        height: 3px;
        margin: 0 0 1.2rem;
    }
}

@media (max-width: 768px) {
    .page-wrapper {
        padding: 0.85rem 0.65rem 1.85rem;
    }

    .step {
        padding: 1.25rem 1rem;
    }

    .upload-card-top {
        flex-wrap: wrap;
    }

    .upload-badge {
        margin-left: auto;
    }

    .step-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .step-actions .btn {
        width: 100%;
    }
}
