/* style.css */
body {
    font-family: sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    margin: 0;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 200px;
    background-color: #1e1e1e;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    margin-bottom: 15px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background-color: #333;
    color: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.back-button:hover {
    background-color: #444;
}

.back-button svg {
    flex-shrink: 0;
}

#group-list {
    flex-grow: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 10px;
}

#logout-btn {
    width: 100%;
    padding: 10px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

#logout-btn:hover {
    background-color: #d32f2f;
}

#main-content {
    flex-grow: 1;
    display: flex;
}

#channel-list-container {
    width: 250px;
    padding: 10px;
    overflow-y: auto;
    border-left: 1px solid #333;
    border-right: 1px solid #333;
}

#video-container {
    flex-grow: 1;
    background-color: black;
    display: flex;
    justify-content: center;
    align-items: center;
}

video {
    width: 100%;
    height: 100%;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

li:hover, li.active {
    background-color: #333;
}

img.channel-logo {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    vertical-align: middle;
}

/* --- Estilos da Página de Login --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #121212;
}

.login-box {
    background-color: #1e1e1e;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    width: 320px;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 24px;
    color: #e0e0e0;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #bbb;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    border: 1px solid #333;
    background-color: #2c2c2c;
    color: #e0e0e0;
    border-radius: 4px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.login-box button:hover {
    background-color: #0056b3;
}

.error-message {
    color: #f44336;
    margin-top: 15px;
    min-height: 20px;
    font-size: 14px;
}

/* --- Estilos do Dashboard --- */
.dashboard-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #121212;
}

.dashboard-container {
    padding: 30px;
    background-color: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 180px);
    grid-template-rows: repeat(2, 180px);
    gap: 25px;
}

.dashboard-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #2c2c2c;
    border-radius: 15px;
    text-decoration: none;
    color: #e0e0e0;
    font-size: 1.2em;
    font-weight: bold;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    border: none;
    padding: 10px;
}

.dashboard-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
}

.dashboard-item .icon {
    margin-bottom: 10px;
}

.dashboard-item svg {
    width: 48px;
    height: 48px;
    color: #e0e0e0;
}

/* --- Estilos da Mensagem de Erro do Player --- */
#video-container {
    position: relative;
}

#player-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 10;
}

.hidden {
    display: none !important;
}
/* --- Estilos da Tela de Loading --- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 18, 18, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
}

.loader-spinner {
    border: 6px solid #f3f3f3; /* Cinza claro */
    border-top: 6px solid #007bff; /* Azul */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: #e0e0e0;
    margin-top: 20px;
    font-size: 1.2em;
}

/* Animação de rotação */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Estilos do Loader de Vídeo --- */
#video-container .loader-overlay {
    /* Garante que o loader fique DENTRO do container do vídeo */
    position: absolute;
    border-radius: 0; /* Remove borda arredondada se houver */
}

/* Adiciona a classe 'hidden' que já usamos antes, mas garantimos que ela esteja aqui */
.hidden {
    display: none !important;
}


/* --- Estilos do Campo de Busca --- */
.search-input {
    width: 100%;
    padding: 10px 10px 10px 35px; /* Espaçamento interno (com espaço para o ícone) */
    margin-bottom: 10px;
    box-sizing: border-box;
    border: 1px solid #333;
    border-radius: 20px; /* Bordas bem arredondadas */
    background-color: #2c2c2c;
    color: #e0e0e0;
    font-size: 14px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 10px center; /* Posição do ícone */
}

.search-input:focus {
    outline: none;
    border-color: #007bff; /* Borda azul ao focar */
}

/* --- NOVO: Estilos do Popup de Erro Customizado --- */
#custom-error-popup {
    position: fixed; /* Fixa na tela */
    z-index: 1000;   /* Fica por cima de tudo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6); /* Fundo semi-transparente */
    display: flex; /* Para centralizar o conteúdo */
    justify-content: center; /* Centraliza horizontalmente */
    align-items: center; /* Centraliza verticalmente */
    transition: opacity 0.3s ease; /* Transição suave */
}

#custom-error-popup.hidden {
    opacity: 0;
    pointer-events: none; /* Permite clicar através quando invisível */
}

.popup-content {
    background-color: #2c2c2c;
    margin: auto;
    padding: 30px;
    border: 1px solid #ff4d4d; /* Borda vermelha para erro */
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    text-align: center;
    color: #e0e0e0;
}

#popup-error-message {
    font-size: 16px;
    margin-bottom: 15px;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: #e0e0e0;
    text-decoration: none;
    cursor: pointer;
}

/* Cores específicas para os itens */
.dashboard-item.live-tv { background-color: #1e3a8a; }
.dashboard-item.movies { background-color: #a0522d; }
.dashboard-item.series { background-color: #3f681a; }
.dashboard-item.logout { background-color: #b91c1c; }

.dashboard-item.live-tv:hover { background-color: #1a306f; }
.dashboard-item.movies:hover { background-color: #854526; }
.dashboard-item.series:hover { background-color: #345716; }
.dashboard-item.logout:hover { background-color: #9f1818; }
