/* ==========================================================================
   UTVA APP — CSS RESPONSIVE COMPLETO
   ========================================================================== */

/* --- RESET GLOBAL --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
    background-color: #f4f6f8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.4;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   APP CONTAINER
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background-color: #ffffff;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    padding-bottom: calc(55px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* ==========================================================================
   LOGIN / REGISTRO (index.php)
   ========================================================================== */
.login-header {
    padding: 40px 20px 30px 20px;
    text-align: center;
    width: 100%;
    background: #1a237e;
    color: white;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    margin-bottom: 30px;
}

.app-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    padding: 5px;
    object-fit: contain;
    margin: 0 auto 15px;
}

.login-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.login-header p {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.form-box {
    width: 90%;
    margin: 0 auto;
    max-width: 360px;
}

/* --- Inputs --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"] {
    width: 100%;
    padding: 14px 16px;
    margin: 8px 0;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    background: #f9f9f9;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

input:focus {
    background: #fff;
    border-color: #1a237e;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

/* --- Botones --- */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    background-color: #c5a059;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 12px;
    transition: opacity 0.2s ease;
    -webkit-appearance: none;
}

.btn:active {
    opacity: 0.85;
}

.btn-secondary {
    background-color: #1a237e;
}

/* ==========================================================================
   DASHBOARD HEADER
   ========================================================================== */
.dashboard-header {
    width: 100%;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 16px 15px;
    min-height: 68px;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.user-welcome {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.user-welcome h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-welcome p {
    margin: 2px 0 0 0;
    font-size: 0.75rem;
    opacity: 0.85;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.header-icon-wrapper:active {
    background: rgba(255,255,255,0.35);
}

/* ==========================================================================
   SECCIÓN HEADER (Categorías)
   ========================================================================== */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 15px 6px 15px;
}

.section-header h3 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1a237e;
    line-height: 1.3;
}

.section-header p {
    margin: 2px 0 0 0;
    font-size: 0.7rem;
    color: #999;
}

.section-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #1a237e, #3949ab);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(26, 35, 126, 0.3);
}

.section-icon.cert {
    background: linear-gradient(135deg, #2e7d32, #43a047);
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3);
}

/* ==========================================================================
   GRID DE CURSOS
   ========================================================================== */
.course-grid {
    width: 100%;
    padding: 10px 15px 15px 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* --- Tarjeta de Curso (ahora es <a>) --- */
.course-card {
    background: white;
    border-radius: 14px;
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    border: 1.5px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 105px;
    text-decoration: none !important;
    color: inherit !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    border-color: #ddd;
}

.course-card:active {
    background: #f5f5f5;
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.course-card:visited {
    color: inherit !important;
}

.course-icon {
    font-size: 1.5rem;
    color: #c5a059;
    margin-bottom: 8px;
    background: #fff8e1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.course-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 0 4px;
}

/* --- Badge Tipo (Grado / Certificación) --- */
.course-type-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.course-type-badge.degree {
    background: #e8eaf6;
    color: #1a237e;
}

.course-type-badge.cert {
    background: #e8f5e9;
    color: #2e7d32;
}

.course-icon.cert-icon {
    color: #2e7d32;
    background: #e8f5e9;
}

/* ==========================================================================
   DETALLE CURSO (curso.php)
   ========================================================================== */
.detail-view {
    padding: 15px;
}

.detail-view h2 {
    color: #1a237e;
    margin-bottom: 8px;
    font-size: 1.3rem;
}

.detail-badge {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    display: inline-block;
    margin-bottom: 15px;
}

.detail-desc {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.detail-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: #c5a059;
    margin-bottom: 15px;
    display: block;
    text-align: center;
}

/* ==========================================================================
   SECCIÓN CONTACTO
   ========================================================================== */
.contact-section {
    padding: 10px 20px 25px 20px;
    text-align: center;
}

.contact-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    margin-bottom: 18px;
}

.contact-note {
    font-size: 0.78rem;
    color: #666;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.contact-note i {
    color: #1a237e;
    margin-right: 4px;
}

.contact-email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #e8eaf6;
    color: #1a237e;
    border-radius: 25px;
    text-decoration: none !important;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.2s ease;
    max-width: 100%;
    word-break: break-all;
}

.contact-email:hover,
.contact-email:active {
    background: #c5cae9;
}

.contact-email i {
    font-size: 1rem;
    flex-shrink: 0;
}

.contact-whatsapp-note {
    font-size: 0.7rem;
    color: #999;
    line-height: 1.5;
    margin: 14px 0 0 0;
    text-align: center;
}

.contact-whatsapp-note i {
    color: #25d366;
    margin-right: 3px;
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN INFERIOR
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 55px;
    height: calc(55px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: white;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9aa0a6;
    font-size: 0.63rem;
    font-weight: 500;
    width: 100%;
    height: 100%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease;
    padding: 0;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.nav-item.active {
    color: #1a237e;
}

/* ==========================================================================
   MODAL PERFIL
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 30px 25px;
    width: 100%;
    max-width: 340px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.profile-avatar {
    width: 65px;
    height: 65px;
    background: #e3eafc;
    color: #1a237e;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.btn-close {
    background: #f1f1f1;
    border: none;
    padding: 10px 22px;
    border-radius: 22px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
    transition: background 0.2s ease;
}

.btn-close:active {
    background: #e0e0e0;
}

/* ==========================================================================
   SPLASH SCREEN
   ========================================================================== */
.splash-screen {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #1a237e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

.splash-logo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: white;
    padding: 8px;
    object-fit: contain;
    animation: splashPulse 1.5s ease-in-out infinite;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.splash-text {
    color: white;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 20px;
    opacity: 0;
    animation: splashFadeIn 0.6s ease 0.3s forwards;
    line-height: 1.4;
}

@keyframes splashFadeIn {
    to { opacity: 1; }
}

.splash-loader {
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    margin-top: 30px;
    overflow: hidden;
}

.splash-loader::after {
    content: '';
    display: block;
    width: 60%;
    height: 100%;
    background: #c5a059;
    border-radius: 10px;
    animation: splashLoad 1s ease-in-out infinite;
}

@keyframes splashLoad {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 15px;
    animation: toastIn 0.3s ease;
    line-height: 1.4;
}

.toast-exito { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.toast-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.toast-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* ==========================================================================
   FORM TABS (Login / Registro)
   ========================================================================== */
.form-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    padding: 4px;
}

.form-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-tab.active {
    background: white;
    color: #1a237e;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ==========================================================================
   FORGOT PASSWORD LINK
   ========================================================================== */
.forgot-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 15px;
    color: #1a237e !important;
    text-decoration: none !important;
    font-size: 0.8rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.forgot-link:active { opacity: 0.7; }

/* ==========================================================================
   LOGIN FOOTER
   ========================================================================== */
.login-footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
}

.login-footer p {
    font-size: 0.68rem;
    color: #ccc;
}

/* ==========================================================================
   SEARCH BAR
   ========================================================================== */
.search-wrap {
    padding: 10px 15px 0;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f6fa;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    padding: 0 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar:focus-within {
    border-color: #1a237e;
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.08);
    background: white;
}

.search-bar i {
    color: #999;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    margin: 0;
    font-size: 0.85rem;
    outline: none;
    box-shadow: none !important;
}

.search-bar input::placeholder { color: #bbb; }

.btn-clear-search {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: #e0e0e0;
    border-radius: 50%;
    color: #666;
    font-size: 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s;
}

.btn-clear-search:active { background: #ccc; }

/* ==========================================================================
   SKELETON LOADING
   ========================================================================== */
@keyframes skeletonShimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton-pulse {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.skeleton-card {
    pointer-events: none;
}

/* ==========================================================================
   NO RESULTS
   ========================================================================== */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #bbb;
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.no-results p {
    font-size: 0.85rem;
}

/* ==========================================================================
   @media QUERIES — RESPONSIVE
   ========================================================================== */

/* --- Pantallas muy pequeñas (< 320px) --- */
@media screen and (max-width: 319px) {
    .login-header {
        padding: 30px 15px 25px;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
    }

    .app-logo {
        width: 80px;
        height: 80px;
    }

    .login-header h2 {
        font-size: 1rem;
    }

    .form-box {
        width: 95%;
    }

    .dashboard-header {
        padding: 12px 10px;
        min-height: 58px;
    }

    .user-welcome h2 {
        font-size: 0.95rem;
    }

    .section-header {
        padding: 15px 10px 4px;
        gap: 8px;
    }

    .section-header h3 {
        font-size: 0.82rem;
    }

    .section-icon {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .course-grid {
        padding: 8px 10px 12px;
        gap: 8px;
    }

    .course-card {
        padding: 10px 6px;
        min-height: 90px;
        border-radius: 10px;
    }

    .course-icon {
        width: 34px;
        height: 34px;
        font-size: 1.3rem;
        margin-bottom: 6px;
    }

    .course-title {
        font-size: 0.72rem;
    }

    .course-type-badge {
        font-size: 0.52rem;
        padding: 1px 7px;
    }

    .contact-section {
        padding: 10px 12px 20px;
    }

    .contact-email {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    .contact-whatsapp-note {
        font-size: 0.65rem;
    }
}

/* --- Pantallas pequeñas (320px - 374px) --- */
@media screen and (min-width: 320px) and (max-width: 374px) {
    .login-header {
        padding: 35px 18px 28px;
    }

    .app-logo {
        width: 90px;
        height: 90px;
    }

    .course-grid {
        padding: 8px 12px 12px;
        gap: 9px;
    }

    .course-card {
        min-height: 95px;
    }

    .course-title {
        font-size: 0.75rem;
    }
}

/* --- Pantallas medianas (375px - 413px) — iPhone normal --- */
@media screen and (min-width: 375px) and (max-width: 413px) {
    /* Estilos base sirven bien aquí */
    .course-grid {
        padding: 10px 14px 14px;
        gap: 10px;
    }
}

/* --- Pantallas grandes (414px - 479px) — iPhone Plus, Android grandes --- */
@media screen and (min-width: 414px) and (max-width: 479px) {
    .course-grid {
        padding: 12px 16px 16px;
        gap: 12px;
    }

    .course-card {
        padding: 16px 10px;
        min-height: 115px;
    }

    .course-icon {
        width: 44px;
        height: 44px;
        font-size: 1.6rem;
        margin-bottom: 8px;
    }

    .course-title {
        font-size: 0.82rem;
    }

    .section-header {
        padding: 22px 16px 6px;
        gap: 14px;
    }

    .section-header h3 {
        font-size: 1rem;
    }

    .section-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}

/* --- Desktop / Tablet (>= 480px) --- */
@media screen and (min-width: 480px) {
    .app-container {
        border-radius: 0;
    }

    .login-header {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .dashboard-header {
        border-radius: 0;
    }

    .course-grid {
        padding: 14px 20px 18px;
        gap: 14px;
    }

    .course-card {
        padding: 18px 12px;
        min-height: 120px;
        border-radius: 16px;
    }

    .course-icon {
        width: 48px;
        height: 48px;
        font-size: 1.7rem;
    }

    .course-title {
        font-size: 0.85rem;
    }

    .course-type-badge {
        font-size: 0.62rem;
        padding: 3px 12px;
    }

    .section-header {
        padding: 24px 20px 8px;
        gap: 14px;
    }

    .section-header h3 {
        font-size: 1.05rem;
    }

    .section-icon {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }

    .contact-section {
        padding: 15px 24px 35px;
    }

    .contact-email {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
}

/* --- Pantallas muy anchas (>= 768px) — Tablet landscape / Desktop --- */
@media screen and (min-width: 768px) {
    .app-container {
        margin-top: 20px;
        margin-bottom: 20px;
        border-radius: 24px;
        box-shadow: 0 4px 40px rgba(0,0,0,0.08);
        border: 1px solid #eee;
        overflow: hidden;
    }

    .bottom-nav {
        border-radius: 0 0 24px 24px;
    }

    .modal-content {
        max-width: 380px;
        border-radius: 20px;
    }
}

/* --- Landscape en móviles --- */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .login-header {
        padding: 20px 20px 15px;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
        margin-bottom: 15px;
    }

    .app-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 8px;
    }

    .login-header h2 {
        font-size: 1rem;
    }

    .login-header p {
        font-size: 0.8rem;
        margin-top: 3px;
    }

    .form-box {
        margin-top: 10px;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        padding: 10px 14px;
        margin: 5px 0;
    }

    .btn {
        padding: 10px;
        margin-top: 8px;
    }

    .section-header {
        padding: 10px 15px 4px;
    }

    .course-grid {
        padding: 6px 15px 10px;
        gap: 8px;
    }

    .course-card {
        min-height: 80px;
        padding: 8px 6px;
    }

    .course-icon {
        width: 30px;
        height: 30px;
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .course-title {
        font-size: 0.7rem;
    }

    .course-type-badge {
        display: none;
    }

    .dashboard-header {
        min-height: 50px;
        padding: 10px 15px;
    }
}

/* --- Alto contraste (accesibilidad) --- */
@media (prefers-contrast: high) {
    .course-card {
        border-color: #666;
    }

    .course-type-badge.degree {
        border: 1px solid #1a237e;
    }

    .course-type-badge.cert {
        border: 1px solid #2e7d32;
    }

    .contact-email {
        border: 1px solid #1a237e;
    }
}

/* --- Reducir movimiento (accesibilidad) --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   MODO OSCURO — CSS CUSTOM PROPERTIES
   ========================================================================== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f4f6f8;
    --bg-card: #ffffff;
    --bg-input: #f9f9f9;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #f0f0f0;
    --border-strong: #e0e0e0;
    --shadow-color: rgba(0,0,0,0.06);
    --nav-bg: #ffffff;
    --modal-bg: rgba(0,0,0,0.6);
    --overlay-bg: rgba(0,0,0,0.85);
}

[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a47;
    --bg-input: #232d4a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a8c0;
    --text-muted: #6b7394;
    --border-color: #2a3555;
    --border-strong: #344068;
    --shadow-color: rgba(0,0,0,0.2);
    --nav-bg: #16213e;
    --modal-bg: rgba(0,0,0,0.7);
    --overlay-bg: rgba(0,0,0,0.9);
}

[data-theme="dark"] body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .app-container {
    background-color: var(--bg-primary);
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--bg-input);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background: var(--bg-card);
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}

[data-theme="dark"] .course-card {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .course-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

[data-theme="dark"] .course-title {
    color: var(--text-primary);
}

[data-theme="dark"] .section-header h3 {
    color: #8da0ff;
}

[data-theme="dark"] .search-bar {
    background: var(--bg-input);
    border-color: var(--border-color);
}

[data-theme="dark"] .search-bar:focus-within {
    background: var(--bg-card);
    border-color: #4a6cf7;
}

[data-theme="dark"] .search-bar input {
    color: var(--text-primary);
}

[data-theme="dark"] .search-bar input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .search-bar i,
[data-theme="dark"] .btn-clear-search {
    color: var(--text-muted);
}

[data-theme="dark"] .btn-clear-search {
    background: var(--border-strong);
    color: var(--text-secondary);
}

[data-theme="dark"] .bottom-nav {
    background: var(--nav-bg);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .modal-content {
    background: var(--bg-card);
}

[data-theme="dark"] .form-tabs {
    background: var(--bg-input);
}

[data-theme="dark"] .form-tab {
    color: var(--text-muted);
}

[data-theme="dark"] .form-tab.active {
    background: var(--bg-card);
    color: #8da0ff;
    box-shadow: 0 1px 4px var(--shadow-color);
}

[data-theme="dark"] .contact-section {
    background: transparent;
}

[data-theme="dark"] .contact-note {
    color: var(--text-secondary);
}

[data-theme="dark"] .contact-email {
    background: #232d4a;
    color: #8da0ff;
}

[data-theme="dark"] .contact-whatsapp-note {
    color: var(--text-muted);
}

[data-theme="dark"] .no-results { color: var(--text-muted); }

[data-theme="dark"] .login-footer p { color: var(--text-muted); }

[data-theme="dark"] .profile-card { background: transparent; }
[data-theme="dark"] .profile-name { color: var(--text-primary); }
[data-theme="dark"] .profile-email-display { color: var(--text-secondary); }
[data-theme="dark"] .profile-since { color: var(--text-muted); }
[data-theme="dark"] .profile-section { border-bottom-color: var(--border-color); }
[data-theme="dark"] .profile-section h4 { color: #8da0ff; }
[data-theme="dark"] .profile-field label { color: var(--text-muted); }
[data-theme="dark"] .profile-field input { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-strong); }
[data-theme="dark"] .enrollment-item { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] .enrollment-title { color: var(--text-primary); }
[data-theme="dark"] .enrollment-meta { color: var(--text-muted); }

[data-theme="dark"] .toast-inline {
    border-color: var(--border-color);
}

[data-theme="dark"] .skeleton-pulse {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-color) 50%, var(--bg-input) 75%);
    background-size: 200px 100%;
}

[data-theme="dark"] .msg-perfil-success { background: #1a3a1a; color: #6fcf6f; }
[data-theme="dark"] .msg-perfil-error { background: #3a1a1a; color: #ef6f6f; }

/* ==========================================================================
   INDICADOR DE CONEXIÓN
   ========================================================================== */
.connection-bar {
    width: 100%;
    padding: 6px 15px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.3s ease;
    pointer-events: none;
}
.connection-bar.online {
    background: #e8f5e9;
    color: #2e7d32;
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}
.connection-bar.offline {
    background: #ffebee;
    color: #c62828;
    opacity: 1;
    height: auto;
    padding: 6px 15px;
}

/* ==========================================================================
   PULL TO REFRESH
   ========================================================================== */
.pull-indicator {
    width: 100%;
    text-align: center;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #1a237e, #283593);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
}
.pull-indicator.visible {
    padding: 12px;
    max-height: 50px;
}
.pull-indicator i {
    margin-right: 6px;
    transition: transform 0.3s ease;
}
.pull-indicator.refreshing i {
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   ANIMACIONES DE TRANSICIÓN ENTRE PÁGINAS
   ========================================================================== */
@keyframes pageSlideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.page-enter {
    animation: pageSlideIn 0.25s ease forwards;
}

/* ==========================================================================
   BADGE PULSE (notificaciones sin leer)
   ========================================================================== */
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #c62828;
    color: white;
    border-radius: 50%;
    font-size: 0.55rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 2s ease-in-out infinite;
}

/* ==========================================================================
   BANNER DE ANUNCIOS
   ========================================================================== */
.announcement-banner {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    color: white;
    padding: 12px 15px;
    margin: 10px 15px;
    border-radius: 12px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(21,101,192,0.3);
    cursor: pointer;
    transition: transform 0.15s ease;
}
.announcement-banner:active {
    transform: scale(0.98);
}
.announcement-banner i {
    font-size: 1rem;
    color: #c5a059;
    flex-shrink: 0;
}
.announcement-banner-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.announcement-banner-text strong {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 2px;
}
.announcement-banner-text span {
    display: block;
    font-size: 0.72rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   TUTORIAL / WELCOME OVERLAY
   ========================================================================== */
.tutorial-overlay {
    position: fixed;
    z-index: 30000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tutorial-content {
    background: white;
    border-radius: 20px;
    padding: 30px 25px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: tutorialIn 0.4s ease;
}
@keyframes tutorialIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.tutorial-step {
    display: none;
}
.tutorial-step.active {
    display: block;
}
.tutorial-icon {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, #1a237e, #283593);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.8rem;
    color: #c5a059;
}
.tutorial-content h3 {
    color: #1a237e;
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.tutorial-content p {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 20px;
}
.tutorial-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
}
.tutorial-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ddd;
    transition: all 0.3s ease;
}
.tutorial-dot.active {
    background: #1a237e;
    width: 20px;
    border-radius: 4px;
}
.tutorial-actions {
    display: flex;
    gap: 10px;
}
.tutorial-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.tutorial-btn-skip {
    background: #f0f0f0;
    color: #666;
}
.tutorial-btn-next {
    background: #1a237e;
    color: white;
}

/* ==========================================================================
   TAMAÑO DE FUENTE GRANDE
   ========================================================================== */
[data-fontsize="grande"] body { font-size: 18px; }
[data-fontsize="grande"] input[type="text"],
[data-fontsize="grande"] input[type="email"],
[data-fontsize="grande"] input[type="password"],
[data-fontsize="grande"] input[type="number"],
[data-fontsize="grande"] input[type="tel"],
[data-fontsize="grande"] textarea { font-size: 17px; }
[data-fontsize="grande"] .user-welcome h2 { font-size: 1.3rem; }
[data-fontsize="grande"] .section-header h3 { font-size: 1.05rem; }
[data-fontsize="grande"] .course-title { font-size: 0.9rem; }
[data-fontsize="grande"] .btn { font-size: 17px; }

/* ==========================================================================
   ANIMACIONES GENERALES
   ========================================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in-up {
    animation: fadeInUp 0.3s ease forwards;
}

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