/* =====================================================
   Plataforma de Rifas — sistema de design
   Filosofia: editorial / refinado. Tipografia forte,
   neutros com 1 cor de marca, alto contraste, mobile-first.
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800;900&family=Fraunces:wght@600;700;800;900&display=swap');

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --secondary: #818cf8;

  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  --text: #0c0a09;
  --text-soft: #44403c;
  --text-mute: #78716c;

  --ok: #059669;
  --ok-bg: #d1fae5;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --err: #dc2626;
  --err-bg: #fee2e2;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px -4px rgba(12, 10, 9, 0.08), 0 2px 6px -2px rgba(12, 10, 9, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(12, 10, 9, 0.18);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 720px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.97rem;
  background: var(--primary);
  color: white;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text); }
.btn-danger { background: var(--err); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-ok { background: var(--ok); }
.btn-ok:hover:not(:disabled) { background: #047857; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 0.85rem; }
.btn-lg { padding: 17px 28px; font-size: 1.05rem; }

/* === FORM === */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.field input, .field textarea, .field select {
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
.field textarea { min-height: 100px; resize: vertical; font-family: var(--font-body); }
.field .hint { font-size: 0.78rem; color: var(--text-mute); }
.field-error { color: var(--err); font-size: 0.83rem; margin-top: -8px; margin-bottom: 12px; }

.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 540px) { .field-row { grid-template-columns: 1fr; } }

/* === CARD === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-pad-lg { padding: 32px; }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.01em; }
.badge-paid { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-expired { background: #f3f4f6; color: #6b7280; }
.badge-cancelled { background: var(--err-bg); color: var(--err); }
.badge-finished { background: var(--primary-soft); color: var(--primary); }

/* === MODAL === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(12, 10, 9, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal h3 { margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* === TOAST === */
#toasts { position: fixed; top: 16px; right: 16px; left: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
@media (min-width: 640px) { #toasts { left: auto; max-width: 380px; } }
.toast {
  pointer-events: auto;
  background: var(--text);
  color: white;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.toast-ok { background: var(--ok); }
.toast.toast-err { background: var(--err); }
.toast.toast-warn { background: var(--warn); }

/* === ANIM === */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
@keyframes spin { to { transform: rotate(360deg); } }

/* === SPINNER === */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-dark { border-color: rgba(0, 0, 0, 0.15); border-top-color: var(--text); }

/* === Utility === */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; } .gap { gap: 14px; } .gap-lg { gap: 22px; }
.mt-sm { margin-top: 8px; } .mt { margin-top: 16px; } .mt-lg { margin-top: 32px; }
.mb-sm { margin-bottom: 8px; } .mb { margin-bottom: 16px; } .mb-lg { margin-bottom: 32px; }
.text-mute { color: var(--text-mute); }
.text-sm { font-size: 0.88rem; }
.text-xs { font-size: 0.78rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* === Skeleton loader === */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #ebebe9 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
