@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* Paleta extraída da identidade visual do Ateliê Larissa Gama */
  --wine-900: #34001a;
  --wine-800: #55002a;
  --wine-700: #7a2540;
  --wine-600: #93384f;
  --rose-400: #ba9aa9;
  --rose-300: #d3b7c2;
  --rose-100: #f0dee3;
  --blush-50: #fbf1f3;
  --champagne: #e8cf9f;
  --ink: #2e0e18;
  --white: #ffffff;
  --ok: #6e8f6a;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-soft: 0 12px 32px rgba(85, 0, 42, 0.14);
  --shadow-close: 0 4px 12px rgba(85, 0, 42, 0.1);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--blush-50);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  color: var(--wine-800);
  margin: 0;
}

a { color: inherit; }

button, input, select {
  font-family: inherit;
}

:focus-visible {
  outline: 3px solid var(--wine-600);
  outline-offset: 2px;
}

.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 800;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--wine-700), var(--wine-800));
  color: var(--rose-100);
  box-shadow: var(--shadow-close);
}
.btn-primary:hover { box-shadow: var(--shadow-soft); }

.btn-ghost {
  background: transparent;
  color: var(--wine-800);
  border: 2px solid var(--rose-300);
}
.btn-ghost:hover { background: var(--rose-100); }

.btn-google {
  background: var(--white);
  color: var(--ink);
  border: 1.5px solid var(--rose-300);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.btn-danger {
  background: transparent;
  color: #93384f;
  border: 2px solid #e4b9c4;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}
.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--wine-700);
  letter-spacing: 0.02em;
}
.field input {
  border: 2px solid var(--rose-100);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--ink);
}
.field input:focus {
  border-color: var(--rose-400);
}

.error-text {
  color: #a0264a;
  background: #fbe4ea;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  display: none;
}
.error-text.show { display: block; }

/* ---------- Tela de acesso (login/cadastro) ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-visual {
  background: radial-gradient(circle at 30% 20%, var(--wine-700), var(--wine-900) 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
.auth-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--rose-300) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
  opacity: 0.12;
}
.auth-visual img.mascote {
  max-width: 280px;
  width: 60%;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.35));
  z-index: 1;
  animation: float 5s ease-in-out infinite;
}
.auth-visual .brand-line {
  z-index: 1;
  text-align: center;
  margin-top: 24px;
  color: var(--rose-100);
}
.auth-visual .brand-line .display { color: var(--rose-100); font-size: 1.6rem; }
.auth-visual .brand-line span {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  color: var(--champagne);
  margin-top: 6px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 1.7rem; margin-bottom: 4px; }
.auth-card .subtitle {
  color: var(--wine-600);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.tab-switch {
  display: flex;
  background: var(--rose-100);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 26px;
}
.tab-switch button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--wine-700);
  cursor: pointer;
  font-family: var(--font-body);
}
.tab-switch button.active {
  background: var(--wine-800);
  color: var(--white);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--rose-400);
  font-size: 0.8rem;
  font-weight: 700;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rose-100);
}

/* ---------- App shell (cliente e admin) ---------- */
.app-header {
  background: var(--wine-800);
  color: var(--rose-100);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.app-header .brand img { width: 34px; height: 34px; border-radius: 50%; }
.app-header .header-actions { display: flex; align-items: center; gap: 12px; }
.app-header .header-actions button {
  background: transparent;
  border: 1.5px solid rgba(240,222,227,0.5);
  color: var(--rose-100);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.page-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---------- Cartão de boas-vindas da cliente ---------- */
.welcome-card {
  background: linear-gradient(135deg, var(--white), var(--rose-100));
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: var(--shadow-close);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.welcome-card h2 { font-size: 1.5rem; }
.welcome-card .meta {
  color: var(--wine-700);
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 6px;
}
.welcome-card .progress-pill {
  background: var(--wine-800);
  color: var(--rose-100);
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

/* ---------- Pulseira de emblemas ---------- */
.bracelet-section {
  margin-top: 32px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px 26px;
  box-shadow: var(--shadow-close);
  position: relative;
  overflow: hidden;
}
.bracelet-section h3 {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 6px;
}
.bracelet-section .hint {
  text-align: center;
  color: var(--wine-600);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.bracelet {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  position: relative;
  padding: 10px 0 6px;
}
.bracelet::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--rose-300) 0 8px, transparent 8px 16px);
  z-index: 0;
}

.emblema {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rose-100);
  border: 3px solid var(--rose-100);
  box-shadow: var(--shadow-close);
  transition: transform 0.25s ease;
}
.emblema img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(100%) brightness(1.15) opacity(0.55);
  transition: filter 0.4s ease;
}
.emblema.ganho {
  border-color: var(--champagne);
  animation: pop 0.5s ease;
}
.emblema.ganho img {
  filter: none;
}
.emblema.ganho::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--champagne);
  opacity: 0.7;
}

@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ---------- Cartão do QR Code ---------- */
.qr-card {
  margin-top: 24px;
  background: var(--wine-800);
  color: var(--rose-100);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  background-image: radial-gradient(circle at 90% -10%, var(--wine-600), transparent 55%);
}
.qr-card h3 { color: var(--rose-100); font-size: 1.15rem; margin-bottom: 4px; }
.qr-card p { margin: 0 0 20px; color: var(--rose-300); font-size: 0.9rem; }
.qr-card .qr-frame {
  background: var(--blush-50);
  display: inline-block;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 3px dashed var(--rose-300);
}
.qr-card img { width: 220px; height: 220px; display: block; border-radius: 8px; }

/* ---------- Celebração ---------- */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(52, 0, 26, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.celebration-overlay.show { display: flex; }
.celebration-card {
  background: var(--blush-50);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 380px;
  position: relative;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}
.celebration-card img.mascote { width: 140px; margin-bottom: 12px; }
.celebration-card h2 { font-size: 1.6rem; margin-bottom: 10px; }
.celebration-card p { color: var(--wine-700); font-weight: 600; margin-bottom: 24px; }

.confetti {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(360deg); opacity: 1; }
}

/* ---------- Admin ---------- */
.admin-toolbar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.admin-toolbar .search-box {
  flex: 1;
  min-width: 220px;
}
.admin-toolbar .search-box input {
  width: 100%;
  border: 2px solid var(--rose-100);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.95rem;
  background: var(--white);
}

.stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.stat-chip {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px 22px;
  box-shadow: var(--shadow-close);
  flex: 1;
  min-width: 140px;
}
.stat-chip .num { font-family: var(--font-display); font-size: 1.7rem; color: var(--wine-800); }
.stat-chip .label { font-size: 0.8rem; color: var(--wine-600); font-weight: 700; }

.client-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.client-row {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-close);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.client-row:hover { transform: translateY(-2px); }
.client-row .info strong { display: block; color: var(--wine-800); font-size: 1.02rem; }
.client-row .info span { color: var(--wine-600); font-size: 0.85rem; }
.mini-dots { display: flex; gap: 4px; }
.mini-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rose-100);
  display: inline-block;
}
.mini-dots i.on { background: var(--wine-700); }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--wine-600);
}

/* Modal genérico */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(52,0,26,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: var(--blush-50);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--wine-700);
}
.modal-card h3 { margin-bottom: 4px; }
.modal-card .modal-sub { color: var(--wine-600); font-size: 0.9rem; margin-bottom: 20px; }

.emblema.toggle { cursor: pointer; width: 56px; height: 56px; }
.emblema.toggle:hover { transform: scale(1.05); }

#qr-reader { border-radius: var(--radius-md); overflow: hidden; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--wine-800);
  color: var(--rose-100);
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 200;
  box-shadow: var(--shadow-soft);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading-note {
  text-align: center;
  color: var(--wine-600);
  padding: 30px;
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { padding: 30px 20px 20px; }
  .auth-visual img.mascote { max-width: 160px; }
  .welcome-card { flex-direction: column; align-items: flex-start; }
  .emblema { width: 60px; height: 60px; }
}
