/* =============================================
   BASE STYLES - IntegraÁudio Design System
   Reset e estilos fundamentais
   ============================================= */

/* ===== RESET BÁSICO ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

/* ===== ELEMENTOS ROOT ===== */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--foreground);
  background-color: var(--background);
  min-height: 100vh;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ===== TIPOGRAFIA ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  margin: 0;
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

p {
  color: var(--foreground);
  line-height: var(--leading-relaxed);
  margin: 0;
}

small {
  font-size: var(--text-sm);
  color: var(--foreground-muted);
}

strong, b {
  font-weight: var(--font-semibold);
}

/* ===== LINKS ===== */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ===== LISTAS ===== */
ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ===== IMAGENS ===== */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ===== FORMULÁRIOS ===== */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
}

/* Placeholder styling */
::placeholder {
  color: var(--input-placeholder);
  opacity: 1;
}

/* ===== TABELAS ===== */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ===== CÓDIGO ===== */
code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

code {
  background-color: var(--muted);
  padding: var(--space-0-5) var(--space-1);
  border-radius: var(--radius-sm);
  color: var(--foreground);
}

pre {
  background-color: var(--muted);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ===== SELEÇÃO DE TEXTO ===== */
::selection {
  background-color: var(--primary-200);
  color: var(--primary-900);
}

[data-theme="dark"] ::selection {
  background-color: var(--primary-800);
  color: var(--primary-100);
}

/* ===== SCROLLBAR CUSTOMIZADA ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--background-subtle);
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ===== ACESSIBILIDADE ===== */
/* Screen reader only */
.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;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: var(--space-2) var(--space-4);
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== UTILITÁRIOS DE TEXTO ===== */
.text-muted {
  color: var(--foreground-muted) !important;
}

.text-primary {
  color: var(--accent) !important;
}

.text-success {
  color: var(--success-600) !important;
}

.text-warning {
  color: var(--warning-600) !important;
}

.text-error {
  color: var(--error-600) !important;
}

/* ===== CONTAINERS ===== */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* ===== ANIMAÇÕES BASE ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Classes de animação */
.animate-fadeIn {
  animation: fadeIn var(--transition-base) ease-out;
}

.animate-slideUp {
  animation: slideUp var(--transition-base) ease-out;
}

.animate-scaleIn {
  animation: scaleIn var(--transition-base) ease-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
