/* =====================================================================
   SIO-PDF — DESIGN SYSTEM OFICIAL (única fonte de verdade visual)
   Conceito: minimalista, premium, moderno, clean, profissional.
   Toda tela/componente/modal futuro DEVE usar estas classes e tokens.
   Paleta: base slate/white, primary blue-600.
   ===================================================================== */

:root {
  /* Base */
  --bg:        #f8fafc;  /* slate-50 */
  --surface:   #ffffff;
  --ink:       #0f172a;  /* slate-900 */
  --ink-2:     #334155;  /* slate-700 */
  --muted:     #64748b;  /* slate-500 */
  --line:      #e2e8f0;  /* slate-200 */
  --line-2:    #f1f5f9;  /* slate-100 */

  /* Primary (blue) */
  --primary:     #2563eb; /* blue-600 */
  --primary-500: #3b82f6;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --sky:         #38bdf8; /* sky-400 */
  --primary-tint:#eff6ff; /* blue-50 */

  /* Estados */
  --success: #22c55e;
  --danger:  #ef4444;
  --warning: #f59e0b;

  /* Estrutura */
  --radius-sm: .5rem;
  --radius:    .75rem;   /* rounded-xl  — botões/inputs */
  --radius-lg: 1rem;     /* rounded-2xl — cards/modais */
  --shadow-sm: 0 1px 2px 0 rgba(15,23,42,.05);
  --shadow-md: 0 4px 12px -2px rgba(15,23,42,.10), 0 2px 6px -2px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 50px -12px rgba(15,23,42,.25);
  --ring:      0 0 0 3px rgba(37,99,235,.30);

  /* Espaçamento base (hierarquia consistente) */
  --space:     1rem;
  --transition: .18s cubic-bezier(.4,0,.2,1);

  /* Aliases de compatibilidade (telas legadas) — apontam para a nova paleta */
  --brand:     var(--primary);
  --brand-600: var(--primary-700);
  --brand-300: #93c5fd;
  --navy-900:  #0f172a;
  --navy-800:  #1e293b;
  --navy-700:  #334155;
}

/* ---------- Base / tipografia ---------- */
body { background: var(--bg); color: var(--ink); font-family: "Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; }
.ds-h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.ds-h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.ds-sub { font-size: .875rem; color: var(--muted); }
.text-muted { color: var(--muted); }
a { color: var(--primary); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-pad { padding: 1.25rem; }

/* ---------- Botões ---------- */
.btn, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; font-size: .875rem; line-height: 1;
  padding: .625rem 1rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  user-select: none;
}
.btn svg, .btn-primary svg, .btn-secondary svg, .btn-ghost svg, .btn-danger svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn-primary   { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-700); }
.btn-secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-secondary:hover { background: var(--line-2); }
.btn-ghost     { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
/* microinteração de clique (compress) */
.btn:active, .btn-primary:active, .btn-secondary:active, .btn-ghost:active, .btn-danger:active { transform: scale(.97); }
/* foco acessível */
.btn:focus-visible, .btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible { outline: none; box-shadow: var(--ring); }
/* disabled */
.btn[disabled], .btn-primary[disabled], .btn-secondary[disabled], .btn-ghost[disabled], .btn-danger[disabled],
.btn.is-loading, .btn-primary.is-loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: .4rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }
/* spinner dentro do botão (loading state) */
.btn-spinner { width: 1rem; height: 1rem; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: ds-spin .7s linear infinite; }

/* ---------- Inputs / formulários ---------- */
.ds-label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.input, .ds-field, select.input, textarea.input {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .625rem .75rem; font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: #94a3b8; }
.input:hover { border-color: #cbd5e1; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input:disabled { background: var(--line-2); color: var(--muted); cursor: not-allowed; }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.input.is-valid   { border-color: var(--success); }
.ds-helper { font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.ds-helper.is-invalid { color: var(--danger); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; }
.badge-neutral { background: var(--line-2); color: var(--ink-2); }
.badge-primary { background: var(--primary-tint); color: var(--primary-700); }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }

/* ---------- Tabelas ---------- */
.ds-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ds-table thead th { position: sticky; top: 0; background: var(--line-2); color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: .7rem .85rem; z-index: 1; }
.ds-table tbody td { padding: .8rem .85rem; border-top: 1px solid var(--line); color: var(--ink-2); }
.ds-table tbody tr { transition: background var(--transition); }
.ds-table tbody tr:hover { background: var(--primary-tint); }

/* ---------- Modais ---------- */
/* Base oculta; só exibe quando NÃO tem .hidden (não usa !important, então não
   quebra utilitários responsivos do Tailwind como hidden sm:inline). */
.modal-overlay { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 1rem; background: rgba(15,23,42,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: ds-fade .2s ease both; }
.modal-overlay:not(.hidden) { display: flex; }
.modal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 32rem; animation: ds-modal-in .24s cubic-bezier(.21,1.02,.73,1) both; }
.modal-head { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.25rem; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .6rem; }

/* ---------- Estado vazio ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.empty-state .empty-icon { width: 56px; height: 56px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--primary-tint); color: var(--primary); margin-bottom: .9rem; }
.empty-state .empty-icon svg { width: 28px; height: 28px; }
.empty-state h3 { font-weight: 700; color: var(--ink-2); margin-bottom: .25rem; }
.empty-state p { font-size: .85rem; max-width: 22rem; }

/* ---------- Skeleton / shimmer ---------- */
.skeleton { position: relative; overflow: hidden; background: #e9eef5; border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: ds-shimmer 1.3s infinite; }
.skeleton-text { height: .8rem; margin: .4rem 0; }
.skeleton-line { height: 1rem; border-radius: 999px; }
.skeleton-card { height: 7rem; border-radius: var(--radius-lg); }
.skeleton-avatar { width: 2.5rem; height: 2.5rem; border-radius: 999px; }

/* ---------- Imagens (lazy + fade + fallback) ---------- */
.img-wrap { position: relative; overflow: hidden; background: var(--line-2); }
.img-wrap > img { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .4s ease, transform .4s ease; transform: scale(1.02); }
.img-wrap > img.is-loaded { opacity: 1; transform: scale(1); }
.img-wrap .img-skeleton { position: absolute; inset: 0; }
img.ds-fade { opacity: 0; transition: opacity .4s ease; }
img.ds-fade.is-loaded { opacity: 1; }

/* ---------- Animações de entrada ---------- */
.anim-fade { animation: ds-fade .25s ease both; }
.anim-slide-up { animation: ds-slide-up .28s cubic-bezier(.21,1.02,.73,1) both; }
.anim-pop { animation: ds-modal-in .24s cubic-bezier(.21,1.02,.73,1) both; }

@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-shimmer { 100% { transform: translateX(100%); } }
@keyframes ds-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-slide-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ds-modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* respeita preferências de movimento reduzido (acessibilidade) */
@media (prefers-reduced-motion: reduce) {
  .anim-fade, .anim-slide-up, .anim-pop, .modal-overlay, .modal-card { animation: none !important; }
  .card-hover:hover { transform: none; }
  .skeleton::after { animation: none; }
}

/* ---------- Spinner utilitário ---------- */
.ds-spinner { width: 1.5rem; height: 1.5rem; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: ds-spin .7s linear infinite; }

/* ---
/* =====================================================================
   PROFUNDIDADE & SEÇÕES (separação visual clara entre blocos)
   ===================================================================== */

/* Fundo global com leve profundidade (gradiente + pontilhado sutil) */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 380px at 100% -5%, rgba(37,99,235,.06), transparent 60%),
    radial-gradient(700px 320px at -10% 0%, rgba(56,189,248,.05), transparent 55%),
    radial-gradient(rgba(15,23,42,.035) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed, fixed, fixed;
}

/* Seções com espaçamento consistente e identidade própria */
.section { padding: 3.5rem 1rem; position: relative; }
.section-sm { padding: 2.25rem 1rem; }
.section-alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-tint { background: linear-gradient(180deg, var(--primary-tint), #fff); }
.section-muted { background: var(--line-2); }
.section-dark { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); color: #fff; }
.section-dark .ds-h1, .section-dark .ds-h2, .section-dark h1, .section-dark h2, .section-dark h3 { color: #fff; }
.section-dark .ds-sub, .section-dark p { color: #cbd5e1; }

/* Padrão decorativo opcional (grade fina) por trás do conteúdo */
.section-pattern::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(15,23,42,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(15,23,42,.035) 1px, transparent 1px);
  background-size: 26px 26px; -webkit-mask-image: linear-gradient(180deg, #000, transparent);
  mask-image: linear-gradient(180deg, #000, transparent);
}
.section > * { position: relative; z-index: 1; }

/* Cabeçalho de seção padronizado (rótulo + título + subtítulo) */
.section-head { text-align: center; max-width: 44rem; margin: 0 auto 2rem; }
.eyebrow { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); background: var(--primary-tint); padding: .25rem .6rem; border-radius: 999px; margin-bottom: .75rem; }

/* Faixa divisória sutil entre blocos */
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); border: 0; margin: 0; }

/* Cabeçalho de página com leve faixa de destaque (apps internos) */
.page-head { position: relative; padding: 1.25rem 0 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }

/* Container de página padrão */
.container-page { max-width: 72rem; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }

/* Card em destaque (mais contraste para informações importantes) */
.card-feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.card-tint { background: linear-gradient(180deg, var(--primary-tint), #fff); border: 1px solid #dbeafe; border-radius: var(--radius-lg); }

/* Revelação suave ao rolar (ativada por ui.js) */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.reveal-in { opacity: 1; transform: none; }

/* Rolagem suave global */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  body { background-attachment: scroll; }
}
