:root {
    /* Colores reales del logo (MAN = navy, Academy = azul) — no un azul
       genérico de Bootstrap. Ver assets/img/logo.png. */
    --primary: #005ad8;
    --primary-dark: #02274e;
    --primary-light: #eaf2fd;
    --accent: #ff7f00;
    --success: #057a55;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.10);
}

body {
    background: #f4f6fb;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Reemplaza el azul por defecto de Bootstrap (--bs-primary) por los colores
   reales del logo en todos los componentes que ya usa la app (botones,
   badges, enlaces, foco de formularios), sin recompilar Bootstrap. */
:root {
    --bs-primary: var(--primary-dark);
    --bs-primary-rgb: 2, 39, 78;
    --bs-link-color: var(--primary);
    --bs-link-color-rgb: 0, 90, 216;
    --bs-link-hover-color: var(--primary-dark);
    --bs-link-hover-color-rgb: 2, 39, 78;
}
.bg-primary { background-color: var(--primary-dark) !important; }
.text-primary { color: var(--primary-dark) !important; }
.border-primary { border-color: var(--primary-dark) !important; }
.btn-primary {
    --bs-btn-bg: var(--primary-dark);
    --bs-btn-border-color: var(--primary-dark);
    --bs-btn-hover-bg: #01182f;
    --bs-btn-hover-border-color: #01182f;
    --bs-btn-active-bg: #01182f;
    --bs-btn-active-border-color: #01182f;
    --bs-btn-focus-shadow-rgb: 2, 39, 78;
}
.btn-outline-primary {
    --bs-btn-color: var(--primary-dark);
    --bs-btn-border-color: var(--primary-dark);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .25rem rgba(0,90,216,.15);
}

/* Navbar — fondo claro para que el logo (navy + azul) se lea bien; antes
   era un navbar-dark bg-primary que lo tapaba. Fija arriba (position:
   sticky) para que, junto con .sticky-subheader, la bienvenida y los
   filtros de Cursos no se muevan al hacer scroll — solo se desplaza la
   grilla de cursos debajo. */
.navbar { padding-top: 0; padding-bottom: 0; min-height: 80px; background: #fff; position: sticky; top: 0; z-index: 1030; }

/* Bienvenida + buscador/filtros de la pantalla de Cursos (index.php): se
   queda pegado justo debajo del navbar (80px) mientras se hace scroll de
   la lista de cursos. */
.sticky-subheader {
    position: sticky; top: 80px; z-index: 1020;
    background: #f4f6fb; padding-top: 1.5rem; padding-bottom: .5rem;
    box-shadow: 0 4px 10px rgba(2,39,78,0.05);
}
.navbar-brand { padding: 0; line-height: 1; }
.navbar-brand img { display: block; height: 80px; width: auto; max-width: 100%; }
@media (max-width: 420px) {
    .navbar-brand img { height: 52px; }
}
.navbar.navbar-light .nav-link { color: #334155; font-weight: 600; }
.navbar.navbar-light .nav-link:hover,
.navbar.navbar-light .nav-link.active { color: var(--primary); }
.navbar.navbar-light .nav-link.active { position: relative; }
.navbar.navbar-light .nav-link.active::after {
    content: ''; position: absolute; left: .5rem; right: .5rem; bottom: -2px;
    height: 3px; border-radius: 2px; background: var(--primary);
}

/* Cards */
.course-card {
    transition: transform .18s, box-shadow .18s;
    border: none;
    box-shadow: var(--card-shadow);
    height: 100%;
}
.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.course-card .card-img-top {
    width: 100%;
    height: 216px;
    object-fit: cover;
    background: #f4f6fb;
}
.course-card .course-thumbnail-placeholder {
    width: 100%;
    height: 216px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}
.badge-category {
    font-size: .72rem;
    background: var(--primary);
}

/* Progress */
.progress-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--pct, 0%), #e5eaf5 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.progress-circle::before {
    content: '';
    position: absolute;
    width: 54px;
    height: 54px;
    background: white;
    border-radius: 50%;
}
.progress-circle span {
    position: relative;
    font-size: .85rem;
    font-weight: 700;
    color: var(--primary);
}

/* Quiz */
.quiz-option {
    cursor: pointer;
    border: 2px solid #dee2e6;
    border-radius: .5rem;
    padding: .75rem 1rem;
    margin-bottom: .5rem;
    transition: all .15s;
}
.quiz-option:hover {
    border-color: var(--primary);
    background: #eef2ff;
}
.quiz-option.selected {
    border-color: var(--primary);
    background: #eef2ff;
}
.quiz-option.correct {
    border-color: var(--success);
    background: #f0fdf4;
}
.quiz-option.incorrect {
    border-color: #e02424;
    background: #fff5f5;
}

/* Certificate */
.certificate-preview {
    background: linear-gradient(135deg, #fefefe 0%, #f5f0e8 100%);
    border: 8px solid #c9a227;
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    position: relative;
    font-family: 'Georgia', serif;
}
.certificate-preview::before,
.certificate-preview::after {
    content: '✦';
    position: absolute;
    font-size: 1.5rem;
    color: #c9a227;
    top: 1rem;
}
.certificate-preview::before { left: 1.5rem; }
.certificate-preview::after { right: 1.5rem; }

/* Admin */
.admin-sidebar {
    min-height: calc(100vh - 56px);
    background: white;
    box-shadow: var(--card-shadow);
}
.admin-sidebar .nav-link {
    color: #374151;
    padding: .6rem 1rem;
    border-radius: .4rem;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: #eef2ff;
    color: var(--primary);
}
.admin-sidebar .nav-link i {
    width: 20px;
}

/* Score ring */
.score-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 auto;
}
.score-ring.pass {
    background: #f0fdf4;
    color: var(--success);
    border: 6px solid var(--success);
}
.score-ring.fail {
    background: #fff5f5;
    color: #e02424;
    border: 6px solid #e02424;
}

/* Video container */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: .5rem;
    background: #000;
}
.video-container iframe,
.video-container embed {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #f4f8fd 0%, #eaf2fd 55%, #f7fbff 100%);
}
.login-blob {
    position: absolute;
    border-radius: 50%;
    opacity: .5;
    z-index: 0;
}
.login-blob.b1 { width: 620px; height: 620px; background: radial-gradient(circle at 30% 30%, #cfe3fb, transparent 70%); top: -220px; left: -180px; }
.login-blob.b2 { width: 520px; height: 520px; background: radial-gradient(circle at 70% 70%, #dbe9fc, transparent 70%); bottom: -220px; right: -160px; }
.login-inner { position: relative; z-index: 1; width: 100%; max-width: 430px; }
.login-logo { display: block; margin: 0 auto; height: 62px; width: auto; max-width: 100%; }
.login-divider {
    width: 90px; height: 4px; border-radius: 2px; margin: 1.1rem auto 1.6rem;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
}
.login-headline {
    text-align: center; color: var(--primary-dark); font-weight: 800;
    font-size: 1.85rem; line-height: 1.2; margin-bottom: .5rem;
}
.login-subtext { text-align: center; color: #64748b; margin-bottom: 2rem; }
.login-card {
    background: #fff; border: none; border-radius: 1.1rem;
    box-shadow: 0 20px 50px rgba(2,39,78,0.12);
    padding: 2.2rem 2rem;
}
.login-card h5 { color: var(--primary-dark); font-weight: 800; font-size: 1.4rem; }
.login-card .form-label { font-weight: 600; color: #1f2937; font-size: .92rem; }
.login-input-group {
    display: flex; align-items: center;
    border: 1.5px solid #e2e8f0; border-radius: .7rem;
    padding: .15rem .9rem; transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.login-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(0,90,216,.12);
}
.login-input-group i { color: #94a3b8; font-size: 1.05rem; margin-right: .65rem; }
.login-input-group input {
    border: none; outline: none; flex: 1; padding: .7rem 0; font-size: .98rem; background: transparent;
}
.login-input-group .toggle-pw { cursor: pointer; color: #94a3b8; margin-right: 0; margin-left: .5rem; }
.login-forgot { text-align: right; margin: .5rem 0 1.3rem; }
.login-forgot a { color: var(--primary); text-decoration: none; font-size: .9rem; font-weight: 600; }
.login-forgot a:hover { text-decoration: underline; }
.btn-login {
    width: 100%; background: var(--primary-dark); border: none; color: #fff;
    font-weight: 700; padding: .85rem; border-radius: .7rem; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    transition: background .15s;
}
.btn-login:hover { background: #01182f; color: #fff; }
.login-secure { text-align: center; color: #94a3b8; font-size: .85rem; margin-top: 1rem; }
.login-help { text-align: center; margin-top: 1.8rem; color: #64748b; font-size: .92rem; }
.login-help a { color: var(--primary); font-weight: 600; text-decoration: none; }
.login-help a:hover { text-decoration: underline; }
.login-footer {
    text-align: center; margin-top: 1.8rem; padding-top: 1.4rem;
    border-top: 1px solid #e2e8f0; color: #9aa7b8; font-size: .82rem;
}
@media (max-width: 420px) {
    .login-logo { height: 46px; }
    .login-headline { font-size: 1.5rem; }
    .login-card { padding: 1.6rem 1.3rem; }
}

/* Misc */
.stat-card {
    border: none;
    border-radius: .75rem;
    box-shadow: var(--card-shadow);
}
.text-accent { color: var(--accent); }
.bg-accent { background: var(--accent); }
