/* ============================================================
   PAV - Estilo público (inspirado em interfaces modernas de agendamento)
   ============================================================ */

:root {
    --pav-primary: #0052cc;
    --pav-primary-dark: #003d99;
    --pav-primary-light: #e6efff;
    --pav-success: #16a34a;
    --pav-text: #1a2b4a;
    --pav-muted: #6b7a90;
    --pav-border: #e2e8f0;
    --pav-bg: #f7f9fc;
}

body {
    background: var(--pav-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--pav-text);
}

/* ==================================================
   Sistema de tamanhos de logo
   Alturas pensadas para peso visual equivalente
   respeitando as proporções muito diferentes:
   PAV      = ratio 1.26 (quase quadrado)
   Receita  = ratio 1.16 (quase quadrado)
   Taboão   = ratio 2.55 (bem horizontal)
   ================================================== */
:root {
    --logo-hero-h:          150px;
    --logo-footer-quad-h:   100px;  /* 46px + 30% = ~60px */
    --logo-footer-horiz-h:  80px;  /* 30px + 30% = 39px */
    --logo-confirm-h:       80px;
}

/* ----- Header institucional ----- */
.pav-header {
    background: white;
    border-bottom: 1px solid var(--pav-border);
    padding: 1.1rem 0;
}
.pav-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.pav-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.pav-brand img {
    height: var(--logo-hero-h);
    width: auto;
    display: block;
    object-fit: contain;
}
.pav-header-info {
    flex: 1;
    min-width: 0;
    padding-left: 1.5rem;
    margin-left: .5rem;
    border-left: 1px solid var(--pav-border);
}
.pav-header .brand-title {
    font-weight: 600;
    color: var(--pav-text);
    font-size: 1rem;
    margin: 0;
    line-height: 1.3;
}
.pav-header .brand-sub {
    font-size: .82rem;
    color: var(--pav-muted);
    margin: .1rem 0 0;
    line-height: 1.3;
}

/* ----- Rodapé institucional ----- */
.pav-footer {
    background: white;
    border-top: 1px solid var(--pav-border);
    padding: 2.25rem 0 1.75rem;
    margin-top: 3rem;
}
.pav-footer .container { text-align: center; }
.footer-logos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
/* Logos com alturas DIFERENTES para peso visual EQUIVALENTE.
   Receita Federal (1.16 ratio) x 46px = ~53px largura → área ~2440
   Taboão da Serra (2.55 ratio) x 30px = ~76px largura → área ~2280
   Ambos ficam com peso visual similar. */
.footer-logo-rf {
    height: var(--logo-footer-quad-h);
    width: auto;
    object-fit: contain;
    display: block;
    opacity: .78;
    transition: opacity .15s;
}
.footer-logo-pref {
    height: var(--logo-footer-horiz-h);
    width: auto;
    object-fit: contain;
    display: block;
    opacity: .78;
    transition: opacity .15s;
}
.footer-logo-rf:hover,
.footer-logo-pref:hover { opacity: 1; }
.footer-divider {
    width: 1px;
    height: 36px;
    background: var(--pav-border);
    align-self: center;
}
.footer-text {
    font-size: .78rem;
    color: var(--pav-muted);
    margin: 0;
    letter-spacing: .01em;
}

/* Header/footer responsivos */
@media (max-width: 768px) {
    .pav-header .container {
        justify-content: center;
        text-align: center;
    }
    .pav-header-info {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        text-align: center;
        width: 100%;
    }
    :root {
        --logo-hero-h: 54px;
        --logo-footer-quad-h: 49px;   /* 38 + 30% ≈ 49 */
        --logo-footer-horiz-h: 31px;  /* 24 + 30% ≈ 31 */
    }
    .footer-logos { gap: 1.5rem; }
    .footer-divider { display: none; }
}

/* ----- Stepper (indicador de etapas) ----- */
.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stepper .step {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
    font-size: .875rem;
    color: var(--pav-muted);
    font-weight: 500;
    position: relative;
}
.stepper .step .num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
}
.stepper .step.active { color: var(--pav-primary); }
.stepper .step.active .num { background: var(--pav-primary); }
.stepper .step.done    { color: var(--pav-success); }
.stepper .step.done    .num { background: var(--pav-success); }
.stepper .step.done    .num::before { content: "✓"; }
.stepper .step.done    .num-text    { display: none; }
.stepper .step:not(:last-child)::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--pav-border);
    margin-left: .5rem;
}

/* ----- Cartão de conteúdo ----- */
.pav-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    margin-bottom: 1rem;
}
.pav-card h4 {
    margin-top: 0;
    margin-bottom: .5rem;
    font-weight: 700;
    color: var(--pav-text);
}
.pav-card .subtitle {
    color: var(--pav-muted);
    margin-bottom: 1.5rem;
    font-size: .95rem;
}

/* ----- Cards de assunto ----- */
.assunto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.assunto-card {
    border: 2px solid var(--pav-border);
    border-radius: 10px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all .2s ease;
    background: white;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 160px;
}
.assunto-card:hover {
    border-color: var(--pav-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,82,204,.1);
}
.assunto-card.selected {
    border-color: var(--pav-primary);
    background: var(--pav-primary-light);
}
.assunto-card .icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--pav-primary-light);
    color: var(--pav-primary);
    border-radius: 8px;
    font-weight: 700;
    font-size: .75rem;
    flex-shrink: 0;
    padding: 0 .35rem;
}
.assunto-card .nome {
    font-weight: 600;
    color: var(--pav-text);
    line-height: 1.35;
    font-size: .95rem;
}
.assunto-card .desc {
    font-size: .8rem;
    color: var(--pav-muted);
    line-height: 1.4;
}

/* ----- Calendário ----- */
.calendario {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
    margin-top: 1rem;
}
.calendario .dow {
    text-align: center;
    font-size: .75rem;
    font-weight: 600;
    color: var(--pav-muted);
    text-transform: uppercase;
    padding: .5rem 0;
}
.dia {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all .15s;
    background: white;
    color: var(--pav-text);
    font-weight: 500;
    position: relative;
}
.dia.vazio     { background: transparent; cursor: default; }
.dia.indisponivel {
    color: #cbd5e1;
    cursor: not-allowed;
    background: #f8fafc;
}
.dia.disponivel { border-color: var(--pav-border); }
.dia.disponivel:hover { border-color: var(--pav-primary); background: var(--pav-primary-light); }
.dia.hoje {
    border-color: var(--pav-primary);
    color: var(--pav-primary);
    font-weight: 700;
}
.dia.selecionado {
    background: var(--pav-primary);
    color: white !important;
    border-color: var(--pav-primary);
}
.dia .num-dia { font-size: 1rem; line-height: 1; }
.dia .qtd     { font-size: .65rem; color: var(--pav-muted); margin-top: 2px; }
.dia.selecionado .qtd { color: rgba(255,255,255,.85); }

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}
.calendar-header .mes-ano {
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: capitalize;
}
.calendar-header .btn-mes {
    background: white;
    border: 1px solid var(--pav-border);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--pav-text);
}
.calendar-header .btn-mes:hover:not(:disabled) { border-color: var(--pav-primary); color: var(--pav-primary); }
.calendar-header .btn-mes:disabled { opacity: .4; cursor: not-allowed; }

/* ----- Chips de horário ----- */
.turno-titulo {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    color: var(--pav-text);
    margin: 1.5rem 0 .75rem;
    font-size: .95rem;
}
.turno-titulo .icone-turno { font-size: 1.1rem; }
.horarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: .5rem;
}
.horario-chip {
    padding: .6rem;
    background: white;
    border: 1.5px solid var(--pav-border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--pav-text);
    transition: all .15s;
    font-size: .95rem;
}
.horario-chip:hover {
    border-color: var(--pav-primary);
    color: var(--pav-primary);
    background: var(--pav-primary-light);
}
.horario-chip.selecionado {
    background: var(--pav-primary);
    color: white;
    border-color: var(--pav-primary);
}

/* ----- Resumo lateral ----- */
.resumo-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.resumo-card h6 {
    text-transform: uppercase;
    font-size: .75rem;
    color: var(--pav-muted);
    letter-spacing: .05em;
    margin-bottom: .75rem;
}
.resumo-item {
    padding: .75rem 0;
    border-bottom: 1px solid var(--pav-border);
}
.resumo-item:last-child { border-bottom: none; }
.resumo-item .label {
    font-size: .75rem;
    color: var(--pav-muted);
    margin-bottom: .25rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.resumo-item .valor {
    font-weight: 600;
    color: var(--pav-text);
}
.resumo-item .valor.vazio { color: #cbd5e1; font-weight: 400; }

/* ----- Botões ----- */
.btn-pav {
    background: var(--pav-primary);
    color: white;
    border: none;
    padding: .75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    width: 100%;
    transition: background .15s;
}
.btn-pav:hover:not(:disabled) { background: var(--pav-primary-dark); color: white; }
.btn-pav:disabled { opacity: .5; cursor: not-allowed; }

.btn-voltar {
    background: white;
    color: var(--pav-primary);
    border: 1.5px solid var(--pav-border);
    padding: .5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all .15s;
}
.btn-voltar:hover { border-color: var(--pav-primary); color: var(--pav-primary-dark); }

/* ----- Confirmação ----- */
.confirmacao {
    text-align: center;
    padding: 2rem 1rem;
}
.confirmacao-logo {
    height: var(--logo-confirm-h);
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 1.5rem;
    opacity: .95;
}
.confirmacao .icone-ok {
    width: 72px;
    height: 72px;
    background: var(--pav-success);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.confirmacao .protocolo {
    background: #f0fdf4;
    border: 1px dashed var(--pav-success);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pav-success);
    letter-spacing: .1em;
    margin: 1rem 0;
}

/* ----- Loading ----- */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--pav-border);
    border-top-color: var(--pav-primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-vazio {
    text-align: center;
    padding: 2rem;
    color: var(--pav-muted);
}

/* ----- Responsivo ----- */
@media (max-width: 768px) {
    .pav-card { padding: 1.25rem; }
    .stepper { padding: .75rem; }
    .stepper .step { font-size: .7rem; }
    .stepper .step:not(:last-child)::after { display: none; }
    .horarios-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
