/* admin.css */

/* Layout 2 Colunas para Formulários do Admin */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    width: 100%;
}

/* Layout de Duas Colunas do Dashboard com Prevenção de Transbordamento */
.admin-container {
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);
    gap: 24px;
    align-items: flex-start;
    padding-top: 30px;
    padding-bottom: 80px;
    width: 100%;
    max-width: 98%;
    box-sizing: border-box;
}

@media (max-width: 1080px) {
    .admin-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Sidebar */
.admin-sidebar {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--gold-light);
}

.sidebar-header p {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.side-btn:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.02);
}

.side-btn.active {
    background: rgba(197, 168, 92, 0.05);
    border-color: var(--border-gold);
    color: var(--gold-light);
}

/* Controle de Exibição das Seções sem Transbordamento */
.admin-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.admin-section.active {
    display: block;
}

.section-card {
    padding: 32px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

@media (max-width: 600px) {
    .section-card {
        padding: 20px 16px;
    }
}

.card-header {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 20px;
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.card-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Dica/Instruções de Inputs */
.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
}

/* Indicador de Status */
.status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-gray);
    padding: 14px 16px;
    border-radius: 8px;
    margin: 24px 0;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-box.connected .status-dot {
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.status-box.error .status-dot {
    background-color: var(--danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.status-box.loading .status-dot {
    background-color: var(--secondary);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* SQL Box */
.sql-instructions {
    background: #0d0d0f;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
}

.sql-instructions h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-light);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.sql-instructions p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.sql-instructions pre {
    overflow-x: auto;
}

.sql-instructions code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #e2e8f0;
    display: block;
}

/* Checklist de Domínio */
.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checklist-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-gray);
    padding: 20px;
    border-radius: 12px;
    transition: var(--transition);
}

.checklist-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.check-label {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    cursor: pointer;
    user-select: none;
}

.check-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.check-label .checkmark {
    min-width: 22px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    position: relative;
    transition: var(--transition);
    margin-top: 3px;
}

.check-label:hover input ~ .checkmark {
    border-color: var(--gold-primary);
}

.check-label input:checked ~ .checkmark {
    background-color: var(--gold-primary);
    border-color: var(--gold-primary);
}

.check-label .checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.check-label input:checked ~ .checkmark:after {
    display: block;
}

.check-label .checkmark:after {
    left: 8px;
    top: 4px;
    width: 4px;
    height: 9px;
    border: solid black;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.check-label strong {
    font-size: 15px;
    color: var(--text-white);
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-heading);
}

.check-label input:checked ~ div strong {
    text-decoration: line-through;
    color: var(--text-muted);
}

.check-label p {
    font-size: 13px;
    color: var(--text-muted);
}

.dns-specs {
    background: #0d0d0f;
    border: 1px solid var(--border-gray);
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 12px;
}

.dns-specs code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--gold-light);
}

/* Banco de Imagens */
.assets-guide h4 {
    font-family: var(--font-heading);
    font-size: 16px;
    color: var(--gold-light);
    margin-bottom: 12px;
}

.assets-guide ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.assets-guide li {
    font-size: 14px;
    color: var(--text-muted);
}

.assets-guide li strong {
    color: var(--text-white);
}

.assets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 12px;
}

.assets-table th {
    text-align: left;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-gray);
}

.assets-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-muted);
}

.assets-table code {
    color: var(--gold-light);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Leads Recebidos */
.admin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.stats-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-gray);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.stats-badge span {
    color: var(--gold-light);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-gray);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.01);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

.leads-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-white);
    border-bottom: 1px solid var(--border-gray);
}

.leads-table td {
    padding: 14px 16px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.leads-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-white);
}

.wa-link {
    color: #10b981;
    text-decoration: underline;
    font-weight: 600;
}

.wa-link:hover {
    color: #34d399;
}

/* Overlay de Bloqueio do Painel Master */
.master-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(7, 7, 10, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.master-auth-card {
    max-width: 420px;
    width: 100%;
    padding: 36px 28px;
    border-radius: 16px;
    border: 1px solid var(--border-gold);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(197, 168, 92, 0.15);
    text-align: center;
    background: #0d0d12;
}

.master-lock-icon {
    font-size: 44px;
    margin-bottom: 12px;
}

.master-auth-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.master-auth-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* =============================================================
   Ajustes Personalizados de Fontes (v3.60)
   ============================================================= */

/* 1. Tabelas de Extratos e Listagens com scroll e dimensionamento correto */
.leads-table {
    font-size: 11.5px !important;
    width: 100%;
}
.leads-table th {
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 10px 12px !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.leads-table td {
    font-size: 11.5px !important;
    padding: 10px 12px !important;
    vertical-align: middle;
}

/* Tabela de Relatório e Conciliação de Prêmios (Compacta com Expansão e Checkbox) */
#adminPremiosTable {
    min-width: 800px;
    width: 100%;
}

#adminPremiosTable th,
#adminPremiosTable td {
    font-size: 11.5px !important;
    padding: 10px 12px !important;
    vertical-align: middle !important;
    word-break: normal !important;
}

#adminPremiosTable th:nth-child(1), #adminPremiosTable td:nth-child(1) { /* + */
    width: 45px;
    text-align: center;
}

#adminPremiosTable th:nth-child(2), #adminPremiosTable td:nth-child(2) { /* Vendedor */
    min-width: 180px;
    text-align: left;
    padding-left: 15px !important;
    line-height: 1.35;
}

#adminPremiosTable th:nth-child(3), #adminPremiosTable td:nth-child(3) { /* O.S. com Checkbox */
    min-width: 130px;
    text-align: center;
    white-space: nowrap !important;
}

#adminPremiosTable th:nth-child(4), #adminPremiosTable td:nth-child(4) { /* Pontuação Total */
    min-width: 120px;
    text-align: center;
    white-space: nowrap !important;
}

#adminPremiosTable th:nth-child(5), #adminPremiosTable td:nth-child(5) { /* Status */
    min-width: 100px;
    text-align: center;
    white-space: nowrap !important;
}

#adminPremiosTable th:nth-child(6), #adminPremiosTable td:nth-child(6) { /* Ações */
    min-width: 170px;
    text-align: center;
    white-space: nowrap !important;
}

/* Tabela de Vendas e O.S. Liberadas pelo Laboratório */
#adminAuthOsTable {
    width: 100%;
}

#adminAuthOsTable th,
#adminAuthOsTable td {
    font-size: 11.5px !important;
    padding: 8px 10px !important;
    vertical-align: middle !important;
}

#adminAuthOsTable th:nth-child(1), #adminAuthOsTable td:nth-child(1) { /* + */
    width: 35px;
    text-align: center;
    padding: 6px 4px !important;
}

#adminAuthOsTable th:nth-child(2), #adminAuthOsTable td:nth-child(2) { /* O.S. com Checkbox */
    width: 125px;
    text-align: center;
    white-space: nowrap !important;
}

#adminAuthOsTable th:nth-child(3), #adminAuthOsTable td:nth-child(3) { /* Vendedor */
    text-align: left;
    white-space: normal !important;
    line-height: 1.3;
}

#adminAuthOsTable th:nth-child(4), #adminAuthOsTable td:nth-child(4) { /* Ptos */
    width: 65px;
    text-align: center;
    white-space: nowrap !important;
}

#adminAuthOsTable th:nth-child(5), #adminAuthOsTable td:nth-child(5) { /* Lentes + AR */
    text-align: left;
    white-space: normal !important;
    line-height: 1.3;
}

#adminAuthOsTable th:nth-child(6), #adminAuthOsTable td:nth-child(6) { /* Status */
    width: 85px;
    text-align: center;
    white-space: nowrap !important;
}

#adminAuthOsTable th:nth-child(7), #adminAuthOsTable td:nth-child(7) { /* Ações */
    width: 75px;
    text-align: center;
    white-space: nowrap !important;
    padding: 6px 4px !important;
}

/* Tabelas de Apuração e Histórico Consolidado */
#adminConsolidadoTable,
#adminConsolidadoPagosTable {
    min-width: 850px;
    width: 100%;
}

#adminConsolidadoTable th, #adminConsolidadoTable td,
#adminConsolidadoPagosTable th, #adminConsolidadoPagosTable td {
    font-size: 11.5px !important;
    padding: 10px 12px !important;
    vertical-align: middle !important;
}

/* 2. Painel Master (Admin Geral) */
.admin-sidebar, 
.admin-content-area,
.section-card p,
.input-group label,
.status-box {
    font-size: 12px !important;
}
.card-header h2,
.section-card h2 {
    font-size: 14px !important;
}
.section-card h3,
.sidebar-header h3 {
    font-size: 12px !important;
}
.input-hint {
    font-size: 10px !important;
}

/* Redução do Menu Principal Esquerdo para 10px */
.side-btn {
    font-size: 10px !important;
}

/* 3. Controles (Formulários e Botões) */
.input-group input,
.input-group select,
.input-group textarea,
select,
input,
textarea {
    font-size: 10px !important;
}

/* Botões de Ação das Tabelas */
.btn-xs,
.btn-edit-reward-config,
.btn-delete-reward-config,
.btn-delete-auth-os,
.leads-table button {
    font-size: 10px !important;
}

/* Botões de Ação Principais do Formulário */
#authOsForm button[type="submit"],
#addRewardProductForm button[type="submit"],
.btn-gold,
.btn-submit-main {
    font-size: 12px !important;
    font-weight: 700 !important;
}

/* Password Toggle CSS (v3.60) */
.password-wrapper {
    position: relative;
    width: 100%;
}
.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.45) !important;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}
.password-toggle-btn:hover {
    color: var(--gold-light) !important;
}

/* Dashboard Performance KPIs & Rankings Responsive Grids (v3.93) */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin: 20px 0 25px 0;
}

@media (max-width: 1200px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dash-rankings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

@media (max-width: 900px) {
    .dash-rankings-grid {
        grid-template-columns: 1fr;
    }
}

