/* ════════════════════════════════════════════════════════════════════
   DESIGN SYSTEM — SAD BAILE / SHOP
   Single source of truth: tokens + componentes + utilitários compartilhados
   Cada página importa este arquivo via <link rel="stylesheet">
   ════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&family=Archivo+Black&display=swap');

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

/* ── TOKENS (variáveis CSS) ────────────────────────────────────────── */
:root {
  /* Cores base */
  --bg:           #050505;
  --bg-2:         #0c0a14;
  --card:         #111111;
  --card-2:       #1a1a1a;
  --line:         rgba(255, 255, 255, .08);
  --line-2:       rgba(255, 255, 255, .16);

  /* Texto (alto contraste para boa leitura) */
  --text:         #f5f5f5;
  --muted:        #9b9b9b;
  --dim:          #6e6e6e;

  /* Acento principal (roxo Sad Baile) */
  --purple:       #8b5cf6;
  --purple-deep:  #6d28d9;
  --purple-glow:  rgba(139, 92, 246, .35);
  --purple-soft:  rgba(139, 92, 246, .08);

  /* Estados / semânticos */
  --green:        #10b981;
  --orange:       #f97316;
  --red:          #ef4444;
  --blue:         #3b82f6;

  /* Fontes */
  --font-body:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Arial, sans-serif;
  --font-display:   'Bebas Neue', sans-serif;          /* títulos grandes, botões curtos */
  --font-display-2: 'Archivo Black', sans-serif;       /* títulos brutalistas */

  /* Tamanhos de fonte */
  --fs-xs:    10px;
  --fs-sm:    11px;
  --fs-base:  13px;
  --fs-md:    14px;
  --fs-lg:    15px;
  --fs-xl:    16px;
  --fs-2xl:   18px;
  --fs-3xl:   22px;
  --fs-4xl:   28px;
  --fs-5xl:   38px;

  /* Espaçamentos */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* Bordas / cantos */
  --radius-sm: 2px;
  --radius:    4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow:    0 4px 14px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);

  /* Transições */
  --t-fast: .15s ease;
  --t:      .2s ease;
  --t-slow: .35s ease;

  /* Z-index escala */
  --z-nav:    50;
  --z-modal:  200;
  --z-veil:   250;
  --z-loader: 300;
}

/* ── BASE ──────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── ACCESSIBILITY ─────────────────────────────────────────────────── */
/* Foco visível para navegação por teclado (não aparece no clique de mouse) */
:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Link "pular para o conteúdo" — fica oculto até receber foco por teclado */
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 999;
  transform: translateY(-160%);
  background: var(--purple);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: .5px;
  text-decoration: none;
  transition: transform var(--t);
}
.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Conteúdo exclusivo para leitores de tela */
.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;
}

/* Respeita a preferência de "reduzir movimento" do sistema operacional */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── TYPOGRAPHY HELPERS ────────────────────────────────────────────── */
.font-bebas    { font-family: var(--font-display);   letter-spacing: 2px; }
.font-archivo  { font-family: var(--font-display-2); letter-spacing: -.3px; line-height: 1; }
.text-muted    { color: var(--muted); }
.text-dim      { color: var(--dim); }
.text-purple   { color: var(--purple); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-blue     { color: var(--blue); }
.text-center   { text-align: center; }
.text-uppercase { text-transform: uppercase; letter-spacing: 1.5px; }

/* ── TAG (chip estilo "[ Brand ]") ─────────────────────────────────── */
.ds-tag {
  display: inline-block;
  font-size: var(--fs-sm);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--purple);
  padding: 5px 11px;
  border: 1px solid rgba(139, 92, 246, .35);
  border-radius: var(--radius-sm);
  background: var(--purple-soft);
}

/* ── BUTTONS ───────────────────────────────────────────────────────── */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: .3px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

.ds-btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
.ds-btn-primary:hover {
  background: var(--purple-deep);
  box-shadow: 0 0 20px var(--purple-glow);
}
.ds-btn-primary:disabled,
.ds-btn:disabled {
  background: var(--card-2);
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.ds-btn-ghost {
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border-color: var(--line-2);
}
.ds-btn-ghost:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.ds-btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(239, 68, 68, .4);
}
.ds-btn-danger:hover {
  background: rgba(239, 68, 68, .1);
  border-color: var(--red);
}

/* Botão estilo brutalista (Bebas Neue, all-caps, letter-spacing largo) */
.ds-btn-display {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  letter-spacing: 3px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 13px 26px;
}

.ds-btn-full { width: 100%; }
.ds-btn-sm   { padding: 7px 14px; font-size: var(--fs-sm); }
.ds-btn-lg   { padding: 14px 28px; font-size: var(--fs-lg); }

/* ── FORMS ─────────────────────────────────────────────────────────── */
.ds-label {
  display: block;
  font-size: var(--fs-sm);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.ds-input,
.ds-select,
.ds-textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--fs-md);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast);
  line-height: 1.5;
}
.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
  border-color: var(--purple);
}
.ds-textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.6;
}
.ds-select option {
  background: var(--card);
  color: var(--text);
}

.ds-row    { margin-bottom: 14px; }
.ds-row-2  { display: grid; grid-template-columns: 1fr 1fr;  gap: 10px; margin-bottom: 14px; }
.ds-row-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (max-width: 600px) {
  .ds-row-2, .ds-row-3 { grid-template-columns: 1fr; }
  /* iOS Safari dá zoom ao focar inputs com font-size < 16px */
  .ds-input, .ds-select, .ds-textarea { font-size: 16px; }
}

.ds-err {
  padding: 10px 12px;
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .2);
  border-radius: var(--radius);
  color: var(--red);
  font-size: var(--fs-sm);
  margin-bottom: 14px;
  display: none;
}
.ds-err.on { display: block; }

/* ── MODAL / VEIL ──────────────────────────────────────────────────── */
.ds-veil {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, .88);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ds-veil.on { display: flex; }

.ds-modal {
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  width: 540px;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── STATUS BADGES ─────────────────────────────────────────────────── */
.ds-status {
  font-size: var(--fs-xs);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-align: center;
  display: inline-block;
}
.ds-status-pendente  { background: rgba(249, 115, 22, .15); color: var(--orange); border: 1px solid rgba(249, 115, 22, .3); }
.ds-status-pago      { background: rgba(59, 130, 246, .15); color: var(--blue);   border: 1px solid rgba(59, 130, 246, .3); }
.ds-status-enviado   { background: rgba(139, 92, 246, .15); color: var(--purple); border: 1px solid rgba(139, 92, 246, .3); }
.ds-status-entregue  { background: rgba(16, 185, 129, .15); color: var(--green);  border: 1px solid rgba(16, 185, 129, .3); }
.ds-status-cancelado { background: rgba(239, 68, 68, .15);  color: var(--red);    border: 1px solid rgba(239, 68, 68, .3); }
.ds-status-low       { background: rgba(249, 115, 22, .15); color: var(--orange); border: 1px solid rgba(249, 115, 22, .3); }
.ds-status-out       { background: rgba(239, 68, 68, .15);  color: var(--red);    border: 1px solid rgba(239, 68, 68, .3); }
.ds-status-ok        { background: rgba(16, 185, 129, .12); color: var(--green);  border: 1px solid rgba(16, 185, 129, .3); }

/* ── DISCOUNT PILL ─────────────────────────────────────────────────── */
.ds-discount-pill {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--green);
  background: rgba(16, 185, 129, .1);
  border: 1px solid rgba(16, 185, 129, .25);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}

/* ── LOADER / SPINNER ──────────────────────────────────────────────── */
.ds-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--purple);
  animation: ds-spin .8s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ── SCROLLBAR ─────────────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
*::-webkit-scrollbar      { width: 5px; height: 5px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── ADM LINK (canto inferior direito discreto) ────────────────────── */
.ds-adm-link {
  position: fixed;
  bottom: 14px;
  right: 16px;
  z-index: 60;
  font-size: var(--fs-xs);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .1);
  text-decoration: none;
  transition: color var(--t);
}
.ds-adm-link:hover { color: var(--purple); }

/* ── ANIMATIONS ────────────────────────────────────────────────────── */
@keyframes ds-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ds-slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes ds-pulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.4); }
}

/* ── PRINT (compartilhado) ─────────────────────────────────────────── */
@media print {
  body { background: #fff; color: #000; }
  .ds-adm-link, .no-print { display: none !important; }
}
