/* assets/css/base.css */
/* ============================================================
   base.css — Variáveis CSS, Reset e Tema Global
   ============================================================ */

/* Reset e Variáveis Globais */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Dimensões */
  --navbar-h: 56px;
  --footer-h: 48px;
  --navbar-extra-gap: 16px;

  /* Paleta CRO - Modo Claro */
  --bg-page: #f0f4f8;  /* --color-neblina */
  --card-bg: #ffffff;
  --text-color: #212529;
  --muted-color: #6c757d;
  --divider: rgba(0, 0, 0, 0.08);

  /* Cores CRO (legado — mantidos para compatibilidade) */
  --cro-teal: #0b3534;
  --cro-green: #159a49;
  --cro-white: #ffffff;
  --cro-black: #231f20;
  --skeleton-bg: #f2f2f2;
  --skeleton-shimmer: #fafafa;

  /* Paleta Semântica do Design System */
  --color-floresta:  #0b3534;  /* primário escuro — navbar, headers */
  --color-esmeralda: #159a49;  /* acento de ação — botões, links, badges */
  --color-menta:     #d4edda;  /* hover states, highlights suaves */
  --color-ardosia:   #1e2330;  /* dark mode base (mais quente que #0f1115) */
  --color-neblina:   #f0f4f8;  /* fundo de página (mais quente que #f6f8fb) */
  --color-ambar:     #d97706;  /* alertas, vencidos, prioridade alta */

  /* Alias para corrigir referência --cro-dark usada em templates */
  --cro-dark: var(--color-floresta);

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Body e Estrutura Base */
html {
  scroll-behavior: smooth;
}

/* Alpine.js: esconde elementos x-cloak até o Alpine inicializar e resolver o
   estado real, evitando o flash de conteúdo sem estilo (FOUC) no primeiro
   paint. Alpine remove o atributo x-cloak assim que processa o elemento. */
[x-cloak] {
  display: none !important;
}

body {
  background: var(--bg-page);
  color: var(--text-color);
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Empurra o conteúdo abaixo da navbar fixa.
   O footer não é mais fixo, então não há padding-bottom aqui. */
body.has-fixed-footer {
  padding-top: calc(var(--navbar-h) + var(--navbar-extra-gap));
}

/* Tipografia */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}
h5 {
  font-size: 1.25rem;
}
h6 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.badge) {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition:
    background-size 0.25s ease,
    color 0.2s ease;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.badge):hover {
  background-size: 100% 2px;
}

/* Containers */
.container {
  max-width: 1400px;
}

/* Utilities */
.text-muted {
  color: var(--muted-color) !important;
}

.bg-light {
  background: var(--bg-page) !important;
}

.border-light {
  border-color: var(--divider) !important;
}

/* Responsividade Mobile */
@media (max-width: 575.98px) {
  :root {
    --navbar-h: 64px;
    --footer-h: 56px;
  }

  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.25rem;
  }
  h4 {
    font-size: 1.1rem;
  }
  h5 {
    font-size: 1rem;
  }
}

/* Scrollbar Customizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-color);
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

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

.visually-hidden.focusable:focus,
.visually-hidden.focusable:focus-visible {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10000;
  clip: auto;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--cro-teal);
  color: #fff;
  border-radius: 0.35rem;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Transições Globais */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

button,
a,
input,
select,
textarea {
  transition: all 0.2s ease;
}
