/* =================================
    TEMA DARK / GLASS (v1.6 - Login Spacing Fix)
    Desktop: Card Branco (Fundo Branco / Texto Escuro)
    Mobile: Card Branco (Fundo Branco / Texto Escuro)
    ================================= */

:root {
    --dark-bg-1: #1a1a2e;
    --dark-bg-2: #16213e;
    --accent-color: #e94560;
    --text-color: #e0e0e0;
    --white-color: #ffffff;
    --placeholder-color: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.2);
    
    /* Variáveis do Bootstrap (necessárias para o modal) */
    --bs-success: #198754;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-success-rgb: 25, 135, 84;
    --bs-warning-rgb: 255, 193, 7;
    --bs-danger-rgb: 220, 53, 69;
    
    /* Cores para os cards (Usado no Desktop e Mobile) */
    --mobile-card-bg: #ffffff;
    --mobile-card-text: #333;
    --mobile-card-label: #555;
    --mobile-card-border: #eee;
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Estilo de Corpo Unificado --- */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #2c3e50);
    background-size: 400% 400%;
    animation: gradientAnimation 15s ease infinite;
    color: var(--text-color);
    min-height: 100vh;
}

/* =================================
    ESTILOS DO LOGIN.PHP
    ================================= */

.login-body-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 15px;
}

.login-container {
    background-color: rgba(22, 33, 62, 0.6);
    padding: 40px 35px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-container:hover {
    transform: translateY(-5px);
}

.logo-image {
    width: 250px;
    height: auto;
    margin-bottom: 20px;
    object-fit: contain;
}

.form-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--white-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ================================== */
/* CORREÇÃO DO ALINHAMENTO DO ÍCONE    */
/* ================================== */
.form-icon {
    position: absolute;
    top: 50%; 
    transform: translateY(-50%); 
    left: 18px;
    color: var(--accent-color);
    font-size: 1.1em;
    pointer-events: none;
    z-index: 3;
}
/* ================================== */

.form-control {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    height: 50px;
    padding-left: 50px; 
    border-radius: 10px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-control:focus {
    background-color: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.25);
    outline: none;
}
.form-control::placeholder {
    color: var(--placeholder-color);
}

.password-toggle-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--placeholder-color);
    transition: color 0.2s ease;
}
.password-toggle-icon:hover {
    color: var(--white-color);
}

.btn-login {
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, var(--accent-color), #a63f7a);
    border: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px; /* Mantido em 10px, pois o g-recaptcha já tem 20px abaixo */
    color: #fff;
    letter-spacing: 1px;
}
.btn-login:hover {
    opacity: 0.9;
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
    transform: translateY(-3px);
    color: #fff;
}

.g-recaptcha {
    display: flex;
    justify-content: center;
    margin-bottom: 20px; /* Este espaçamento é importante */
}

/* =================================
    ESTILOS DO INDEX.PHP
    ================================= */

body.panel-body {
    padding-top: 90px;
}

.glass-card {
    background-color: rgba(22, 33, 62, 0.6);
    padding: 30px 25px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-bottom: 25px;
}

.glass-card h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--white-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(22, 33, 62, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-header h1 {
    font-size: 22px;
    margin: 0;
    font-weight: 600;
    color: var(--white-color);
}
.btn-logout {
    background: var(--accent-color);
    border: none;
    color: var(--white-color);
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 16px;
    text-decoration: none;
    transition: all 0.3s ease;
}
.btn-logout:hover {
    background: var(--white-color);
    color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(233, 69, 96, 0.4);
}

/* ================================== */
/* ESTILOS DE FORMULÁRIO GERAL (CORRIGIDO)
/* ================================== */
.form-group {
    position: relative;
    /* Espaçamento padrão (usado pelo LOGIN.PHP) */
    margin-bottom: 20px; 
}

/* ================================== */
/* CORREÇÃO DO FORMULÁRIO DO INDEX (glass-card) */
/* ================================== */

/* Remove o margin-bottom padrão DENTRO do .glass-card (index.php)
   pois o .hint cuidará do espaçamento */
.glass-card .form-group {
    margin-bottom: 0px;
}

/* Texto de ajuda (hint) com espaçamento correto */
.hint {
    font-size: 13px;
    color: var(--placeholder-color);
    margin-top: 10px; 
    margin-bottom: 25px; 
    line-height: 1.5;
    text-align: left;
    padding-left: 5px; 
}
.form-actions {
    margin-top: 10px;
}
.form-group + .hint {
     margin-bottom: 25px;
}
.subdomain-input-group + .hint {
     margin-bottom: 25px;
}

/* Grupo do Subdomínio */
.subdomain-input-group {
    display: flex;
    position: relative; 
}
.form-control.with-suffix {
    padding-left: 50px !important; 
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
}
.subdomain-suffix {
    height: 50px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-left: 0;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    color: var(--placeholder-color);
}
.form-control.with-suffix:focus + .subdomain-suffix {
    border-color: var(--accent-color);
}
/* ================================== */

.form-select {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    height: 50px;
    padding-left: 50px;
    border-radius: 10px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-select:focus {
    background-color: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.25);
    outline: none;
}
.form-control.m3u-input {
     height: auto;
     padding-left: 15px;
}
.form-control.m3u-output {
     background-color: rgba(0, 0, 0, 0.4);
}

.btn-submit {
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, var(--accent-color), #a63f7a);
    border: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
    color: #fff;
    letter-spacing: 1px;
}
.btn-submit:hover {
    opacity: 0.9;
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
    transform: translateY(-3px);
    color: #fff;
}
.btn-submit:disabled {
    background: #555;
    opacity: 0.7;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* =============================================== */
/* ESTILO DA TABELA (DESKTOP - CORRIGIDO)
/* Agora com fundo branco, igual ao mobile.
/* =============================================== */
.table-dark-glass {
    background-color: var(--mobile-card-bg); /* Fundo Branco */
    color: var(--mobile-card-text); /* Texto Escuro */
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 10px; /* Arredonda a tabela como um card */
    overflow: hidden; /* Garante que o conteúdo siga o radius */
    border: 1px solid var(--mobile-card-border);
}

.table-dark-glass thead th {
    background-color: #f8f9fa; /* Fundo do cabeçalho levemente cinza */
    color: var(--mobile-card-label); /* Texto do Cabeçalho Escuro */
    border: none;
    border-bottom: 2px solid var(--mobile-card-border); 
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
}

.table-dark-glass tbody tr {
    border-bottom: 1px solid var(--mobile-card-border); /* Linha separadora cinza */
}
.table-dark-glass tbody tr:last-child {
    border-bottom: none; 
}

.table-dark-glass tbody td {
    border: none;
    vertical-align: middle;
    word-break: break-all;
    padding: 12px 15px;
    color: var(--mobile-card-text); /* Garante texto escuro */
}

.table-dark-glass tbody tr:hover {
    background-color: #fdfdfd; /* Efeito hover sutil (quase branco) */
}

/* Estilo para tags <code> */
.table-dark-glass code {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    color: #333;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Tabela de Visão Geral (menor) */
.table-dark-glass.table-sm th,
.table-dark-glass.table-sm td {
    padding: 0.5rem; 
}

.table-dark-glass .btn-sm {
    margin-right: 5px;
    font-weight: 600;
}
.btn-edit { background: #0d6efd; color: white; }
.btn-danger { background: var(--accent-color); color: white; }
/* =============================================== */
/* FIM DO ESTILO DESKTOP (CORRIGIDO)
/* =============================================== */


@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert {
    animation: slideDown 0.4s ease-out;
    font-weight: 500;
}
.alert-success {
    background-color: rgba(25, 135, 84, 0.3);
    color: #a3cfbb;
    border: 1px solid rgba(25, 135, 84, 0.7);
}
.alert-danger {
    background-color: rgba(233, 69, 96, 0.2);
    color: #ffc2d1;
    border: 1px solid var(--accent-color);
}
.alert-danger h4 { 
    font-size: 1em;
    margin: 0;
    font-weight: 400;
}
.alert .btn-close {
    filter: invert(1) grayscale(100) brightness(200%);
}

.modal-content {
    background-color: var(--dark-bg-2);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 15px;
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
}
.modal-header .btn-close {
    filter: invert(1) grayscale(100) brightness(200%);
}
.modal-title {
    color: var(--white-color);
    font-weight: 600;
}
.modal-body {
    font-size: 1.1em;
    text-align: left; 
}
.modal-body h5 { 
    color: var(--accent-color);
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
}
.modal-body p, .modal-body li {
    color: var(--text-color);
}
.modal-body hr {
     border-top: 1px solid var(--border-color);
     opacity: 0.5;
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap; 
}

/* =============================================== */
/* INÍCIO (Estilos do Novo Modal de Alerta)        */
/* =============================================== */
.modal-header.bg-success-soft {
    background-color: rgba(var(--bs-success-rgb), 0.15) !important;
}
.modal-header.bg-danger-soft {
    background-color: rgba(var(--bs-danger-rgb), 0.15) !important;
}
.modal-header.bg-warning-soft {
    background-color: rgba(var(--bs-warning-rgb), 0.15) !important;
}

/* Cor do ícone baseada no tipo de alerta */
.modal-header.bg-success-soft .fas {
    color: var(--bs-success);
}
.modal-header.bg-danger-soft .fas {
    color: var(--bs-danger);
}
.modal-header.bg-warning-soft .fas {
    color: var(--bs-warning);
}
/* =============================================== */
/* FIM (Estilos do Novo Modal de Alerta)           */
/* =============================================== */

.limit-info {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--text-color);
}
.form-check-label {
     font-size: 0.9em;
}

/* =============================================== */
/* ESTILOS RESPONSIVOS (MOBILE) - (CORRIGIDO)
/* =============================================== */
@media (max-width: 767px) {
    .login-container { padding: 30px 20px; }
    .form-title { font-size: 24px; }
    
    body.panel-body { padding-top: 75px; }
    .main-header { padding: 15px; }
    .main-header h1 { font-size: 18px; }

    /* ESTILO DE CARDS PARA TABELA NO MOBILE (REFEITO) */
    .table-responsive-cards thead { 
        display: none; /* Esconde o cabeçalho do desktop */
    }
    
    .table-responsive-cards tbody tr {
        /* 1. Cada linha vira um "card" com fundo branco */
        display: block;
        border-radius: 10px;
        margin-bottom: 15px;
        background: var(--mobile-card-bg); /* Fundo Branco */
        border: 1px solid var(--mobile-card-border); /* Borda Cinza Clara */
        box-shadow: 0 4px 10px rgba(0,0,0, 0.05);
        
        /* Reseta estilos do desktop */
        border-bottom: 1px solid var(--mobile-card-border); 
    }
    .table-responsive-cards tbody tr:hover {
        background-color: #f9f9f9;
    }
    
    .table-responsive-cards tbody td {
        /* 2. Layout "Bloco" (Label em cima, Valor embaixo) */
        display: block; 
        padding: 10px 15px;
        text-align: left; /* Alinha o texto do valor à esquerda */
        border-bottom: 1px solid var(--mobile-card-border); /* Borda interna */
        word-break: break-all; /* Quebra URLs longas */
        white-space: normal; /* Permite quebra de linha */
    }
    .table-responsive-cards tbody td:last-child {
        border-bottom: none; 
    }
    
    .table-responsive-cards td::before {
        /* 3. O "Label" (vem do data-label="...") */
        content: attr(data-label); 
        font-weight: 600;
        color: var(--mobile-card-label); /* Cor Cinza Escura (Label) */
        display: block; /* Faz o label ocupar a linha inteira */
        font-size: 0.8em;
        text-transform: uppercase;
        margin-bottom: 4px; /* Espaço entre label e valor */
        
        /* Reseta estilos do desktop */
        white-space: normal;
    }

    /* 4. Cor do "Valor" (o texto principal da célula) */
    .table-responsive-cards tbody td,
    .table-responsive-cards code {
        color: var(--mobile-card-text); /* Cor Preta (Valor) */
        background: none; /* Remove fundo do code */
        border: none; /* Remove borda do code */
        padding-left: 0; 
        padding-right: 0;
        font-size: 1em;
        line-height: 1.4;
    }

    /* 5. Célula de "Ações" vira um bloco no rodapé do card */
    .table-responsive-cards td[data-label="Ações"] {
        display: block;
        padding: 10px; 
        background-color: #fdfdfd;
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
        border-top: 1px solid var(--mobile-card-border);
    }
    .table-responsive-cards td[data-label="Ações"] .btn {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }
    .table-responsive-cards td[data-label="Ações"] .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Corrige a tabela de Visão Geral no Mobile */
    .glass-card .table-dark-glass.table-sm tbody tr {
        background-color: var(--mobile-card-bg);
        border: 1px solid var(--mobile-card-border);
        border-radius: 10px;
        margin-bottom: 10px;
        display: block;
    }
    .glass-card .table-dark-glass.table-sm td {
         color: var(--mobile-card-text);
         border-bottom: none;
    }
}