:root {
    --bg-dark: #0A0A0A;
    --bg-light: #141417;
    --primary: #FFC700;
    --secondary: #2C2C2F; 
    --text-light: #F5F5F5;
    --text-dark: #A1A1A1;
    --border-color: #2C2C2F;
    --danger: #e74c3c;
    --success: #2ecc71;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-sizing: border-box;
}
.sidebar-header { margin-bottom: 40px; }
.sidebar-header .logo { 
    font-size: 1.5rem; 
    text-decoration: none; 
    color: var(--text-light); 
    font-weight: 800; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: all 0.2s ease;
}
.sidebar-header .logo i { 
    color: var(--text-light); 
    font-size: 14px;
}
.sidebar-header .logo:hover i { 
    color: var(--primary); 
    transform: scale(1.1);
}
.logo-text { 
    transition: opacity 0.2s ease;
}

/* Estilos para o header */
.sidebar-header {
    display: flex;
    align-items: center;
}

/* Estilos para ícones dentro de botões */
.btn i {
    font-size: 14px;
    margin-right: 6px;
}
.sidebar-nav { flex-grow: 1; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}
.nav-link:hover { background-color: var(--border-color); color: var(--text-light); }
.nav-link.active { background-color: var(--primary); color: var(--bg-dark); }
.nav-link i { width: 16px; text-align: center; font-size: 14px; }

.nav-link2 {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}
.nav-link2:hover { background-color: var(--border-color); color: var(--text-light); }
.nav-link2.active { background-color: var(--primary); color: var(--bg-dark); }
.nav-link2 i { width: 20px; text-align: center; }

.sidebar-footer { border-top: 1px solid var(--border-color); padding-top: 16px; }

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}
.content-pane { display: none; }
.content-pane.active { display: block; }
h2 { font-size: 2rem; border-bottom: 2px solid var(--primary); padding-bottom: 10px; margin-bottom: 30px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.stat-card {
    background-color: var(--bg-light);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.stat-card h4 { margin: 0 0 10px; color: var(--text-dark); }
.stat-card p { font-size: 2.5rem; font-weight: 800; margin: 0; color: var(--primary); }

/* Tables */
.table-container { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
thead tr { background-color: #1E1E1E; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable .sort-indicator { color: var(--text-dark); font-size: 0.8rem; margin-left: 4px; }
tbody tr:hover { background-color: #252525; }
.status-claimed { color: var(--success); font-weight: bold; }
.status-available { color: var(--text-dark); }

/* Destaque por proximidade de vencimento */
.row-green {
    background-color: rgba(46, 204, 113, 0.10);
}
.row-yellow {
    background-color: rgba(241, 196, 15, 0.12);
}
.row-red {
    background-color: rgba(231, 76, 60, 0.12);
}

/* Estilos para checkboxes */
th input[type="checkbox"], td input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Estilos para coluna de links */
.link-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.code-link {
    color: #3498db;
    text-decoration: none;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.code-link:hover {
    text-decoration: underline;
}

.copy-link-btn {
    background-color: var(--secondary);
    color: var(--text-light);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-link-btn:hover {
    background-color: var(--primary);
    color: var(--bg-dark);
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.8rem;
    height: 32px;
}

/* Buttons & Actions */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: filter 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px; /* Altura fixa para alinhar com o input */
    box-sizing: border-box;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background-color: var(--primary); color: var(--bg-dark); }
.btn-secondary { background-color: var(--secondary); color: var(--text-light); }
.btn-danger { background-color: var(--danger); color: var(--text-light); }

.codes-actions {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.code-generation-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.batch-generation {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.manual-generation {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.selected-count {
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 10px;
}

.manual-code-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#custom-code-input, #filter-input {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 10px 15px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    height: 40px; /* Mesma altura dos botões */
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#custom-code-input::placeholder, #filter-input::placeholder {
    color: var(--text-dark);
}

#custom-code-input:focus, #filter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none; /* Começa escondido */
    justify-content: center;
    align-items: center;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}
.modal-header h4 {
    margin: 0;
    font-size: 1.2rem;
}
.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-dark);
    cursor: pointer;
}
.modal-body .input-group {
    margin-bottom: 16px;
}
.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
.modal-body select {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    border-radius: 6px;
    font-size: 1rem;
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-input-text {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box; 
}


/* --- Estilos para Badges na Tabela --- */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.badge-admin { background-color: var(--primary); color: var(--bg-dark); }
.badge-individual { background-color: #3498db; color: white; }
.badge-business { background-color: #9b59b6; color: white; }
.badge-team { background-color: #e67e22; color: white; }
.badge-free { background-color: var(--secondary); color: var(--text-light); }

/* =============================================== */
/* === ESTILOS RESPONSIVOS PARA O PAINEL ADMIN === */
/* =============================================== */

@media (max-width: 992px) {
    /* Layout Geral */
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 12px 24px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        background-color: var(--bg-light);
        z-index: 100;
    }
    
    .sidebar-header {
        margin-bottom: 0;
    }

    .sidebar-nav {
        flex-grow: 0;
        display: flex;
        flex-direction: row;
        gap: 8px;
    }
    
    /* Esconde o texto dos links, mostrando apenas os ícones */
    .nav-link span, .nav-link2 span {
        display: none;
    }

    .nav-link, .nav-link2 {
        padding: 10px 12px;
        margin-bottom: 0;
    }
    
    .sidebar-footer {
        padding-top: 0;
        border-top: none;
        display: flex;
        gap: 8px;
    }

    .sidebar-header h3 span {
        display: none;
    }

    .main-content {
        /* Adiciona um espaçamento no topo para não ficar atrás do header fixo */
        padding: 100px 24px 40px 24px;
    }
    
    h2 {
        font-size: 1.5rem;
    }

    /* Ações e Formulários */
    .codes-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .code-generation-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .batch-generation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .manual-generation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .manual-code-form {
        flex-direction: column;
        align-items: stretch;
    }

    #custom-code-input, #filter-input, .manual-code-form button {
        width: 100%;
        box-sizing: border-box;
    }

    .batch-generation input, .batch-generation button {
        width: 100%;
        box-sizing: border-box;
    }

    .filter-actions button {
        width: 100%;
        box-sizing: border-box;
    }

    /* Transformação da Tabela para "Cards" */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 16px;
        padding: 12px;
    }

    td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: right; 
        min-height: 24px; 
        display: flex; 
        align-items: center;
        justify-content: flex-end;
        word-break: break-all;
    }
    
    td:last-child {
        border-bottom: none;
    }

    /* ======================================================= */
/* === CSS RESPONSIVO DEFINITIVO PARA O PAINEL DE ADMIN === */
/* ======================================================= */

@media (max-width: 768px) {
    /* Transforma o layout principal para uma única coluna */
    .admin-layout {
        flex-direction: column;
    }

    /* Converte a sidebar em um header fixo e compacto */
    .sidebar {
        width: 100%;
        height: 65px; /* Altura fixa do header */
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 16px;
        position: fixed;
        top: 0;
        left: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        z-index: 100;
    }

    .sidebar-header {
        margin-bottom: 0;
    }
    .sidebar-header .logo { font-size: 1.2rem; }
    .sidebar-header .logo .logo-text { display: none; }
    .sidebar-header .logo i { font-size: 14px; }

    /* Agrupa os links de navegação e do rodapé lado a lado */
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
        flex-grow: 0;
    }
    .sidebar-footer {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
        padding-top: 0;
        border-top: none;
    }

    .nav-link span, .nav-link2 span {
        display: none;
    }

    /* Ajusta o padding dos ícones para ficarem bem acomodados */
    .nav-link, .nav-link2 {
        padding: 10px 12px;
        margin-bottom: 0;
    }

    /* Adiciona espaço no topo do conteúdo principal para não ficar atrás do header */
    .main-content {
        padding-top: 100px;
    }

    /* Ajustes específicos para controles de geração de códigos no mobile */
    .codes-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 0 10px;
    }

    .code-generation-section {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        width: 100%;
    }

    .batch-generation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .batch-generation span {
        text-align: center;
        font-size: 0.9rem;
        color: var(--text-dark);
    }

    .manual-generation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .filter-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .batch-generation input, .batch-generation button {
        width: 100%;
        box-sizing: border-box;
        margin: 5px 0;
    }

    .manual-generation input, .manual-generation button {
        width: 100%;
        box-sizing: border-box;
        margin: 5px 0;
    }

    .filter-actions input, .filter-actions button {
        width: 100%;
        box-sizing: border-box;
        margin: 5px 0;
    }

    .selected-count {
        text-align: center;
        margin: 10px 0;
        font-size: 0.9rem;
    }

    /* Ajustes para botões pequenos no mobile */
    .btn-small {
        padding: 8px 12px;
        font-size: 0.9rem;
        height: auto;
    }

    /* Ajustes para inputs no mobile */
    #custom-code-input, #filter-input, #prefix-input, #batch-count {
        font-size: 16px; /* Evita zoom no iOS */
        padding: 12px;
        height: auto;
    }

    /* Ajustes para a tabela de códigos no mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ajustes para checkboxes no mobile */
    th input[type="checkbox"], td input[type="checkbox"] {
        width: 20px;
        height: 20px;
        cursor: pointer;
    }

    /* Ajustes para botões de ação no mobile */
    .copy-link-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-height: 36px;
    }

    /* Ajustes para o painel de usuários no mobile */
    .users-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .users-actions input, .users-actions button {
        width: 100%;
        box-sizing: border-box;
    }

    /* Ajustes para estatísticas no mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    /* Ajustes para o painel de usuários no mobile */
    .users-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .users-actions input, .users-actions button {
        width: 100%;
        box-sizing: border-box;
    }

    /* Ajustes para estatísticas no mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }
    
    /* Regras para transformar a tabela em cards (já existentes, mas garantidas aqui) */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 16px;
        padding: 12px;
    }
    td {
        border: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
        text-align: right;
        min-height: 24px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
    td:last-child {
        border-bottom: none;
    }
    td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-dark);
    }
}

    td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-dark);
    }
}

/* Exemplo de estilos em dashboard.css (se você já os tem, não precisa copiar) */
.photo-upload-area {
    width: 150px; /* Ou o tamanho que preferir para o logo */
    height: 150px;
    border-radius: 8px; /* Cantos levemente arredondados para logos */
    background-color: var(--card-background-color);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    margin: 0 auto 10px auto; /* Centraliza */
}

.photo-upload-area img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ajusta a imagem dentro da área, mantendo proporção */
    display: block;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 10px;
}

.photo-upload-area:hover .upload-overlay {
    opacity: 1;
}

.upload-overlay i {
    font-size: 2em;
    margin-bottom: 5px;
}

.upload-overlay span {
    font-size: 0.8em;
}

.upload-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--highlight-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none; /* Escondido por padrão */
}

.photo-upload-area.is-uploading .upload-loader {
    display: block; /* Mostra quando o upload está ativo */
}

.photo-upload-area.is-uploading .upload-overlay {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.8);
}

.photo-upload-area.is-uploading img {
    opacity: 0.3; /* Escurece a imagem durante o upload */
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}