/* ==========================================
   ESTILOS GLOBAIS E ESTRUTURA
   ========================================== */
.app-layout { 
    display: flex; 
    height: 100vh; 
    width: 100vw; 
}

/* Coluna 1: Menu (Dashboard) - Translúcido para ver o fundo */
.sidebar { 
    width: 220px; 
    background: rgba(19, 19, 26, 0.65) !important; 
    backdrop-filter: blur(4px);
    border-right: 1px solid #1f1f2e; 
    display: flex; 
    flex-direction: column; 
    padding: 20px 10px; 
    box-sizing: border-box; 
}

.logo-area { 
    font-size: 18px; 
    font-weight: bold; 
    color: #a855f7; 
    margin-bottom: 25px; 
    padding-left: 10px; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 4px; 
}

.logo-area span.version { 
    font-size: 11px; 
    color: #666; 
    font-weight: normal; 
    margin-bottom: 6px; 
}

.app-main-logo { 
    width: 100%; 
    max-width: 180px; 
    height: auto; 
    aspect-ratio: 220 / 100; 
    object-fit: contain; 
    border-radius: 6px; 
}

.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 12px 15px; 
    color: #9ca3af; 
    text-decoration: none; 
    border-radius: 8px; 
    font-size: 14px; 
    margin-bottom: 5px; 
    cursor: pointer; 
    transition: 0.2s; 
    border: none; 
    background: transparent; 
    width: 100%; 
    text-align: left; 
    box-sizing: border-box; 
}

.nav-item:hover, .nav-item.active { 
    background: #1f1f2e; 
    color: #fff; 
}

.sidebar-footer { 
    margin-top: auto; 
    padding-top: 15px; 
    border-top: 1px solid #1f1f2e; 
    font-size: 11px; 
    color: #6b7280; 
    text-align: center; 
}

/* Coluna 2: Categorias - Translúcida */
.col-categories { 
    width: 260px; 
    background: rgba(17, 17, 24, 0.60) !important; 
    backdrop-filter: blur(4px);
    border-right: 1px solid #1f1f2e; 
    display: flex; 
    flex-direction: column; 
    padding: 15px; 
    box-sizing: border-box; 
}

.col-header { 
    font-size: 11px; 
    color: #6b7280; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 12px; 
}

.search-box { 
    width: 100%; 
    background: #1a1a24; 
    border: 1px solid #2a2a3c; 
    border-radius: 6px; 
    padding: 8px 12px; 
    color: #fff; 
    font-size: 13px; 
    margin-bottom: 15px; 
    outline: none; 
    box-sizing: border-box; 
}

.search-box:focus { 
    border-color: #a855f7; 
}

.categories-list { 
    flex: 1; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    padding-right: 4px; 
}

.cat-item { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    background: transparent; 
    padding: 8px 10px; 
    border-radius: 6px; 
    color: #9ca3af; 
    text-decoration: none; 
    font-size: 13px; 
    cursor: pointer; 
    transition: 0.2s; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.cat-item:hover, .cat-item.active { 
    background: #1f1f2e; 
    color: #fff; 
}

.cat-item::before { 
    content: "■"; 
    color: #10b981; 
    font-size: 9px; 
}

/* Coluna 3: Lista de Canais / Itens - Translúcida */
.col-items { 
    width: 320px; 
    background: rgba(20, 20, 28, 0.60) !important; 
    backdrop-filter: blur(4px);
    border-right: 1px solid #1f1f2e; 
    display: flex; 
    flex-direction: column; 
    padding: 15px; 
    box-sizing: border-box; 
}

.items-list { 
    flex: 1; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    padding-right: 4px; 
}

.item-card { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    background: #1c1c28; 
    padding: 8px 12px; 
    border-radius: 8px; 
    color: #fff; 
    font-size: 13px; 
    border: 1px solid transparent; 
    cursor: pointer; 
    transition: 0.2s; 
}

.item-card:hover { 
    background: #232333; 
}

.item-card.active { 
    background: #1f1f2e; 
    border-color: #a855f7; 
}

.item-left { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    flex: 1; 
}

.item-logo { 
    width: 28px; 
    height: 28px; 
    object-fit: contain; 
    background: #111118; 
    border-radius: 4px; 
    padding: 2px; 
    flex-shrink: 0; 
}

.item-badge { 
    background: #2d2d42; 
    color: #a855f7; 
    font-size: 10px; 
    padding: 3px 6px; 
    border-radius: 4px; 
    font-weight: bold; 
}

.star-btn { 
    background: none; 
    border: none; 
    color: #9ca3af; 
    cursor: pointer; 
    font-size: 16px; 
    transition: 0.2s; 
    padding: 0 4px; 
}

.star-btn:hover { 
    color: #f59e0b; 
}

.star-btn.favorito { 
    color: #f59e0b; 
}

/* Coluna 4: Player e EPG */
.col-player { 
    flex: 1; 
    background: rgba(11, 11, 14, 0.40) !important; 
    display: flex; 
    flex-direction: column; 
    padding: 25px; 
    overflow-y: auto; 
    align-items: center; 
    justify-content: flex-start; 
    box-sizing: border-box; 
}

.player-wrapper { 
    width: 100%; 
    max-width: 850px; 
    background: #111118; 
    border: 1px solid #1f1f2e; 
    border-radius: 12px; 
    padding: 15px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

.video-box { 
    width: 100%; 
    aspect-ratio: 16/9; 
    background: #000; 
    border-radius: 8px; 
    overflow: hidden; 
    position: relative; 
}

video { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    outline: none; 
}

.player-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: 12px; 
    padding: 0 5px; 
    font-size: 13px; 
    color: #9ca3af; 
}

.player-title-bar { 
    font-size: 15px; 
    font-weight: bold; 
    color: #fff; 
    margin-bottom: 10px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.resolution-badge { 
    background: #1f1f2e; 
    color: #10b981; 
    font-size: 11px; 
    padding: 2px 8px; 
    border-radius: 4px; 
    border: 1px solid #2a2a3c; 
    font-weight: bold; 
}

.nav-btn { 
    background: #1a1a24; 
    border: 1px solid #2a2a3c; 
    color: #fff; 
    padding: 6px 12px; 
    border-radius: 6px; 
    font-size: 12px; 
    cursor: pointer; 
    transition: 0.2s; 
}

.nav-btn:hover { 
    background: #232333; 
    border-color: #a855f7; 
}

/* EPG Card inferior */
.epg-box { 
    width: 100%; 
    max-width: 850px; 
    margin-top: 15px; 
    background: #111118; 
    border: 1px solid #1f1f2e; 
    border-radius: 12px; 
    padding: 15px; 
    box-sizing: border-box; 
}

.epg-box h4 { 
    margin: 0 0 10px 0; 
    font-size: 13px; 
    color: #a855f7; 
    border-bottom: 1px solid #1f1f2e; 
    padding-bottom: 6px; 
}

.epg-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    max-height: 120px; 
    overflow-y: auto; 
    font-size: 12px; 
    color: #9ca3af; 
}

.epg-item { 
    padding: 4px 0; 
    border-bottom: 1px solid #161622; 
    display: flex; 
    gap: 10px; 
}

.epg-time { 
    color: #10b981; 
    font-weight: bold; 
}

.no-selection { 
    text-align: center; 
    color: #666; 
    font-size: 15px; 
    margin-top: 150px; 
}

/* ==========================================
   ESTILOS DA PÁGINA DE LOGIN (index.html)
   ========================================== */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 380px;
    padding: 20px;
    box-sizing: border-box;
}

.login-logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    text-align: center;
    gap: 2px;
}

.login-logo-img {
    width: 100%;
    max-width: 280px;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 6px;
}

.login-app-title {
    font-size: 22px;
    font-weight: bold;
    color: #a855f7;
    margin-top: 4px;
}

.login-version {
    font-size: 11px;
    color: #666;
}

.login-card {
    width: 100%;
    background: rgba(19, 19, 26, 0.95);
    border: 1px solid #1f1f2e;
    border-radius: 12px;
    padding: 25px;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.login-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
    text-align: center;
}

.login-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: #1a1a24;
    border: 1px solid #2a2a3c;
    border-radius: 6px;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: 0.2s;
}

.form-input:focus {
    border-color: #a855f7;
}

.login-btn {
    width: 100%;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 10px;
}

.login-btn:hover {
    background: #1d4ed8;
}

.login-footer {
    margin-top: 20px;
    font-size: 11px;
    color: #6b7280;
    text-align: center;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 15px;
    text-align: center;
}

/* Scrollbars personalizados */
::-webkit-scrollbar { 
    width: 5px; 
}

::-webkit-scrollbar-track { 
    background: transparent; 
}

::-webkit-scrollbar-thumb { 
    background: #2a2a3c; 
    border-radius: 10px; 
}

/* ==========================================
   FUNDO GLOBAL COMPLETO (SEM FILTRO BRANCO)
   ========================================== */
body, body.login-page { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important; 
    margin: 0 !important; 
    background-color: #111118 !important; 
    background-image: url('../img/fundo.png') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    color: #fff !important; 
    overflow: hidden !important; 
    height: 100vh !important; 
}

body.login-page {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* ==========================================
   ADAPTAÇÃO PARA TELEMÓVEIS E TABLETS (Responsive)
   ========================================== */
@media (max-width: 1024px) {
    /* Permitir scroll vertical e desativar o bloqueio de ecrã do PC */
    body {
        overflow: auto !important;
        height: auto !important;
        min-height: 100vh !important;
    }

    /* Transformar o layout de colunas numa lista vertical fluida */
    .app-layout {
        flex-direction: column !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
    }

    /* Ajustar a barra lateral (Menu) para o topo em formato compacto */
    .sidebar {
        width: 100% !important;
        height: auto !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 8px;
        padding: 10px !important;
    }

    .logo-area {
        margin-bottom: 0 !important;
        margin-right: auto;
        font-size: 15px;
    }

    .app-main-logo {
        max-width: 120px !important;
    }

    .sidebar .nav-item {
        width: auto !important;
        margin-bottom: 0 !important;
        padding: 8px 10px !important;
        font-size: 12px;
    }

    /* As colunas de categorias, canais e player deixam de ter larguras fixas */
    .col-categories, .col-items {
        width: 100% !important;
        height: 250px !important; /* Altura controlada com scroll próprio */
        border-right: none !important;
        border-bottom: 1px solid #1f1f2e;
    }

    .col-player {
        width: 100% !important;
        height: auto !important;
        min-height: 400px;
        padding: 15px !important;
    }

    .player-wrapper, .epg-box {
        max-width: 100% !important;
    }
}

/* Otimização extra para ecrãs muito pequenos (telemóveis na vertical) */
@media (max-width: 768px) {
    .sidebar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .sidebar .nav-item {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }

    .logo-area {
        align-items: center !important;
        margin-bottom: 10px !important;
    }
}