/**
 * Estilos del portal del estudiante (trámite documentario en línea).
 * Cargar después de master.css. Reusa Bootstrap + utilidades del proyecto.
 * Diseño claro y móvil-amigable.
 */

body.v-tramite-online {
    background-color: var(--bs-light, #f8f9fa);
    /* Columna a pantalla completa: el footer (mt-auto) queda anclado abajo. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Animación de giro para el ícono del botón "Actualizar" mientras recarga. */
.tramite-spin {
    display: inline-block;
    animation: tramite-spin 0.8s linear infinite;
}

@keyframes tramite-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================================================
   NAVBAR Y FOOTER (mismo tratamiento que el portal de Registro de Notas Online)
   ============================================================================ */
.navbar.bg-primary,
.navbar[class*="bg-primary"] {
    background-color: #0b469ddb !important;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.navbar .navbar-brand,
.navbar .nav-link,
.navbar .text-white {
    color: #fff !important;
}

.navbar .nav-link:hover {
    color: rgba(255, 255, 255, 0.9) !important;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================================================
   CARD "INICIAR UN NUEVO TRÁMITE"
   ============================================================================ */
.card-nuevo-tramite {
    border-radius: 0.85rem;
    overflow: hidden;
}

.card-nuevo-tramite__header {
    background: linear-gradient(135deg, #0b469d 0%, #1565c0 55%, #1e88e5 100%);
}

.card-nuevo-tramite__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.card-nuevo-tramite .form-label {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: #344563;
}

.card-nuevo-tramite .form-control:focus,
.card-nuevo-tramite .form-select:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 0.2rem rgba(21, 101, 192, 0.15);
}

/* Selector Chosen alineado con la altura/estética de los demás campos. */
.card-nuevo-tramite .chosen-container-single .chosen-single {
    height: calc(1.5em + 0.75rem + 2px);
    line-height: calc(1.5em + 0.75rem);
    padding: 0 0.75rem;
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: 0.375rem;
    background: #fff;
    box-shadow: none;
    color: #212529;
}

.card-nuevo-tramite .chosen-container-active .chosen-single {
    border-color: #1565c0;
    box-shadow: 0 0 0 0.2rem rgba(21, 101, 192, 0.15);
}

/* Columna de adjuntos: panel diferenciado con separador a la izquierda (≥ lg). */
@media (min-width: 992px) {
    .card-nuevo-tramite__adjuntos {
        border-left: 1px solid var(--bs-border-color, #dee2e6);
    }
}

/* Expediente destacado en las tarjetas y el banner. */
.tramite-exp {
    font-family: var(--bs-font-monospace, monospace);
    font-weight: 700;
    color: var(--bs-primary, #0d6efd);
    letter-spacing: 0.3px;
}

#banner_expediente_valor {
    font-family: var(--bs-font-monospace, monospace);
    letter-spacing: 0.5px;
}

/* Badge de estado (usa ColorEstado del catálogo como fondo). */
.tramite-badge-estado {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
}

/* Plazo vencido. */
.tramite-plazo-vencido {
    color: var(--bs-danger, #dc3545);
    font-weight: 600;
}

/* Tarjetas de "mis trámites". */
.tramite-card {
    border: 1px solid var(--bs-border-color, #dee2e6);
    transition: box-shadow 0.15s ease-in-out;
}

.tramite-card:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}

/* Línea de tiempo del seguimiento. */
.tramite-timeline {
    position: relative;
    margin-left: 0.5rem;
    padding-left: 1.1rem;
    border-left: 2px solid var(--bs-border-color, #dee2e6);
}

.tramite-timeline-item {
    position: relative;
    padding: 0.4rem 0 0.6rem 0.4rem;
}

.tramite-timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.7rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--bs-primary, #0d6efd);
    box-shadow: 0 0 0 2px #fff;
}

.tramite-timeline-item:not(:last-child) {
    border-bottom: 1px dashed var(--bs-border-color, #dee2e6);
}

.tramite-timeline-item .badge {
    color: #fff;
    font-weight: 600;
}

/* Previsualización de archivos seleccionados antes de subir. */
.tramite-adjunto-preview .tramite-adjunto-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.35rem;
    margin-bottom: 0.3rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.tramite-adjunto-preview .tramite-adjunto-item.is-invalid {
    border-color: var(--bs-danger, #dc3545);
    background: rgba(220, 53, 69, 0.08);
    color: var(--bs-danger, #dc3545);
}

.tramite-adjunto-preview .tramite-adjunto-nombre {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tramite-adjunto-preview .tramite-adjunto-peso {
    flex: 0 0 auto;
    color: var(--bs-secondary-color, #6c757d);
}

/* bootstrap-fileinput: presentación sobria en el portal */
.tramite-fileinput-preview {
    font-size: 0.8125rem;
}

.tramite-fileinput-preview .file-preview-frame {
    margin: 0.25rem 0.35rem 0.25rem 0;
    padding: 0.35rem;
    border-radius: 0.35rem;
}

.tramite-fileinput-preview .file-footer-buttons .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
}

.tramite-fileinput-preview .kv-file-content {
    max-height: 4rem;
}

#seg_subsanacion .file-input {
    margin-bottom: 0;
}

/* El botón "Examinar" es un <label> (.btn-file); se alinea verticalmente con los demás. */
.file-input .input-group .btn-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.file-input .input-group .btn-file input[type="file"] {
    position: absolute;
}

/* En pantallas pequeñas, el contenedor ocupa todo el ancho. */
@media (max-width: 575.98px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ============================================================================
   PÁGINA DE LOGIN (index.php del portal)
   Estilos autocontenidos (no dependen de variables externas a Bootstrap).
   ============================================================================ */
body.login-page {
    background-image: url(../images/fondo-de-escritorio.jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #ffffff;
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
}

.login-container {
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h2 {
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(13, 110, 253, 0.3);
    font-size: 2.2rem;
}

.login-header h6 {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    letter-spacing: 1px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    font-size: 1rem;
}

.login-content {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #ffffff;
    color: #212529;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.login-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22) !important;
}

.login-content h4 {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #212529;
}

.badge-estudiante {
    background: var(--bs-success, #198754);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.75rem;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.badge-estudiante i {
    margin-right: 0.4rem;
}

/* Formulario de login (index.php) - Floating Labels básicos */
.form-floating-custom {
    position: relative;
    margin-bottom: 1rem;
}

.form-floating-custom .form-control {
    height: 58px;
    padding-left: 50px;
    padding-right: 50px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-floating-custom .form-control:focus {
    border-color: var(--bs-primary, #0d6efd);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.form-floating-custom .form-control:focus~label,
.form-floating-custom .form-control:not(:placeholder-shown)~label {
    color: var(--bs-primary, #0d6efd);
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    opacity: 1;
}

.form-floating-custom .form-control:not(:placeholder-shown) {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating-custom .input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 5;
    font-size: 1.1rem;
    transition: color 0.3s ease;
    pointer-events: none;
}

.form-floating-custom:focus-within .input-icon {
    color: var(--bs-primary, #0d6efd);
}

.form-floating-custom label {
    position: absolute;
    top: 0;
    left: 0;
    padding-left: 50px;
    color: #6c757d;
    font-weight: 500;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
    transition: all 0.2s ease;
}

.form-floating-custom .password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #6c757d;
    padding: 0;
    cursor: pointer;
    z-index: 15;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    margin: 0;
}

.form-floating-custom .password-toggle:hover {
    color: var(--bs-primary, #0d6efd);
    background-color: rgba(13, 110, 253, 0.1);
}

.login-container > p {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.login-content .mensaje:empty {
    display: none;
}

/* ============================================================================
   CAMBIO DE CONTRASEÑA (primer acceso) — portal trámite en línea
   ============================================================================ */
.tramite-cambio-clave {
    border-radius: 0.85rem;
    overflow: hidden;
}

.tramite-cambio-clave__banner {
    background: linear-gradient(135deg, #0b469d 0%, #1565c0 50%, #1976d2 100%);
    padding: 1.35rem 1.5rem;
}

.tramite-cambio-clave__lead {
    color: rgba(255, 255, 255, 0.92);
    max-width: 42rem;
}

.tramite-cambio-clave__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.45rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.tramite-cambio-clave__aside {
    background: #f4f7fb;
    border: 1px solid #e3eaf3;
    border-radius: 0.75rem;
    padding: 1.25rem 1.35rem;
    height: 100%;
}

.tramite-cambio-clave__pasos {
    padding-left: 1.15rem;
    color: #495057;
    line-height: 1.55;
}

.tramite-cambio-clave__pasos li + li {
    margin-top: 0.65rem;
}

.tramite-cambio-clave__form .form-label {
    font-size: 0.9rem;
    color: #344563;
    margin-bottom: 0.35rem;
}

.tramite-cambio-clave__form label.error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
}

.tramite-cambio-clave__form .input-group .btn-outline-secondary {
    border-color: #ced4da;
    color: #495057;
}

.tramite-cambio-clave__form .input-group .btn-outline-secondary:hover,
.tramite-cambio-clave__form .input-group .btn-outline-secondary.active {
    background-color: rgba(21, 101, 192, 0.08);
    border-color: #1565c0;
    color: #1565c0;
}

.tramite-cambio-clave__form .input-group:focus-within .btn-outline-secondary {
    border-color: #1565c0;
}

@media (max-width: 991.98px) {
    .tramite-cambio-clave__aside {
        margin-bottom: 0.25rem;
    }
}

/* Revisiones de investigación (portal docente) */
.tramite-rev-card {
    border-left: 3px solid var(--bs-primary, #0d6efd);
}

.tramite-rev-card--done {
    border-left-color: var(--bs-secondary, #6c757d);
    opacity: 0.92;
}

.tramite-rev-historial summary {
    cursor: pointer;
    user-select: none;
}

/* ============================================================================
   MI INVESTIGACIÓN (portal estudiante en Trámite en línea)
   ============================================================================ */

body.inv-estudiante-page {
    padding-top: 0;
}

.inv-card-expediente {
    border-radius: 0.85rem;
    overflow: hidden;
}

.inv-codigo-expediente {
    font-family: var(--bs-font-monospace, monospace);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--bs-primary, #0d6efd);
    letter-spacing: 0.5px;
}

.inv-badge-estado {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    color: #fff;
}

.inv-badge-etapa {
    font-size: 0.78rem;
    font-weight: 500;
}

.inv-timeline {
    position: relative;
}

.inv-tl-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.inv-tl-item:last-child {
    border-bottom: none;
}

.inv-tl-icon {
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 2px solid var(--bs-border-color, #dee2e6);
}

.inv-tl-icon.aprobado {
    background: #d1e7dd;
    border-color: #198754;
    color: #198754;
}

.inv-tl-icon.observado {
    background: #fff3cd;
    border-color: #fd7e14;
    color: #fd7e14;
}

.inv-tl-icon.revision {
    background: #cfe2ff;
    border-color: #0d6efd;
    color: #0d6efd;
}

.inv-tl-icon.pendiente {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #6c757d;
}

.inv-tl-body {
    flex: 1;
    min-width: 0;
}

.inv-tl-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.inv-tl-meta {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
}

.inv-tl-obs {
    font-size: 0.85rem;
    background: #fff8e6;
    border-left: 3px solid #fd7e14;
    padding: 0.5rem 0.65rem;
    margin-top: 0.4rem;
    border-radius: 0 0.35rem 0.35rem 0;
}

.inv-vigencia-progress {
    height: 0.65rem;
    border-radius: 1rem;
}

.inv-vigencia-progress .progress-bar.verde { background-color: #198754; }
.inv-vigencia-progress .progress-bar.naranja { background-color: #fd7e14; }
.inv-vigencia-progress .progress-bar.rojo { background-color: #dc3545; }

.inv-vigencia-alerta {
    font-size: 0.88rem;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin-top: 0.5rem;
}

.inv-turnitin-bar {
    height: 1.1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #e9ecef;
}

.inv-turnitin-fill {
    height: 100%;
    transition: width 0.4s ease;
}

.inv-turnitin-fill.ok { background: linear-gradient(90deg, #198754, #20c997); }
.inv-turnitin-fill.fail { background: linear-gradient(90deg, #dc3545, #fd7e14); }

.inv-resultado-badge {
    font-size: 1.15rem;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    display: inline-block;
    font-weight: 700;
}

.inv-resultado-badge.aprobado {
    background: #d1e7dd;
    color: #0f5132;
    border: 2px solid #198754;
}

.inv-resultado-badge.desaprobado {
    background: #f8d7da;
    color: #842029;
    border: 2px solid #dc3545;
}

.inv-resultado-badge.postergado {
    background: #fff3cd;
    color: #664d03;
    border: 2px solid #ffc107;
}

.inv-eventos-list {
    list-style: none;
    padding: 0;
}

.inv-eventos-list li {
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--bs-border-color, #dee2e6);
}

.inv-eventos-list li:last-child {
    border-bottom: none;
}

@media (max-width: 576px) {
    .inv-codigo-expediente {
        font-size: 1.35rem;
    }

    .inv-tl-item {
        gap: 0.6rem;
    }
}
