/* ======================================================
   EducaTube - Variables & Theme Configuration
   ====================================================== */
:root {
    --bg-primary: #f9f9f9;
    --bg-secondary: #ffffff;
    --bg-hover: #e5e5e5;
    --text-primary: #0f0f0f;
    --text-secondary: #606060;
    --border-color: #e0e0e0;
    --navbar-bg: #ffffff;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --accent-red: #cc0000;
}

/* Modo Escuro */
body.dark-mode {
    --bg-primary: #0f0f0f;
    --bg-secondary: #181818;
    --bg-hover: #272727;
    --text-primary: #f1f1f1;
    --text-secondary: #aaa;
    --border-color: #303030;
    --navbar-bg: #0f0f0f;
    --card-bg: #0f0f0f;
    --sidebar-bg: #0f0f0f;
}

/* ======================================================
   Base Styles
   ====================================================== */
body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    font-family: "Roboto", "Segoe UI", Arial, sans-serif;
    padding-top: 56px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none !important;
}

.text-custom-main { color: var(--text-primary) !important; }
.text-custom-muted { color: var(--text-secondary) !important; }

/* Top Navbar */
.navbar-custom {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--border-color);
    z-index: 1040;
}
.brand-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
}

/* ======================================================
   Sidebar & Layout Responsivo Definitivo
   ====================================================== */

/* Telas Grandes (Desktop >= 992px) */
@media (min-width: 992px) {
    .sidebar-desktop {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 240px !important;
        background-color: var(--sidebar-bg) !important;
        border-right: 1px solid var(--border-color);
        overflow-y: auto;
        z-index: 100;
        display: block !important;
        visibility: visible !important;
        transform: none !important;
    }

    .content-area {
        margin-left: 240px !important;
        padding: 24px !important;
        width: calc(100% - 240px) !important;
    }
}

/* Telas Menores / Mobile (< 992px) */
@media (max-width: 991.98px) {
    .sidebar-desktop {
        width: 260px !important;
        background-color: var(--sidebar-bg) !important;
        border-right: 1px solid var(--border-color);
    }

    .content-area {
        margin-left: 0 !important;
        padding: 16px !important;
        width: 100% !important;
    }
}

/* Links da Sidebar */
.nav-link-custom {
    color: var(--text-primary) !important;
    text-decoration: none !important;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.nav-link-custom:hover, 
.nav-link-custom.active {
    background-color: var(--bg-hover);
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* ======================================================
   YouTube Video Cards Grid
   ====================================================== */
.video-card {
    background: transparent;
    border: none;
    cursor: pointer;
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Aspect Ratio 16:9 */
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-hover);
}

.thumbnail-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease-in-out;
}

.video-card:hover .thumbnail-wrapper img {
    transform: scale(1.03);
}

.badge-xp {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(204, 0, 0, 0.9);
    color: #fff;
    font-weight: bold;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    z-index: 2;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.video-info {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}
.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.video-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.video-meta {
    font-size: 0.825rem;
    color: var(--text-secondary);
}

/* ======================================================
   Search Input (Estilo YouTube)
   ====================================================== */
.search-input {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 40px 0 0 40px !important;
    padding-left: 16px;
}
.search-btn {
    border: 1px solid var(--border-color) !important;
    border-left: none !important;
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border-radius: 0 40px 40px 0 !important;
    padding-left: 20px;
    padding-right: 20px;
}

/* ======================================================
   Filtros de Categoria (Estilo Pílula YouTube)
   ====================================================== */
.categories-bar {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 12px;
    margin-bottom: 20px;
    scrollbar-width: none; /* Oculta barra de rolagem no Firefox */
}

.categories-bar::-webkit-scrollbar {
    display: none; /* Oculta barra de rolagem no Chrome/Safari */
}

.chip-category {
    background-color: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 6px 14px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.chip-category:hover {
    background-color: var(--border-color) !important;
}

.chip-category.active {
    background-color: var(--text-primary) !important;
    color: var(--bg-primary) !important;
    border-color: transparent !important;
}

/* ======================================================
   Avatar de Iniciais & Botão Login YouTube Style
   ====================================================== */
.avatar-initials {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--accent-red);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    user-select: none;
}

.avatar-initials.sm {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

/* Garante que o menu suspenso não feche acidentalmente durante a digitação */
.dropdown-menu[data-bs-popper] {
    margin-top: 8px;
}/* Ajuste para garantir que o botão de alternar tema seja um círculo perfeito */

#themeToggle {
    width: 33px !important;
    height: 33px !important;
    min-width: 33px !important;
    min-height: 33px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}