/*
 * HYDRA CREATIVE — BASE.CSS
 * Tokens globais, reset e classes de estado
 * System Contract V2
 */

:root {
  /* Fundos */
  --bg-base:  #050505;
  --bg-panel: #0F0F0F;
  --bg-card:  #1A1A1A;

  /* Acento */
  --accent-primary:   #FFB020;
  --accent-secondary: #FF4B4B;
  --accent-gradient:  linear-gradient(135deg, #FFB020, #FF4B4B);

  /* Texto */
  --text-main:    #FFFFFF;
  --text-muted:   #8A8A8A;
  --text-inverse: #0A0A0A;

  /* UI */
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-focus:  #FFB020;
  --overlay-heavy: rgba(0, 0, 0, 0.8);
  --overlay-mid:   rgba(0, 0, 0, 0.5);

  /* Forma */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  /* Espaçamento */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Aliases de compatibilidade (não usar em código novo) */
  --spacing-xs: var(--space-xs);
  --spacing-sm: var(--space-sm);
  --spacing-md: var(--space-md);
  --spacing-lg: var(--space-lg);
  --spacing-xl: var(--space-xl);

  /* Tipografia */
  --font-display: 'Outfit', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transições */
  --transition-fast:   0.15s ease;
  --transition-base:   0.25s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-sidebar:  50;
  --z-sheet:    90;
  --z-nav:      100;
  --z-overlay:  200;
  --z-modal:    300;
  --z-toast:    1000;
}

/* ─── Reset ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font-family: var(--font-body);
  cursor: pointer;
}

input, select, textarea {
  font-family: var(--font-body);
}

/* ─── Classes de estado ─── */

/*
 * .is-active NÃO define display aqui.
 * Cada componente define seu próprio display
 * quando ativo. Isso evita sobrescrever grids.
 */
.is-active {
  /* intencional: vazio — cada componente define */
}

.is-hidden {
  display: none !important;
}

.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.is-loading {
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 40%,
    rgba(255, 255, 255, 0.1)  60%,
    transparent 100%
  );
  animation: shimmer 1.6s infinite;
}

.is-empty {
  /* componente define o empty state */
}

.is-error {
  border-color: var(--accent-secondary) !important;
}

.is-expanded {
  /* componente define */
}

/* Bloqueia scroll do body quando modal/gaveta está aberta */
body.no-scroll {
  overflow: hidden;
  /* Necessário no iOS — overflow:hidden sozinho não funciona */
  position: fixed;
  width: 100%;
}

/* ─── Animações ─── */
@keyframes shimmer {
  100% { transform: translateX(100%); }
}

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

.spin {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Utilitários de texto ─── */
.text-accent  { color: var(--accent-primary); }
.text-error   { color: var(--accent-secondary); }
.text-muted   { color: var(--text-muted); }
.text-inverse { color: var(--text-inverse); }

/* ─── Select escuro (padrão global) ─── */
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 36px 10px 12px;
  font-size: 14px;
  font-family: var(--font-body);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8A8A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  outline: none;
}

select:focus {
  border-color: var(--border-focus);
}

select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

/* ─── Utilitários de layout ─── */
.section-divider {
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-lg);
}

.section-divider:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Linha label + toggle switch lado a lado */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.panel-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}
