/* --- CONFIGURACIÓN BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { 
    max-width: 100%;
    overflow-x: hidden;
}
body { 
    font-family: 'Roboto', sans-serif; 
    background-color: #f9f9f9; 
    padding-top: 110px; /* Espacio para la navbar fija */
}

/* --- NAVBAR (ESTILO YOUTUBE) --- */
:root {
    --primary: #ef4444;
}
.navbar { 
    position: fixed; top: 0; width: 100%; height: 110px; 
    background: #fff; display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 4000; box-shadow: 0 1px 5px rgba(0,0,0,0.1); 
}
.nav-left { display: flex; align-items: center; }
.menu-toggle { font-size: 20px; cursor: pointer; color: #606060; margin-right: 20px; padding: 10px; border-radius: 50%; }
.menu-toggle:hover { background: #f2f2f2; }
.logo img { height: 80px; width: auto; }

.nav-right { display: flex; align-items: center; gap: 15px; }

/* Ocultar elementos de móvil en desktop */
.close-search, .search-mobile-toggle { display: none !important; }

/* --- BARRA DE BÚSQUEDA PROFESIONAL (MEJORADA) --- */
.nav-center { flex: 1; display: flex; justify-content: center; padding: 0 20px; }

.search-form { 
    display: flex; 
    width: 100%; 
    max-width: 600px; 
    background: #f8f8f8; 
    border-radius: 40px; 
    border: 1px solid #ccc;
    transition: all 0.3s ease;
    overflow: hidden;
}

.search-form input { 
    flex: 1;
    padding: 10px 20px; 
    border: none; 
    background: transparent; 
    outline: none; 
    font-size: 15px;
    color: #333;
}

.search-form button { 
    background: #f0f0f0; 
    border: none; 
    border-left: 1px solid #ccc;
    padding: 0 20px; 
    cursor: pointer; 
    color: #606060;
    transition: all 0.3s ease;
}
.search-form button:hover { background: #e8e8e8; color: #333; }

/* Botones Navbar */
.btn-sca {
    text-decoration: none;
    background: #f3f4f6;
    color: #4b5563 !important;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-sca:hover {
    background: #e5e7eb;
    color: #111827 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-registro {
    text-decoration: none;
    background: #fff;
    color: #0f0f0f !important;
    padding: 8px 22px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-registro:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-ingresar {
    text-decoration: none;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white !important;
    padding: 8px 22px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-ingresar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4);
}

.btn-upload-modern {
    color: #ef4444 !important;
    font-size: 24px;
    transition: transform 0.3s ease;
}
.btn-upload-modern:hover {
    transform: scale(1.1);
}

/* Efecto al hacer clic en la barra */
.search-form:focus-within {
    background: #fff;
    border-color: #1a73e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* --- SIDEBARS --- */
.sidebar-mini { 
    width: 85px; position: fixed; top: 110px; left: 0; bottom: 0; 
    background: #fff; border-right: 1px solid #eee; z-index: 1000; overflow-y: auto; 
}
.sidebar-mini ul { list-style: none; padding-top: 10px; }
.sidebar-mini li a { 
    display: flex; flex-direction: column; align-items: center; 
    padding: 15px 5px; text-decoration: none; color: #606060; transition: background 0.2s;
}
.sidebar-mini li a:hover { background: #f2f2f2; }
.sidebar-mini li.active a i, .sidebar-mini li.active a span { color: #ef4444 !important; font-weight: bold; }
.sidebar-mini li a i { font-size: 22px; margin-bottom: 5px; }
.sidebar-mini li a span { font-size: 10px; text-align: center; }

.sidebar-full { 
    position: fixed; top: 0; left: -280px; width: 280px; height: 100%; 
    background: #fff; z-index: 5000; transition: left 0.3s ease; padding-top: 20px; box-shadow: 2px 0 10px rgba(0,0,0,0.1); 
    display: flex; flex-direction: column; /* Para organizar el contenido interno */
}
.sidebar-full.open { left: 0; }

/* AJUSTE PARA MUCHAS CATEGORÍAS EN EL MENÚ DESPLEGABLE */
.sidebar-full ul { 
    list-style: none; 
    padding: 0 10px; 
    overflow-y: auto; /* Habilita el scroll interno si hay muchos items */
    flex: 1; /* Ocupa el espacio disponible */
    padding-bottom: 60px; /* Espacio extra al final para que no quede cortado */
}

.sidebar-full li a { display: flex; align-items: center; padding: 12px 15px; text-decoration: none; color: #333; border-radius: 10px; margin-bottom: 5px; }
.sidebar-full li a:hover { background: #f2f2f2; }
.sidebar-full li a i { margin-right: 20px; font-size: 18px; width: 25px; text-align: center; }

.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 4500; display: none; }
.overlay.active { display: block; }

/* --- CONTENIDO --- */
.main-content { margin-left: 85px; padding: 25px; transition: margin-left 0.3s; }

/* --- BANNER SLIDER --- */
.banner-slider { position: relative; width: 100%; height: 520px; border-radius: 15px; overflow: hidden; margin-bottom: 30px; }
.slide { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background-size: cover; background-position: center; 
    opacity: 0; transition: opacity 1s ease-in-out; display: flex; align-items: flex-end; padding: 40px;
}
.slide.active { opacity: 1; z-index: 10; }
.banner-info { color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.7); }
.banner-info h1 { font-size: 30px; margin-bottom: 10px; }
.banner-info p { font-size: 15px; opacity: 0.9; }

.slider-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7); color: #333;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 20; font-size: 18px; transition: background 0.3s;
}
.slider-btn:hover { background: #fff; }
.slider-btn.prev { left: 20px; }
.slider-btn.next { right: 20px; }

/* --- VIDEO GRID --- */
.video-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 20px; 
    margin-top: 40px;
}
.video-item { text-decoration: none; color: inherit; display: block; transition: transform 0.3s ease; }
.video-item:hover { transform: scale(1.05); }
.video-thumb { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; position: relative; }
.video-thumb img, .video-thumb canvas { width: 100%; height: 100%; object-fit: cover; }
.video-duration { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.8); color: #fff; padding: 2px 5px; border-radius: 4px; font-size: 12px; }

/* --- BOTÓN COMPARTIR --- */
.btn-share {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ef4444;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.video-item:hover .btn-share {
    opacity: 1;
}
.btn-share:hover {
    background: #ef4444;
    transform: scale(1.1);
}

/* --- INFO PERFIL --- */
.video-info-perfil { display: flex; gap: 12px; margin-top: 12px; align-items: flex-start; }
.avatar-autor { width: 36px; height: 36px; flex-shrink: 0; }
.avatar-letras { 
    width: 100%; height: 100%; border-radius: 50%; display: flex; 
    align-items: center; justify-content: center; color: #fff; font-weight: bold; font-size: 13px; 
}
.img-perfil { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.textos-video { flex: 1; }
.video-title { 
    font-size: 16px; font-weight: 500; line-height: 1.2; margin-bottom: 4px; color: #000;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-meta { font-size: 13px; color: #606060; }
.video-meta strong { color: #ef4444; font-weight: 600; display: block; margin-bottom: 2px; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar-mini { display: none; }
    .navbar { height: 70px; padding: 0 15px; }
    body { padding-top: 70px; }
    .logo img { height: 45px; }
    .banner-slider { height: 260px; }
    .category-bar { position: relative; top: 0; margin-left: -15px; margin-right: -15px; padding: 10px 15px; width: calc(100% + 30px); margin-bottom: 20px; }
    .nav-center { 
        display: none; 
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: #fff;
        z-index: 1100;
        padding: 0 15px;
        box-sizing: border-box;
        align-items: center;
    }
    .nav-center.active { display: flex; }
    .search-mobile-toggle { display: flex !important; align-items: center; justify-content: center; width: 34px; height: 34px; }
    .close-search { display: block !important; font-size: 18px; color: var(--text-muted); }
    .btn-sca, .btn-registro, .btn-ingresar, .user-nav-name, .btn-upload-modern, .nav-right a[title="Cerrar Sesión"], .nav-right a[title="Panel Admin"], .nav-right a[href="admin/index.php"], .nav-right a[href="logout.php"] { display: none !important; }
    .nav-right { gap: 10px; flex-shrink: 0; }
    .main-content { margin: 0 !important; padding: 15px !important; width: 100% !important; overflow-x: hidden; }
    .banner-slider { border-radius: 10px; margin-bottom: 20px; }
    .academia-promo { padding: 0 5px; }
}

/* --- CATEGORY BAR --- */
.category-bar {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    margin-top: 10px;
    margin-bottom: 30px;
    min-height: 56px;
    overflow-x: auto;
    scrollbar-width: none;
    background: #fff;
    position: relative;
    z-index: 900;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-pill {
    white-space: nowrap;
    padding: 6px 15px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f0f0f;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.cat-pill:hover { background: rgba(0,0,0,0.1); }
.cat-pill.active { background: #0f0f0f; color: #fff; }

/* --- BACK TO TOP --- */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}
#backToTop.show { opacity: 1; visibility: visible; }
#backToTop:hover { transform: translateY(-5px); background: #b91c1c; }

/* --- USER NAV INFO --- */
.user-nav-info { display: flex; align-items: center; gap: 10px; }
.user-nav-name { font-weight: 600; font-size: 14px; color: #333; }
.user-nav-photo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 0 0 1px #ddd; }
.user-nav-initials { width: 34px; height: 34px; border-radius: 50%; background: #ef4444; color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px; }

/* --- ONLINE CLASS CARD --- */
.badge-live {
    background: #ef4444;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    animation: pulse-red 2s infinite;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.online-class-card {
    background: #fdfdfd;
    border: 2px solid #f3f4f6;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.btn-jitsi {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-jitsi:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-jitsi.active {
    background: #0f0f0f;
    color: white;
}
