/* Portal de Afiliados — Frontend CSS */

.pa-portal {
    font-family: 'Syne', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px 16px;
    color: #1a1a2e;
}

.pa-portal-header {
    margin-bottom: 20px;
}

.pa-portal-welcome {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

/* ── MÉTRICAS ── */
.pa-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.pa-metric {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.pa-metric::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.pa-metric.blue::before   { background: #3b82f6; }
.pa-metric.green::before  { background: #10b981; }
.pa-metric.amber::before  { background: #f59e0b; }
.pa-metric.purple::before { background: #7c3aed; }
.pa-metric.red::before    { background: #ef4444; }

.pa-metric-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.pa-metric-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.pa-metric.blue .pa-metric-value   { color: #3b82f6; }
.pa-metric.green .pa-metric-value  { color: #10b981; }
.pa-metric.amber .pa-metric-value  { color: #f59e0b; }
.pa-metric.purple .pa-metric-value { color: #7c3aed; }
.pa-metric.red .pa-metric-value    { color: #ef4444; }

.pa-metric-sub {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* ── CONTAINER STATS ── */
.pa-stats-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.pa-stats-filters {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.pa-stats-filters h2 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
    color: #111827;
}

.pa-filters-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
}

.pa-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pa-filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
}

.pa-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pa-filter-input {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #374151;
    outline: none;
    min-width: 130px;
    transition: border-color .2s;
}

.pa-filter-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.pa-arrow { color: #9ca3af; font-size: 13px; }

.pa-date-shortcuts {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.pa-shortcut {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    transition: all .2s;
}

.pa-shortcut:hover,
.pa-shortcut.active {
    background: rgba(59,130,246,.08);
    border-color: #3b82f6;
    color: #2563eb;
}

.pa-apply-btn {
    padding: 9px 22px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}

.pa-apply-btn:hover { background: #1d4ed8; }

/* ── TABELA ── */
.pa-table-wrap {
    overflow-x: auto;
}

.pa-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pa-stats-table .col-group {
    text-align: center;
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
}

.pa-stats-table .col-group.trafego      { color: #3b82f6; background: rgba(59,130,246,.04); }
.pa-stats-table .col-group.inscricoes   { color: #10b981; background: rgba(16,185,129,.04); }
.pa-stats-table .col-group.ftd          { color: #f59e0b; background: rgba(245,158,11,.04); }
.pa-stats-table .col-group.traders      { color: #7c3aed; background: rgba(124,58,237,.04); }
.pa-stats-table .col-group.negociacoes  { color: #ef4444; background: rgba(239,68,68,.04); }

.pa-stats-table th {
    text-align: right;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.pa-stats-table th.col-dia { text-align: left; }

.pa-stats-table td {
    text-align: right;
    padding: 11px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pa-stats-table td.col-dia {
    text-align: left;
    font-weight: 600;
    color: #374151;
}

.pa-stats-table tbody tr:hover td { background: #fafafa; }
.pa-stats-table tbody tr:last-child td { border-bottom: none; }

.pa-stats-table .row-total td {
    background: #f0fdf4 !important;
    font-weight: 700;
    border-top: 2px solid #d1fae5;
    border-bottom: 2px solid #d1fae5;
}

.pa-stats-table .row-total td.col-dia { color: #059669; }

.pa-stats-table .grp-border { border-right: 1px solid #f3f4f6; }

/* Cores dos valores */
.val-blue   { color: #3b82f6; }
.val-green  { color: #10b981; }
.val-amber  { color: #d97706; }
.val-purple { color: #7c3aed; }
.val-red    { color: #ef4444; }
.val-muted  { color: #9ca3af; }

/* ── LOADING / EMPTY ── */
.pa-loading,
.pa-empty {
    text-align: center;
    padding: 48px 24px;
    color: #9ca3af;
    font-size: 14px;
}

.pa-portal-login,
.pa-portal-noaccess {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: #374151;
}

@media (max-width: 640px) {
    .pa-stats-filters { padding: 16px; }
    .pa-filters-row { flex-direction: column; }
    .pa-metrics { grid-template-columns: repeat(2, 1fr); }
}
