/* ============================================================
   PromoDispara — Design System
   Fonte da verdade: CLAUDE.md
   ============================================================ */

/* ---- Google Fonts ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---- Variáveis -------------------------------------------- */
:root {
  /* Marca */
  --brand-primary:       #0F766E;
  --brand-primary-hover: #0D6360;
  --brand-secondary:     #14B8A6;
  --brand-accent:        #F97316;
  --brand-accent-hover:  #EA6C10;

  /* Neutros */
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50:  #F9FAFB;
  --white:    #FFFFFF;

  /* Semânticas */
  --success:    #10B981;
  --success-bg: #ECFDF5;
  --warning:    #F59E0B;
  --warning-bg: #FFFBEB;
  --danger:     #EF4444;
  --danger-bg:  #FEF2F2;
  --info:       #3B82F6;
  --info-bg:    #EFF6FF;

  /* Tipografia */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 16px;
  --text-lg:   18px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  30px;

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

  /* Border radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);

  /* Transições */
  --transition: 150ms ease;
}

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

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

body {
  font-family: var(--font-family);
  font-size: var(--text-sm);
  color: var(--gray-900);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Tipografia -------------------------------------------- */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.25; color: var(--gray-900); }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { color: var(--gray-700); line-height: 1.6; }

.text-xs     { font-size: var(--text-xs); }
.text-sm     { font-size: var(--text-sm); }
.text-base   { font-size: var(--text-base); }
.text-lg     { font-size: var(--text-lg); }
.text-xl     { font-size: var(--text-xl); }
.text-muted  { color: var(--gray-400); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ---- Botões ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}
.btn:disabled        { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible   { outline: 2px solid var(--brand-primary); outline-offset: 2px; }

.btn-primary         { background: var(--brand-primary); color: var(--white); }
.btn-primary:hover   { background: var(--brand-primary-hover); text-decoration: none; }

.btn-accent          { background: var(--brand-accent); color: var(--white); }
.btn-accent:hover    { background: var(--brand-accent-hover); text-decoration: none; }

.btn-secondary       { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--gray-50); text-decoration: none; }

.btn-ghost           { background: transparent; color: var(--brand-primary); }
.btn-ghost:hover     { background: var(--gray-100); text-decoration: none; }

.btn-danger          { background: var(--danger); color: var(--white); }
.btn-danger:hover    { background: #DC2626; text-decoration: none; }

.btn-sm   { padding: 6px var(--space-sm); font-size: var(--text-xs); }
.btn-lg   { padding: 14px var(--space-xl); font-size: var(--text-base); }
.btn-full { width: 100%; }

/* Estado loading no botão */
.btn.loading { color: transparent; pointer-events: none; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ---- Cards ------------------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: var(--space-lg);
}
.card-sm { padding: var(--space-md); }
.card-lg { padding: var(--space-xl); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.card-title { font-size: var(--text-base); font-weight: 600; }

/* ---- Inputs ----------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }

label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
}

.input {
  width: 100%;
  padding: 10px var(--space-sm);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  color: var(--gray-900);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input::placeholder { color: var(--gray-400); }
.input:focus {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}
.input.error       { border-color: var(--danger); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.15); }

.input-hint  { font-size: var(--text-xs); color: var(--gray-400); }
.input-error { font-size: var(--text-xs); color: var(--danger); }

select.input { cursor: pointer; }

/* ---- Badges ----------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
}
.badge-success { background: var(--success-bg); color: #065F46; }
.badge-warning { background: var(--warning-bg); color: #92400E; }
.badge-danger  { background: var(--danger-bg);  color: #991B1B; }
.badge-info    { background: var(--info-bg);    color: #1E40AF; }
.badge-neutral { background: var(--gray-100);   color: var(--gray-700); }
.badge-primary { background: #F0FDFA;           color: var(--brand-primary); }

/* ---- Tabelas ---------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}

table            { width: 100%; border-collapse: collapse; background: var(--white); }
thead            { background: var(--gray-50); }
th {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200);
}
td {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover         { background: var(--gray-50); }

/* ---- Toasts ----------------------------------------------- */
#toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--gray-900);
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideIn .2s ease;
  max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-danger  { background: var(--danger); }
.toast-warning { background: var(--warning); color: var(--gray-900); }

/* ---- Skeleton --------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text   { height: 14px; width: 100%; }
.skeleton-title  { height: 20px; width: 60%; }
.skeleton-avatar { height: 40px; width: 40px; border-radius: 50%; }
.skeleton-card   { height: 120px; width: 100%; border-radius: var(--radius-md); }

/* ---- Estado vazio ----------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  gap: var(--space-md);
}
.empty-state-icon  {
  width: 64px; height: 64px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.empty-state-title { font-size: var(--text-lg); font-weight: 600; color: var(--gray-700); }
.empty-state-desc  { font-size: var(--text-sm); color: var(--gray-400); max-width: 320px; }

/* ---- Estado de erro --------------------------------------- */
.error-state {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--danger-bg);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  color: #991B1B;
  font-size: var(--text-sm);
}

/* ---- Layout utilitários ----------------------------------- */
.container    { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--space-md); }
.container-sm { max-width: 480px; }
.container-md { max-width: 720px; }

.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }
.hidden  { display: none; }

/* ---- Divisor ---------------------------------------------- */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: var(--space-md) 0; }

/* ---- Animações -------------------------------------------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .2s ease; }

/* ---- Responsivo ------------------------------------------- */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
  #toast-container { right: var(--space-md); left: var(--space-md); }
  .toast { max-width: 100%; }
}
