/**
 * Welucci Design System v1.0
 * Tokens e componentes base — fiel ao brand guide.
 * Família vinho + dourado, DM Sans, neutros quentes.
 */

:root {
  /* Família vinho */
  --primary:        #5E1F4F;
  --primary-dark:   #2A1729;
  --primary-mid:    #7B2D68;
  --primary-hover:  #4A193e;
  --primary-light:  #f4eaf2;

  /* Família dourado / creme */
  --gold:           #D4AF7D;
  --brand-gold:     #D4AF7D;
  --cream:          #F7EBD6;
  --off-white:      #F3E7EC;

  /* Texto */
  --text-dark:  #2A1729;
  --text-grey:  #8E7A8A;
  --text-muted: #6B7280;

  /* Superfícies (light) */
  --bg-body:    #F8F9FC;
  --bg-card:    #FFFFFF;
  --bg-input:   #F3F4F6;
  --border:     #E0E0E0;
  --border-color: #E0E0E0;

  /* Semânticas */
  --success: #27ae60;
  --error:   #ff5b5b;
  --warning: #f39c12;
  --info:    #3498db;

  /* Tokens de espaçamento */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   12px;
  --space-base: 16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-2xl:  48px;

  /* Raios */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Sombras */
  --shadow-base: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg:   0 20px 60px rgba(0, 0, 0, 0.12);

  /* Transições */
  --t-base:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Gradientes da assinatura */
  --grad-sidebar: linear-gradient(170deg, #2A1729 0%, #5E1F4F 60%, #7B2D68 100%);
  --grad-card-dark: linear-gradient(135deg, #2A1729 0%, #5E1F4F 100%);
  --grad-button:  linear-gradient(135deg, #5E1F4F 0%, #7B2D68 100%);
  --grad-lux:     radial-gradient(circle at top right, #D4AF7D, #5E1F4F, #2A1729);
}

[data-theme="dark"] {
  --bg-body:  #0F0A0E;
  --bg-card:  #1A1118;
  --bg-input: #241820;
  --text-dark: #F3E7EC;
  --text-grey: #A38A99;
  --border: #2A1F26;
  --border-color: #2A1F26;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-body);
  color: var(--text-dark);
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Sans', sans-serif;
  color: var(--text-dark);
  margin: 0;
  letter-spacing: -0.5px;
}
h1 { font-weight: 800; font-size: clamp(32px, 4vw, 48px); line-height: 0.95; letter-spacing: -2px; }
h2 { font-weight: 700; font-size: 24px; line-height: 1.1; letter-spacing: -1px; }
h3 { font-weight: 600; font-size: 16px; line-height: 1.3; letter-spacing: -0.3px; }

p { margin: 0 0 var(--space-base) 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.label-caps {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-mid);
}

/* Logo W (mark de fallback / favicon-like) */
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--grad-card-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -1px;
  box-shadow: var(--shadow-base);
  flex-shrink: 0;
}
.brand-mark.lg { width: 72px; height: 72px; font-size: 36px; border-radius: var(--radius-lg); }
.brand-mark.sm { width: 32px; height: 32px; font-size: 16px; border-radius: var(--radius-sm); }

/* Logotipo oficial Welucci — branco em transparente (Logo-Welucci.png).
   Usa mask-image para "tintar" sem precisar gerar variantes. */
.logo-welucci {
  display: inline-block;
  background: url('/assets/logo-welucci.png') no-repeat center / contain;
  width: 144px;
  height: 42px;
  flex-shrink: 0;
}
.logo-welucci.sm { width: 110px; height: 32px; }
.logo-welucci.lg { width: 220px; height: 64px; }
.logo-welucci.xl { width: 280px; height: 82px; }

/* Tintada — para usar em fundos claros */
.logo-welucci.tinted-vinho,
.logo-welucci.tinted-gold,
.logo-welucci.tinted-cream,
.logo-welucci.tinted-dark {
  background-image: none;
  -webkit-mask: url('/assets/logo-welucci.png') no-repeat center / contain;
  mask: url('/assets/logo-welucci.png') no-repeat center / contain;
}
.logo-welucci.tinted-vinho { background-color: var(--primary); }
.logo-welucci.tinted-gold  { background-color: var(--gold); }
.logo-welucci.tinted-cream { background-color: var(--cream); }
.logo-welucci.tinted-dark  { background-color: var(--primary-dark); }

/* Ícone genérico SVG dentro de botões/menus */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.2px;
  border: none;
  cursor: pointer;
  transition: var(--t-base);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--grad-button);
  color: var(--cream);
  box-shadow: var(--shadow-base);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.btn-gold {
  background: var(--gold);
  color: var(--primary-dark);
}
.btn-gold:hover:not(:disabled) {
  background: #c79e6a;
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border-color);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
}
.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}
.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: #fff;
}
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 16px 32px; font-size: 15px; }

/* Botão só com ícone (ações em tabelas, toolbars) */
.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--t-base);
  font-family: inherit;
}
.btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-light);
}
.btn-icon.danger:hover {
  background: rgba(255, 91, 91, 0.1);
  color: var(--error);
  border-color: rgba(255, 91, 91, 0.25);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-base);
}
.card.dark {
  background: var(--grad-card-dark);
  color: var(--cream);
  border-color: transparent;
}
.card.dark h1, .card.dark h2, .card.dark h3 { color: var(--cream); }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-dark);
  transition: var(--t-base);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.textarea { resize: vertical; min-height: 70px; line-height: 1.5; font-family: inherit; }
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237B2D68' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px;
  padding-right: 36px;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-base);
}
.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-mid);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.badge-gold {
  background: var(--gold);
  color: var(--primary-dark);
}
.badge-gold-soft {
  background: rgba(212, 175, 125, 0.18);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 125, 0.4);
}
.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}
.badge-success { background: #d6f3e2; color: var(--success); }
.badge-warning { background: #fef0d6; color: var(--warning); }
.badge-error   { background: #ffe0e0; color: var(--error); }

/* Toast */
.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  color: var(--text-dark);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  min-width: 260px;
  pointer-events: auto;
  animation: toast-in 0.3s var(--t-spring);
}
.toast.error    { border-color: var(--error); }
.toast.success  { border-color: var(--success); }
.toast.warning  { border-color: var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 23, 41, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fade-in 0.2s ease;
  padding: 16px;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.25s var(--t-spring);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* Utilitários */
.row { display: flex; gap: var(--space-base); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.gap-sm { gap: var(--space-sm); }
.row.gap-lg { gap: var(--space-lg); }
.col { display: flex; flex-direction: column; gap: var(--space-base); }
.grow { flex: 1; }
.center { display: flex; align-items: center; justify-content: center; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.hidden { display: none !important; }
