@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.cdnfonts.com/css/made-tommy-soft');

:root {
    --primary: #1a75ff;
    --primary-dark: #0052cc;
    --coral: #ff6b7b;
    --coral-dark: #d94656;
    --teal: #0ea5e9;
    --teal-dark: #0284c7;
    --emerald: #10b981;
    --emerald-dark: #059669;
    --bg-gray: #e2e8f0;
    --card-border: #cbd5e1;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-blue: #2563eb;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

body {
    background-color: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Barra de Navegación Principal Mejorada y Unificada */
.navbar {
    background: var(--white);
    border-bottom: 2px solid var(--card-border);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1200px;
    width: 94%;
    margin: 0 auto;
    padding: 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.42rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.brand-icon {
    font-size: 1.55rem;
}

.navbar-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #334155;
    font-weight: 700;
    font-size: 1.02rem;
    padding: 10px 18px;
    border-radius: 9px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: #eff6ff;
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(26, 117, 255, 0.28);
}

.btn-logout {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.btn-logout:hover {
    background: #e11d48;
    color: var(--white);
}

/* Botón Hamburguesa para Móviles */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 42px;
    height: 38px;
    padding: 9px 8px;
    background: #eff6ff;
    border: 1.5px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
}

.navbar-toggle .bar {
    height: 3px;
    width: 100%;
    background-color: var(--primary);
    border-radius: 3px;
    transition: all 0.25s ease;
}

.navbar-toggle.open .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.navbar-toggle.open .bar:nth-child(2) {
    opacity: 0;
}
.navbar-toggle.open .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Contenedores Principales con Alto Contraste sobre el Fondo Gris */
.container {
    max-width: 1160px;
    width: 94%;
    margin: 34px auto;
    flex: 1;
}

.card-panel {
    background: var(--white);
    border-radius: 16px;
    padding: 36px;
    border: 1.5px solid var(--card-border);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    margin-bottom: 28px;
}

.sub-panel {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    padding: 24px;
}

.page-title {
    color: var(--primary);
    font-size: 1.88rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.4px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1.02rem;
    margin-bottom: 28px;
    font-weight: 500;
}

/* Formularios y Controles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #334155;
}

.form-control {
    height: 50px;
    padding: 10px 16px;
    border: 1.8px solid var(--border-blue);
    border-radius: 9px;
    font-size: 0.96rem;
    font-weight: 500;
    color: var(--text-dark);
    background: var(--white);
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control:focus {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
    border-color: var(--primary-dark);
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 46px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a75ff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 16px;
    cursor: pointer;
}

/* Menú Desplegable Personalizado Moderno (Custom Select UI) */
.cselect-wrapper {
    position: relative;
    width: 100%;
    user-select: none;
}

.cselect-trigger {
    height: 50px;
    padding: 0 18px 0 16px;
    border: 1.8px solid var(--border-blue);
    border-radius: 9px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.cselect-trigger:hover {
    background: #f8fbff;
    border-color: var(--primary-dark);
}

.cselect-wrapper.open .cselect-trigger {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
    border-color: var(--primary);
}

.cselect-arrow {
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    padding-right: 4px;
    transition: transform 0.22s ease;
}

.cselect-wrapper.open .cselect-arrow {
    transform: rotate(180deg);
}

.cselect-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1.8px solid var(--border-blue);
    border-radius: 11px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
    z-index: 999;
    display: none;
    overflow: hidden;
    animation: fadeInMenu 0.16s ease-out;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.cselect-wrapper.open .cselect-menu {
    display: block;
}

.cselect-search-box {
    padding: 10px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.cselect-search-input {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    font-size: 0.88rem;
    outline: none;
}

.cselect-search-input:focus {
    border-color: var(--primary);
}

.cselect-options-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
}

.cselect-option {
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 0.94rem;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s;
}

.cselect-option:hover {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

.cselect-option.selected {
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
}

/* Botón Personalizado para Subir Archivos (Excel / PDF) */
.file-upload-modern {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 6px 14px 6px 8px;
    border: 1.8px dashed var(--border-blue);
    border-radius: 10px;
    background: #f8fbff;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.file-upload-modern:hover {
    background: #eff6ff;
    border-style: solid;
    box-shadow: 0 4px 12px rgba(26, 117, 255, 0.1);
}

.file-upload-modern input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-upload-btn {
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
    font-size: 0.86rem;
    padding: 8px 14px;
    border-radius: 7px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(26, 117, 255, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-upload-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Botones con Relieve 3D Uniforme */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 50px;
    padding: 0 26px;
    font-size: 0.96rem;
    font-weight: 700;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, filter 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.btn:active {
    transform: translateY(2px);
}

.btn-blue {
    background-color: var(--primary);
    color: var(--white);
    border-bottom: 4px solid var(--primary-dark);
    box-shadow: 0 4px 12px rgba(26, 117, 255, 0.22);
}

.btn-blue:hover {
    filter: brightness(1.07);
}

.btn-coral {
    background-color: var(--coral);
    color: var(--white);
    border-bottom: 4px solid var(--coral-dark);
    box-shadow: 0 4px 12px rgba(255, 107, 123, 0.25);
}

.btn-coral:hover {
    filter: brightness(1.06);
}

.btn-emerald {
    background-color: var(--emerald);
    color: var(--white);
    border-bottom: 4px solid var(--emerald-dark);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-emerald:hover {
    filter: brightness(1.06);
}

.btn-outline {
    background-color: #eff6ff;
    color: var(--primary);
    border: 1.8px solid var(--primary);
    border-bottom: 4px solid var(--primary-dark);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: var(--white);
}

.btn-sm {
    height: 38px;
    padding: 0 14px;
    font-size: 0.85rem;
    border-radius: 7px;
}

/* =====================================================================
   CORRECCIÓN DEL CALENDARIO FLATPICKR (Columna Domingo 100% visible)
   ===================================================================== */
.flatpickr-calendar {
    width: 336px !important;
    border-radius: 14px !important;
    border: 2px solid var(--primary) !important;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18) !important;
    padding: 12px 10px !important;
    box-sizing: border-box !important;
}

.flatpickr-innerContainer,
.flatpickr-rContainer,
.flatpickr-weekdays,
.flatpickr-days,
.dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.flatpickr-weekdaycontainer {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    width: 100% !important;
}

span.flatpickr-weekday {
    font-weight: 800 !important;
    color: #475569 !important;
    font-size: 0.82rem !important;
    text-align: center !important;
}

.dayContainer {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 2px 0 !important;
    padding: 4px 0 !important;
}

.flatpickr-day {
    width: 100% !important;
    max-width: 40px !important;
    height: 38px !important;
    line-height: 38px !important;
    margin: 0 auto !important;
    border-radius: 50% !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
}

.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--white) !important;
    font-weight: 800 !important;
}

.flatpickr-months {
    margin-bottom: 8px !important;
}

.flatpickr-months .flatpickr-month {
    color: var(--primary) !important;
    font-weight: 800 !important;
}

/* =====================================================================
   WIDGET RECAPTCHA INTERACTIVO FUNCIONAL Y SIN ERRORES ROJOS
   ===================================================================== */
.recaptcha-modern-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 320px;
    height: 76px;
    padding: 0 16px;
    background: #f9fafb;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    margin-bottom: 22px;
    cursor: pointer;
    user-select: none;
    transition: all 0.22s ease;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
}

.recaptcha-modern-card:hover {
    background: #f0f7ff;
    border-color: var(--primary);
    box-shadow: 0 8px 22px rgba(26, 117, 255, 0.16);
    transform: translateY(-2px);
}

.recaptcha-modern-card.verified {
    border-color: var(--emerald);
    background: #f0fdf4;
}

.recaptcha-left-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.recaptcha-checkbox-box {
    width: 28px;
    height: 28px;
    border: 2px solid #64748b;
    border-radius: 5px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.recaptcha-modern-card:hover .recaptcha-checkbox-box {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 117, 255, 0.15);
}

.recaptcha-modern-card.loading .recaptcha-checkbox-box {
    border-color: transparent;
    background: transparent;
}

.recaptcha-spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid #cbd5e1;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinRecaptcha 0.65s linear infinite;
}

.recaptcha-modern-card.loading .recaptcha-spinner {
    display: block;
}

@keyframes spinRecaptcha {
    to { transform: rotate(360deg); }
}

.recaptcha-checkmark {
    display: none;
    color: var(--emerald);
    stroke-width: 3.5;
}

.recaptcha-modern-card.verified .recaptcha-checkbox-box {
    border-color: var(--emerald);
    background: #dcfce7;
}

.recaptcha-modern-card.verified .recaptcha-checkmark {
    display: block;
    animation: popCheck 0.2s ease-out;
}

@keyframes popCheck {
    0% { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.recaptcha-text {
    font-size: 0.96rem;
    font-weight: 700;
    color: #1e293b;
}

.recaptcha-brand-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.recaptcha-brand-right span {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    margin-top: 2px;
}

.recaptcha-brand-right small {
    font-size: 0.55rem;
    color: #94a3b8;
}

/* Tarjetas de Módulos en Index.php */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 26px;
}

.module-card {
    background: var(--white);
    border: 1.8px solid #cbd5e1;
    border-radius: 16px;
    padding: 32px 26px;
    text-align: center;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
}

.module-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(26, 117, 255, 0.14);
}

.module-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 800;
}

/* Tablas y Paginación Numerada */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    background: var(--white);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.92rem;
}

th {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 800;
}

tr:hover {
    background: #f8fafc;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.page-link {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    background: var(--white);
    color: var(--text-dark);
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

.page-link.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(26, 117, 255, 0.25);
}

/* Ventana Modal para Editar Estudiante */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal-backdrop.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    padding: 30px;
    border: 1.5px solid var(--card-border);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    animation: fadeInMenu 0.2s ease-out;
}

/* Tarjetas de Resultados en Módulo 3 */
.student-header-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 22px;
}

.student-meta p {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.student-meta strong {
    display: inline-block;
    min-width: 195px;
    font-weight: 800;
}

.cert-list-container {
    max-height: 540px;
    overflow-y: auto;
    padding-right: 6px;
}

.cert-row-card {
    border: 2px solid var(--border-blue);
    border-radius: 11px;
    background: var(--white);
    display: grid;
    grid-template-columns: 2.2fr 1.2fr 0.7fr 1.9fr;
    margin-bottom: 16px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.cert-row-card:hover {
    box-shadow: 0 6px 16px rgba(26, 117, 255, 0.14);
}

.cert-col {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1.8px solid var(--border-blue);
}

.cert-col:last-child {
    border-right: none;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.cert-course-title {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.96rem;
    text-transform: uppercase;
}

.cert-dates { font-size: 0.88rem; color: #334155; line-height: 1.6; font-weight: 500; }
.cert-hours { font-size: 0.92rem; color: #1e293b; text-align: center; font-weight: 700; }
.cert-grade { color: var(--primary); font-weight: 800; font-size: 0.92rem; margin-bottom: 3px; }
.cert-code { font-size: 0.88rem; color: #334155; font-weight: 600; }

.cert-icon-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #64748b;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Alertas */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 0.93rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1.5px solid #86efac; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1.5px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1.5px solid #93c5fd; }

/* Adaptabilidad Responsiva para Celulares y Tablets */
@media (max-width: 900px) {
    .navbar-toggle {
        display: flex;
    }
    .navbar-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 14px;
        margin-top: 12px;
        border-top: 1.5px solid #e2e8f0;
    }
    .navbar-nav.show {
        display: flex;
    }
    .navbar-container {
        flex-wrap: wrap;
    }
    .nav-link {
        text-align: left;
        padding: 12px 16px;
    }
}

@media (max-width: 768px) {
    .card-panel {
        padding: 22px 16px;
    }
    .page-title {
        font-size: 1.48rem;
    }
    .cert-row-card {
        grid-template-columns: 1fr;
    }
    .cert-col {
        border-right: none;
        border-bottom: 1.8px solid var(--border-blue);
        padding: 14px 16px;
    }
    .cert-col:last-child {
        border-bottom: none;
    }
    .cert-hours {
        text-align: left;
    }
    .student-meta strong {
        min-width: 140px;
    }
}