/*
 * Base CSS — Polit-E admin
 *
 * Reset enxuto + tipografia padrão (sans). Estilos de componentes ficam
 * em /assets/css/components/. Seções narrativas (H1 serif) aplicam a
 * classe utilitária .h-page-title em vez de redefinir h1 globalmente.
 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.005em;
    min-height: 100vh;
}

/* ============ HEADINGS (default sans) ============
 * Para narrativa editorial em serif, aplique uma das classes utilitárias
 * abaixo. Não redefinir h1/h2 globalmente porque o mesmo elemento aparece
 * tanto em narrativa (serif) quanto em painéis (sans 14px/600).
 */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    color: var(--gray-900);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
h4 { font-size: 13px; }

/* Utilities tipográficas — aplicar onde a hierarquia editorial pede serif. */
.h-display {
    font-family: var(--font-serif);
    font-size: 36px;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--gray-900);
}

.h-page-title {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--gray-900);
}

.h-section {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--gray-900);
}

.h-panel {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--gray-900);
}

.t-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.5;
}

.t-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.t-caption {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
}

.t-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.t-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

/* ============ CHART PANEL (line chart inline em SVG) ============
 * Usado em /links/{id} para a série de cliques diários. Reaproveitável.
 * O <svg> tem preserveAspectRatio="none" — distorção horizontal é aceitável
 * porque a leitura é por silhueta da curva.
 */
.chart-panel { padding: 0; overflow: hidden; }

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px 12px;
    flex-wrap: wrap;
}

.chart-title {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 0;
}

.chart-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin: 2px 0 0;
    line-height: 1.4;
}

.chart-summary {
    display: flex;
    gap: 24px;
    align-items: stretch;
}

.chart-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 60px;
}

.chart-summary-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chart-summary-value {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 600;
    color: var(--brand-700);
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.chart-summary-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-500);
    letter-spacing: 0;
}

.chart-body {
    padding: 0 12px 12px;
    background: linear-gradient(to bottom, transparent 0%, var(--gray-50) 100%);
}

.chart-svg {
    width: 100%;
    height: 320px;
    display: block;
    max-height: 40vh;
}

/* Em telas muito largas, limita a esticada horizontal mantendo a curva
 * legível (aspect ratio do chart vai pra ~3:1 em vez de 6:1).
 */
@media (min-width: 1100px) {
    .chart-svg { height: 360px; }
}

.chart-empty {
    padding: 48px 24px 56px;
    text-align: center;
    color: var(--gray-500);
    background: linear-gradient(to bottom, transparent 0%, var(--gray-50) 100%);
}

.chart-empty .ic {
    width: 32px;
    height: 32px;
    color: var(--gray-300);
    margin-bottom: 12px;
}

.chart-empty p {
    margin: 4px 0;
    font-size: 13px;
}

/* Título clicável dentro de tabelas (lista de links, contatos, etc.) */
.link-title {
    display: block;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    line-height: 1.35;
    text-decoration: none;
}
.link-title:hover { color: var(--gray-900); text-decoration: underline; text-underline-offset: 2px; }

.link-slug {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

.t-tabular {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

.text-muted { color: var(--gray-500); }
.text-soft  { color: var(--gray-600); }
.text-strong { color: var(--gray-900); }

/* ============ PROGRESS BAR (DS §8.4) ============ */
.progress-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--brand-500);
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ============ LINKS ============ */
a {
    color: var(--brand-700);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--brand-600);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ============ FORMULÁRIOS ============ */
button {
    font-family: inherit;
    cursor: pointer;
}

input, select, textarea {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--gray-800);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    transition: all var(--transition-base);
}

input::placeholder, textarea::placeholder { color: var(--gray-400); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: var(--ring-focus);
}

/* Foco em qualquer elemento navegável por teclado. */
:focus-visible {
    outline: none;
    box-shadow: var(--ring-focus);
}

button:focus-visible {
    box-shadow: var(--ring-focus);
}

/* ============ TABELAS ============ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
}

td {
    padding: 12px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--gray-50); }

/* ============ ÍCONES (SVG outline) ============
 * Conjunto definido em app/Views/partials/icons.php.
 * Renderizado via IconHelper::render('nome', tamanho).
 * Stroke 1.5px, sem fill, herdando currentColor do parente.
 */
.ic {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ============ ANIMAÇÕES PERMITIDAS (DS §7.3) ============ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0%   { background-position:  200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ UTILITÁRIOS ============ */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
