/* Reset básico e fontes */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    background-color: #f9f9f9;
    color: #0f0f0f;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Garante que o body ocupe a altura toda */
    font-size: 14px;
    line-height: 1.4;
}

img {
    max-width: 100%;
    height: auto;
    display: block; /* Evita espaços extras abaixo das imagens */
}

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

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky; /* Mantém o header fixo no topo */
    top: 0;
    z-index: 1000;
    height: 56px; /* Altura fixa para cálculo da sidebar - como no YouTube */
}

.header__left,
.header__right {
    display: flex;
    align-items: center;
}

.header__menu-btn {
    font-size: 24px;
    margin-right: 16px;
    padding: 8px;
    color: #606060;
}

.header__logo img {
    height: 20px; /* Ajuste conforme necessário */
    vertical-align: middle;
}

.header__center {
    flex-grow: 1;
    max-width: 640px; /* Limita a largura da busca */
    margin: 0 40px;
}

.header__search-form {
    display: flex;
    border: 1px solid #ccc;
    border-radius: 40px; /* Borda arredondada como YouTube */
    overflow: hidden;
    height: 40px;
}

.header__search-input {
    flex-grow: 1;
    padding: 0 16px;
    border: none;
    outline: none;
    font-size: 16px;
    height: 100%;
}

.header__search-btn {
    width: 64px;
    background-color: #f8f8f8;
    border-left: 1px solid #ccc;
    font-size: 18px;
    height: 100%;
}

.header__icon-btn {
    font-size: 22px;
    margin-left: 16px;
    padding: 8px;
    color: #606060;
}

.header__login-btn {
    border: 1px solid #065fd4;
    color: #065fd4;
    padding: 8px 15px;
    border-radius: 2px;
    margin-left: 15px;
    font-weight: 500;
    white-space: nowrap; /* Evita quebra de linha */
    font-size: 14px;
}

.header__login-btn:hover {
    background-color: #e6f0ff;
}

.header__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-left: 15px;
    cursor: pointer;
    object-fit: cover; /* Garante que a imagem cubra */
}

.header__logout-btn {
    font-size: 20px;
    margin-left: 10px;
    color: #cc0000;
    padding: 8px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 56px; /* Altura do header */
    left: 0;
    width: 240px;
    height: calc(100vh - 56px);
    background-color: #ffffff;
    padding-top: 12px;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 900;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar__nav {
    margin-bottom: 12px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    color: #0f0f0f;
    font-size: 14px;
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Evita quebra de linha */
    height: 40px;
}

.sidebar__link:hover,
.sidebar__link--active {
    background-color: #f2f2f2;
    font-weight: 500;
}

.sidebar__icon {
    margin-right: 24px;
    font-size: 20px;
    width: 24px; /* Alinhamento */
    text-align: center;
}

.sidebar__separator {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 12px 0;
}

.sidebar__title {
    font-size: 14px;
    font-weight: 500;
    color: #606060;
    padding: 8px 24px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.sidebar__login-prompt {
    padding: 16px 24px;
    font-size: 14px;
    line-height: 1.4;
}

.sidebar__login-prompt p {
    margin-bottom: 12px;
}

.sidebar__login-btn {
    border: 1px solid #065fd4;
    color: #065fd4;
    padding: 8px 15px;
    border-radius: 2px;
    font-weight: 500;
    display: inline-block;
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
}

.sidebar__login-btn:hover {
    background-color: #e6f0ff;
}

.sidebar__nav--secondary .sidebar__link {
    font-size: 13px;
    color: #606060;
    height: 32px;
    padding: 6px 24px;
}

/* Main Content Area */
.main-content {
    margin-left: 240px; /* Largura da sidebar */
    padding: 24px 24px 0;
    transition: margin-left 0.3s ease;
    flex-grow: 1; /* Ocupa o espaço restante */
    width: calc(100% - 240px); /* Garante que não ultrapasse 100% com sidebar */
}

.main-content.sidebar-collapsed {
    margin-left: 0;
    width: 100%;
}

/* Category Filters */
.category-filters {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap; /* Impede quebra de linha */
    overflow-x: auto; /* Permite scroll horizontal se necessário */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.category-filters::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.category-filters__btn {
    padding: 8px 12px;
    margin-right: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    background-color: #f2f2f2;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-filters__btn:hover {
    background-color: #e0e0e0;
}

.category-filters__btn--active {
    background-color: #0f0f0f;
    color: #ffffff;
    border-color: #0f0f0f;
}

/* Video Grid */
.video-grid {
    display: grid;
    /* Grid responsivo com 3 colunas em telas maiores */
    grid-template-columns: repeat(3, 1fr); 
    gap: 16px;
}

.video-grid__item {
    display: flex;
    flex-direction: column;
    margin-bottom: 40px;
}

.video-grid__thumbnail-link {
    position: relative;
    display: block;
    margin-bottom: 12px;
}

.video-grid__thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9; /* Proporção padrão de vídeo */
    object-fit: cover; /* Garante que a imagem cubra a área */
    background-color: #e0e0e0; /* Cor de fundo para placeholders */
    border-radius: 8px; /* Bordas arredondadas */
}

.video-grid__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 3px 4px;
    font-size: 12px;
    border-radius: 2px;
    font-weight: 500;
}

.video-grid__info {
    display: flex;
}

.video-grid__channel-avatar {
    margin-right: 12px;
    flex-shrink: 0; /* Evita que o avatar encolha */
}

.video-grid__channel-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ccc; /* Cor de fundo para placeholders */
    object-fit: cover;
}

.video-grid__meta {
    flex-grow: 1;
    overflow: hidden; /* Evita que texto longo empurre layout */
}

.video-grid__title {
    font-size: 16px;
    font-weight: 500;
    color: #0f0f0f;
    margin-bottom: 4px;
    /* Limitar título a 2 linhas com reticências */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4; /* Ajuste para melhor visualização */
}

.video-grid__channel-name,
.video-grid__stats {
    font-size: 14px;
    color: #606060;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsividade */

/* Telas médias (ex: tablets) */
@media (max-width: 1200px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Telas menores (ex: tablets pequenos) */
@media (max-width: 992px) {
    .header__center {
        margin: 0 20px;
    }
    
    .sidebar {
        transform: translateX(-100%); /* Esconde por padrão */
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0; /* Ocupa toda a largura */
        width: 100%;
        padding: 16px 16px 0;
    }
    
    /* Overlay para fechar a sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 899;
        display: none;
    }
    
    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }
}

/* Telas muito pequenas (ex: celulares) */
@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }
    
    .header__center {
        max-width: 200px;
        margin: 0 12px;
    }
    
    .header__search-btn {
        width: 40px;
    }
    
    .header__right .header__icon-btn {
        margin-left: 12px;
    }
    
    .header__login-btn {
        padding: 6px 12px;
        font-size: 14px;
        margin-left: 12px;
    }
    
    .video-grid {
        grid-template-columns: 1fr; /* Uma coluna */
        gap: 16px;
    }
    
    .main-content {
        padding: 12px 12px 0;
    }
    
    .category-filters__btn {
        font-size: 13px;
        padding: 6px 10px;
        margin-right: 8px;
    }
}

/* Telas muito pequenas (ex: celulares pequenos) */
@media (max-width: 576px) {
    .header__center {
        display: none; /* Esconde busca no header */
    }
    
    .header__right {
        margin-left: auto;
    }
}

/* Estilos adicionais para watch.php, upload.php, etc. */

/* Footer */
.footer {
    background-color: #ffffff;
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    margin-top: auto; /* Empurra para o final da página */
    font-size: 13px;
    color: #606060;
}

.footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer__link {
    color: #606060;
}

.footer__link:hover {
    color: #0f0f0f;
}

.footer__copyright {
    margin-top: 12px;
}
