/* ==========================================================================
   ESTILOS GENERALES Y SISTEMA DE DISEÑO - SIMULADOR DE INTERNET
   ABC Training - Elaborado por el Lic. Victor Elias Sellis Zeballos
   ========================================================================== */

:root {
    --primary: #0067c0;
    --primary-hover: #1879cd;
    --primary-dark: #004e92;
    --accent: #2563eb;
    --success: #107c10;
    --warning: #f59e0b;
    --danger: #d13438;
    --bg-dark: #0b1120;
    --card-bg: rgba(255, 255, 255, 0.94);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-main: #1f2937;
    --text-muted: #64748b;
    --font-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
}

/* ==========================================================================
   CARÁTULA INSTITUCIONAL / BIENVENIDA ABC TRAINING
   ========================================================================== */
#cover-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, rgba(15, 32, 67, 0.9) 0%, rgba(5, 12, 28, 0.98) 100%);
    backdrop-filter: blur(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#cover-screen.fade-out {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

.cover-card {
    width: 90%;
    max-width: 580px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: fadeInScale 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.cover-logo-img {
    height: 72px;
    max-width: 240px;
    object-fit: contain;
    margin-bottom: 12px;
}

.cover-institution-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary);
    background: rgba(0, 103, 192, 0.08);
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 103, 192, 0.2);
}

.cover-title {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px;
    line-height: 1.25;
}

.cover-credits-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 16px 0 22px 0;
    font-size: 12.5px;
    text-align: left;
    color: #475569;
}

.cover-credits-line {
    margin-bottom: 4px;
}
.cover-credits-line:last-child {
    margin-bottom: 0;
}

.student-form-group {
    text-align: left;
    margin-bottom: 14px;
}

.student-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 5px;
}

.student-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: text;
    -webkit-user-select: text;
}

.student-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 103, 192, 0.15);
}

.btn-primary-large {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 103, 192, 0.35);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    margin-top: 10px;
}

.btn-primary-large:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 103, 192, 0.45);
}

.btn-secondary-link {
    background: none;
    border: none;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px;
    text-decoration: underline;
    transition: color 0.15s;
}

.btn-secondary-link:hover {
    color: var(--primary);
}

.existing-student-card {
    background: #f0f7ff;
    border: 1px solid #c7e0ff;
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 12px;
}

.existing-welcome {
    font-size: 17px;
    font-weight: 800;
    color: #0c4a6e;
    margin-bottom: 4px;
}

.existing-progress-pill {
    display: inline-block;
    background: #28a745;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
}

/* ==========================================================================
   TUTOR HUD (PANEL ARRASTRABLE Y MINIMIZABLE)
   ========================================================================== */
#tutor-hud {
    position: fixed;
    top: 14px;
    right: 20px;
    width: 390px;
    max-width: calc(100vw - 30px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 103, 192, 0.25);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(20px);
    z-index: 9999;
    transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

#tutor-hud.collapsed .hud-body {
    display: none;
}

.hud-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(90deg, #f8fafc, #edf2f7);
    border-bottom: 1px solid #e2e8f0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: grab;
}

.hud-top-bar:active {
    cursor: grabbing;
}

.hud-student-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
}

.hud-avatar {
    font-size: 16px;
}

.hud-student-name {
    color: #1e293b;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-student-score {
    color: #107c10;
    font-weight: 800;
    font-size: 12px;
}

.hud-controls-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hud-btn-action {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.hud-btn-action:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.hud-btn-eval {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.hud-btn-eval:hover {
    background: var(--primary-hover);
    color: #fff;
}

.hud-btn-cert {
    background: #107c10;
    color: #fff;
    border-color: #107c10;
}

.hud-btn-cert:hover {
    background: #0b5a0b;
    color: #fff;
}

.hud-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    color: #64748b;
}

.hud-toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.hud-body {
    padding: 12px 14px 14px 14px;
}

.hud-module-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    color: #1e293b;
    margin-bottom: 10px;
    outline: none;
}

.hud-step-counter {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.hud-step-title {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.hud-instruction {
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    padding: 8px 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 10px;
}

.hud-instruction strong {
    color: #0f172a;
}

.hud-feedback {
    display: none;
    font-size: 12px;
    line-height: 1.45;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-top: 8px;
}

/* ==========================================================================
   RESALTADO VISUAL DE PISTA (SIMULATOR GLOW)
   ========================================================================== */
.simulator-target-glow {
    position: relative;
    outline: 3px solid #2563eb !important;
    outline-offset: 3px;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.8) !important;
    animation: targetPulse 1.4s infinite alternate ease-in-out;
    z-index: 9999 !important;
}

.pulse-strong {
    animation: targetPulseFast 0.8s infinite alternate ease-in-out;
}

@keyframes targetPulse {
    0% { outline-color: #2563eb; box-shadow: 0 0 10px rgba(37, 99, 235, 0.4); }
    100% { outline-color: #f59e0b; box-shadow: 0 0 25px rgba(245, 158, 11, 0.9); }
}

@keyframes targetPulseFast {
    0% { transform: scale(1); }
    100% { transform: scale(1.04); }
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.animate-shake {
    animation: shakeAnim 0.5s ease-in-out;
}

/* ==========================================================================
   MODAL DE EVALUACIÓN PRÁCTICA (100 PUNTOS)
   ========================================================================== */
#module-eval-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

#module-eval-modal.active {
    display: flex;
}

.eval-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    padding: 32px 36px;
    width: 90%;
    max-width: 620px;
    position: relative;
    overflow: hidden;
}

.eval-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 16px;
}

.eval-title {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.eval-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 3px;
}

.eval-meta-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.eval-attempts-badge {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.eval-score-rule-badge {
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.eval-rules-notice {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 22px;
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
}

.eval-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.eval-btn-retry {
    background: #64748b;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.eval-btn-retry:hover {
    background: #475569;
}

.eval-btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 103, 192, 0.3);
    transition: transform 0.15s, filter 0.15s;
}

.eval-btn-submit:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

/* ==========================================================================
   MODAL DE CERTIFICADO OFICIAL DE APROBACIÓN
   ========================================================================== */
.cert-overlay,
#certificate-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(10, 15, 30, 0.92) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    z-index: 9999999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.cert-overlay.active,
#certificate-modal.active {
    display: flex !important;
}

.cert-container {
    max-width: 960px;
    width: 100%;
}

.cert-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cert-actions-right {
    display: flex;
    gap: 8px;
}

.cert-btn-action {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.cert-btn-action:hover {
    background: rgba(255, 255, 255, 0.25);
}

.cert-btn-pdf {
    background: #107c10;
    border-color: #107c10;
}
.cert-btn-pdf:hover {
    background: #0b5a0b;
}

.cert-btn-close {
    background: rgba(209, 52, 56, 0.8);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.cert-btn-close:hover {
    background: #d13438;
}

.cert-frame {
    background: #fff;
    color: #1a202c;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    padding: 16px;
}

.cert-border-outer {
    border: 5px solid #004e92;
    padding: 8px;
    background: #fff;
}

.cert-border-inner {
    border: 2px solid #b38b3f;
    padding: 30px 40px;
    position: relative;
    text-align: center;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #fcfbf9 100%);
    overflow: hidden;
}

.cert-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    font-size: 76px;
    font-weight: 900;
    color: rgba(0, 78, 146, 0.04);
    letter-spacing: 12px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 0;
}

.cert-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.cert-logo {
    height: 56px;
    object-fit: contain;
}

.cert-institution {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #004e92;
}

.cert-tagline {
    font-size: 11px;
    color: #64748b;
    letter-spacing: 0.5px;
}

.cert-badge-ribbon {
    display: inline-block;
    background: #b38b3f;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 4px 18px;
    border-radius: 14px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.cert-title {
    font-size: 26px;
    font-weight: 900;
    color: #0c2340;
    letter-spacing: 2px;
    margin-bottom: 2px;
    position: relative;
    z-index: 1;
}

.cert-subtitle {
    font-size: 13px;
    font-style: italic;
    color: #64748b;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.cert-student-name {
    font-size: 28px;
    font-weight: 900;
    color: #004e92;
    border-bottom: 2px solid #b38b3f;
    display: inline-block;
    padding: 0 30px 4px 30px;
    margin-bottom: 12px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

.cert-text {
    font-size: 13.5px;
    color: #334155;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.cert-course-title {
    font-size: 18px;
    font-weight: 800;
    color: #004e92;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.cert-course-details {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    max-width: 760px;
    margin: 0 auto 16px auto;
    position: relative;
    z-index: 1;
}

.cert-meta-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 12px;
    color: #475569;
    margin-bottom: 26px;
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
    padding: 8px 0;
    position: relative;
    z-index: 1;
}

.cert-signatures {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.cert-signature-box {
    width: 260px;
    text-align: center;
}

.cert-sign-line {
    border-bottom: 1.5px solid #0f172a;
    width: 190px;
    margin: 0 auto 6px auto;
}

.cert-sign-name {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}

.cert-sign-role {
    font-size: 11px;
    font-weight: 600;
    color: #004e92;
}

.cert-sign-org {
    font-size: 10px;
    color: #64748b;
}

.cert-gold-seal {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, #fce8a9 0%, #b38b3f 100%);
    border: 3px double #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 4px auto;
}

.seal-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 8px;
    font-weight: 900;
    color: #453206;
}

.seal-inner strong {
    font-size: 14px;
    color: #2b1f02;
}

.cert-code-text {
    font-size: 10px;
    font-family: monospace;
    color: #64748b;
}

/* ==========================================================================
   TOAST NOTIFICACIONES
   ========================================================================== */
.sim-toast-container {
    position: fixed;
    bottom: 54px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.sim-toast-item {
    pointer-events: auto;
    background: #fff;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 10px 14px;
    width: 320px;
}

.sim-toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #0f172a;
    margin-bottom: 2px;
}

.sim-toast-header button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #94a3b8;
}

.sim-toast-body {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

/* Animaciones */
@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

.animate-scale-up {
    animation: fadeInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@media print {
    .no-print, #tutor-hud, #cover-screen, #desktop-container, #taskbar {
        display: none !important;
    }
    body, html {
        background: #fff !important;
        overflow: visible !important;
    }
    .cert-overlay {
        position: static !important;
        background: none !important;
        padding: 0 !important;
    }
    .cert-frame {
        box-shadow: none !important;
    }
}
