/* ============================================================
   BASE — Reset, tipografia, scrollbar, foco
   ============================================================ */

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

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-md);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-light); }

/* Foco visível (acessibilidade) */
:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-gold); }

/* Imagens */
img, svg { display: block; max-width: 100%; }

/* Listas */
ul, ol { list-style: none; }

/* Formulários */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Tipografia base */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-text);
}

h1 { font-size: var(--font-3xl); }
h2 { font-size: var(--font-2xl); }
h3 { font-size: var(--font-xl); }
h4 { font-size: var(--font-lg); }
h5 { font-size: var(--font-md); font-weight: 600; }
h6 { font-size: var(--font-sm); font-weight: 600; }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }
em { font-style: italic; }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--color-green-bg);
  color: var(--color-primary);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
}
pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
}
pre code { background: none; padding: 0; }

blockquote {
  border-left: 3px solid var(--color-gold);
  padding-left: var(--space-4);
  color: var(--color-text-muted);
  font-style: italic;
  margin: var(--space-4) 0;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* Seleção de texto */
::selection {
  background: var(--color-gold-light);
  color: var(--color-primary);
}

/* Utilitários de texto */
.text-xs     { font-size: var(--font-xs); }
.text-sm     { font-size: var(--font-sm); }
.text-md     { font-size: var(--font-md); }
.text-lg     { font-size: var(--font-lg); }
.text-xl     { font-size: var(--font-xl); }
.text-2xl    { font-size: var(--font-2xl); }
.text-3xl    { font-size: var(--font-3xl); }
.text-muted  { color: var(--color-text-muted); }
.text-gold   { color: var(--color-gold); }
.text-primary{ color: var(--color-primary); }
.text-danger { color: var(--color-danger); }
.text-success{ color: var(--color-success); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-display{ font-family: var(--font-display); }
.font-mono   { font-family: var(--font-mono); }
.font-bold   { font-weight: 700; }
.font-semibold{ font-weight: 600; }

/* Utilitários de display */
.hidden  { display: none !important; }
.flex    { display: flex; }
.grid    { display: grid; }
.block   { display: block; }
.inline  { display: inline; }
.inline-flex { display: inline-flex; }

.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.flex-1         { flex: 1; }
.flex-wrap      { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Truncar texto */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Espaçamento */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }

/* Cores de fundo utilitárias */
.bg-card     { background: var(--color-card); }
.bg-surface  { background: var(--color-surface); }
.bg-gold-bg  { background: var(--color-gold-bg); }
.bg-success-bg { background: var(--color-success-bg); }
.bg-danger-bg  { background: var(--color-danger-bg); }

/* Largura */
.w-full  { width: 100%; }
.w-auto  { width: auto; }
.min-w-0 { min-width: 0; }

/* Animações base */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes toastSlide {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-in  { animation: fadeIn  var(--transition-base) both; }
.animate-scale-in { animation: scaleIn var(--transition-base) both; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border-light) 25%,
    var(--color-border) 50%,
    var(--color-border-light) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-load 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes skeleton-load {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Loader spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* Estado vazio */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}
.empty-state svg { opacity: .3; margin-bottom: var(--space-4); }
.empty-state h3  { font-size: var(--font-lg); margin-bottom: var(--space-2); color: var(--color-text-muted); }
.empty-state p   { font-size: var(--font-sm); }
