html, body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg-app);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
}

.subir-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(circle at 15% 10%, rgba(var(--brand-primary-rgb), 0.14), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(20, 184, 212, 0.14), transparent 45%),
        var(--bg-app);
}

.subir-card {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 1.75rem 1.75rem 2rem;
}

/* -- Encabezado -- */
.subir-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.subir-header > i {
    font-size: 2rem;
    color: var(--brand-primary);
    flex-shrink: 0;
}
.subir-header-texto { flex: 1; }
.subir-header-texto h1 { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--text-main); }
.subir-header-texto p { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

.icon-btn {
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--brand-primary-light); color: var(--brand-primary); }

/* -- Indicador de pasos -- */
.subir-progreso {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.75rem;
}
.paso-indicador {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.paso-indicador span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: background 0.2s, color 0.2s;
}
.paso-indicador.activo span { background: var(--brand-primary); color: #fff; }
.paso-indicador.activo { color: var(--text-main); }
.paso-indicador.hecho span { background: var(--success); color: #fff; }
.paso-linea { flex: 1; height: 2px; background: var(--border-color); }

/* -- Pasos -- */
.subir-step h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.3rem; color: var(--text-main); }
.subir-sub { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.25rem; }

.rut-inputs { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; }
.rut-inputs .rut-dv { width: 80px; flex-shrink: 0; }
.form-floating > .form-control { background: var(--surface); border-color: var(--border-color); color: var(--text-main); }
.form-floating > label { color: var(--text-muted); }
.form-floating > .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.btn-brand {
    background: var(--brand-gradient);
    border: none;
    color: #fff;
    font-weight: 700;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-brand:hover:not(:disabled) { box-shadow: 0 8px 20px rgba(var(--brand-primary-rgb), 0.35); color: #fff; }
.btn-brand:active:not(:disabled) { transform: scale(0.98); }
.btn-brand:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline-brand {
    background: transparent;
    border: 1.5px solid var(--brand-primary);
    color: var(--brand-primary);
    font-weight: 700;
    padding: 0.6rem 1.4rem;
    border-radius: 12px;
}
.btn-outline-brand:hover { background: var(--brand-primary-light); }

/* -- Mensaje con instrucciones para el laboratorio -- */
.mensaje-toggle-wrap { margin-bottom: 1.5rem; }
.btn-mensaje-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0;
    color: var(--brand-primary);
    font-size: 0.85rem;
    font-weight: 600;
}
.btn-mensaje-toggle:hover { text-decoration: underline; }
.caja-mensaje { margin-top: 0.75rem; }
.caja-mensaje textarea {
    background: var(--surface);
    border-color: var(--border-color);
    color: var(--text-main);
    resize: vertical;
    margin-bottom: 0.6rem;
}
.caja-mensaje textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

/* -- Confirmación de alumno -- */
.alumno-confirmado {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--success-light);
    border: 1px solid var(--success);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
}
.alumno-confirmado > i { font-size: 1.5rem; color: var(--success-dark); flex-shrink: 0; }
.alumno-confirmado > div { flex: 1; min-width: 0; }
.alumno-confirmado strong { color: var(--text-main); display: block; overflow-wrap: break-word; }
.alumno-confirmado .btn-link { color: var(--success-dark); font-weight: 600; font-size: 0.78rem; text-decoration: none; white-space: nowrap; }
.alumno-confirmado .btn-link:hover { text-decoration: underline; }

/* -- Saldo de hojas del alumno identificado -- */
.saldo-alumno {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.saldo-item {
    flex: 1;
    background: var(--brand-primary-light);
    border-radius: 14px;
    padding: 0.75rem 0.5rem;
    text-align: center;
}
.saldo-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--brand-accent-text);
    margin-bottom: 0.25rem;
}
.saldo-item strong { display: block; font-size: 1.35rem; font-weight: 800; color: var(--brand-accent-text); line-height: 1.1; }
.saldo-sub { font-size: 0.68rem; color: var(--text-muted); }

/* -- Zona de arrastrar y soltar -- */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--bg-app);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand-primary); outline: none; }
.dropzone.arrastrando {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
}
.dropzone > i { font-size: 2.5rem; color: var(--brand-primary); margin-bottom: 0.5rem; display: block; }
.dropzone-titulo { font-weight: 700; color: var(--text-main); margin-bottom: 0.15rem; }
.dropzone-sub { color: var(--text-muted); font-size: 0.82rem; margin: 0; }

.subir-hint {
    color: var(--text-muted);
    font-size: 0.76rem;
    margin: 0.6rem 0 1rem;
}

/* -- Lista de archivos seleccionados -- */
.lista-archivos {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 260px;
    overflow-y: auto;
}
.archivo-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
    animation: archivo-entra 0.2s ease-out;
}
@keyframes archivo-entra {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.archivo-item .archivo-icono {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    color: #fff;
}
.archivo-info { flex: 1; min-width: 0; }
.archivo-nombre { font-size: 0.85rem; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archivo-tamano { font-size: 0.72rem; color: var(--text-muted); }
.archivo-quitar {
    border: none;
    background: transparent;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.archivo-quitar:hover { background: var(--danger-light); color: var(--danger); }
.archivo-error { border-color: var(--danger); background: var(--danger-light); }
.archivo-error .archivo-tamano { color: var(--danger); }

/* Colores por tipo de archivo */
.icono-pdf { background: #e5484d; }
.icono-word { background: #2b579a; }
.icono-ppt { background: #d24726; }
.icono-excel { background: #1d6f42; }
.icono-imagen { background: var(--brand-accent); }
.icono-generico { background: var(--text-muted); }

/* -- Paso de éxito -- */
.subir-exito { text-align: center; padding: 1rem 0; }
.subir-exito > i { font-size: 3.5rem; color: var(--success); margin-bottom: 0.75rem; display: block; }
.subir-exito h2 { margin-bottom: 0.5rem; }
.subir-exito p { color: var(--text-muted); }
.subir-exito .subir-hint { margin-bottom: 1.5rem; }

/* ===================== Sugerencias, reclamos y calificación ===================== */
.btn-opinion {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.btn-opinion > i:first-child { font-size: 1.15rem; color: var(--brand-primary); }
.btn-opinion > span { flex: 1; }
.btn-opinion > i:last-child { color: var(--text-muted); }
.btn-opinion:hover { border-color: var(--brand-primary); background: var(--brand-primary-light); }

.opinion-modal { background: var(--surface); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 18px; }
.opinion-modal .modal-header { border-bottom: 1px solid var(--border-color); }
.opinion-modal .modal-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.opinion-bloque h3 { font-size: 0.98rem; font-weight: 700; margin: 0 0 0.6rem; }
.opinion-separador { border-color: var(--border-color); opacity: 1; margin: 1.25rem 0; }

.estrellas { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; }
.estrella {
    border: none;
    background: transparent;
    padding: 0.15rem;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.12s, color 0.12s;
}
.estrella.llena { color: var(--warning); }
.estrella:hover:not(:disabled) { transform: scale(1.15); }
.estrella:disabled { cursor: default; }
.estrella:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; border-radius: 6px; }

.opinion-aviso { min-height: 1.3rem; margin: 0 0 0.6rem; font-size: 0.82rem; color: var(--text-muted); }
.opinion-aviso.error { color: var(--danger); }

.tipos-opinion { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.tipo-opinion { position: relative; }
.tipo-opinion input { position: absolute; opacity: 0; pointer-events: none; }
.tipo-opinion span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.tipo-opinion:hover span { border-color: var(--brand-primary); }
.tipo-opinion input:checked + span { border-color: var(--brand-primary); background: var(--brand-primary-light); color: var(--brand-accent-text); }
.tipo-opinion input:disabled + span { opacity: 0.5; cursor: not-allowed; }
.tipo-opinion input:focus-visible + span { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

#textoOpinion { background: var(--surface); border-color: var(--border-color); color: var(--text-main); resize: vertical; }
#textoOpinion:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-light); }
.opinion-pie { display: flex; justify-content: flex-end; margin: 0.3rem 0 0.4rem; }
.opinion-contador { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.opinion-contador.limite { color: var(--danger); font-weight: 700; }

@media (max-width: 480px) {
    .subir-card { padding: 1.4rem 1.2rem 1.6rem; border-radius: 16px; }
    .subir-progreso { gap: 0.25rem; }
    .paso-indicador span { width: 20px; height: 20px; }
}

/* ===================== SweetAlert2 con la paleta del sistema (copiado de estilos.css: esta
   página no carga ese archivo completo para no arrastrar estilos del panel de administración) ===================== */
.swal2-container { z-index: 3000; }
.swal-app-popup {
    background: var(--surface);
    border-radius: 18px;
    padding: 1.6rem 1.5rem 1.4rem;
    box-shadow: var(--shadow-md);
    font-family: inherit;
    border: 1px solid var(--border-color);
}
.swal-app-title { color: var(--text-main); font-weight: 700; font-size: 1.25rem; }
.swal-app-text { color: var(--text-muted); font-size: 0.95rem; }
.swal-app-actions { gap: 0.4rem; margin-top: 1.2rem; }
/* SweetAlert2 trae su propia regla ".swal2-popup.swal2-toast" (dos clases) para el modo toast,
   que le gana a nuestra ".swal-app-toast" de una sola clase: el toast quedaba con fondo blanco
   fijo, casi invisible en modo oscuro. Se sube la especificidad para que gane la nuestra. */
.swal2-popup.swal2-toast.swal-app-toast {
    background: var(--surface);
    color: var(--text-main);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    font-family: inherit;
}
.swal2-popup.swal2-toast.swal-app-toast .swal2-title,
.swal2-popup.swal2-toast.swal-app-toast .swal2-html-container {
    color: var(--text-main);
}
