/* ============================================================
   LATAFE Coupon System v4.0 — CSS Variables + Mobile-first
   Tất cả màu/font đọc từ CSS variables (Site Builder override)
   ============================================================ */

:root {
  --primary:      #1A1A1A;
  --accent:       #C9A96E;
  --bg:           #FDF8F2;
  --surface:      #FFFFFF;
  --muted:        #718096;
  --error:        #E53E3E;
  --success:      #38A169;
  --warning:      #DD6B20;
  --border:       #E2E8F0;
  --radius:       12px;
  --radius-lg:    20px;
  --shadow:       0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.12);
  --font-body:    'Poppins', sans-serif;
  --font-heading: 'Playfair Display', serif;
  --transition:   0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── App container ──────────────────────────────────────────── */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 40px 0;
}

/* ── Section router ─────────────────────────────────────────── */
.section { display: none; width: 100%; max-width: 480px; padding: 16px; }
.section.active { display: flex; flex-direction: column; }

/* ── Hotline banner ─────────────────────────────────────────── */
.hotline-banner {
  width: 100%;
  max-width: 480px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}
.hotline-text { color: var(--accent); text-decoration: none; font-size: 1rem; font-weight: 700; }
.hotline-slogan { color: rgba(255,255,255,0.75); font-size: 0.78rem; font-weight: 400; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 100%;
}
.card-header {
  background: var(--primary);
  padding: 28px 24px 20px;
  text-align: center;
  color: #fff;
}
.card-header h1, .card-header h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  margin-top: 12px;
  line-height: 1.3;
}
.card-header h1 { font-size: 1.8rem; color: var(--accent); }
.card-header h2 { font-size: 1.2rem; }
.logo { height: 70px; object-fit: contain; }
.logo-fallback { color: var(--accent); font-family: var(--font-heading); font-size: 1.8rem; margin-top: 0; }
.card-body { padding: 24px 20px; }

.card-incident .card-header { background: linear-gradient(135deg,#c53030 0%,#e53e3e 100%); }
.incident-commitment {
  display: inline-block; margin-top: 8px;
  background: rgba(255,255,255,0.15); border-radius: 20px;
  padding: 4px 12px; font-size: 0.82rem; color: #fff;
}

.home-subtitle, .section-subtitle {
  color: rgba(255,255,255,0.8); font-size: 0.88rem; margin-top: 8px; line-height: 1.6;
}

/* ── Action buttons (Home) ─────────────────────────────────── */
.action-buttons { display: flex; flex-direction: column; gap: 14px; }
.btn-action {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px 20px; border: 2px solid transparent;
  border-radius: var(--radius); cursor: pointer; text-align: left;
  transition: transform var(--transition), box-shadow var(--transition);
  font-family: var(--font-body);
}
.btn-action:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.12); }
.btn-action:active { transform: translateY(0); }
.btn-action-primary { background: var(--accent); color: var(--primary); border-color: var(--accent); }
.btn-action-secondary { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-action-secondary:hover { border-color: var(--accent); }
.btn-action-icon { font-size: 1.8rem; flex-shrink: 0; }
.btn-action-label { display: flex; flex-direction: column; gap: 2px; }
.btn-action-label strong { font-size: 1rem; font-weight: 700; }
.btn-action-label span { font-size: 0.78rem; opacity: 0.75; }
a.btn-action { text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%; padding: 14px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; margin-top: 16px; text-align: center; text-decoration: none;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-google { background: #1a73e8; }
.btn-incident-submit { background: #e53e3e; margin-top: 20px; }
.btn-skip {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 20px; width: 100%; margin-top: 10px;
  cursor: pointer; color: var(--muted); font-size: 0.88rem;
  font-family: var(--font-body); transition: border-color var(--transition);
}
.btn-skip:hover { border-color: var(--accent); color: var(--primary); }
.btn-copy {
  background: var(--accent); color: var(--primary);
  border: none; border-radius: var(--radius);
  padding: 10px 24px; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; font-family: var(--font-body); transition: opacity var(--transition);
}
.btn-copy:hover { opacity: 0.85; }
.back-btn {
  background: none; border: none; color: var(--muted);
  font-size: 0.88rem; cursor: pointer; padding: 0;
  margin-bottom: 16px; font-family: var(--font-body);
}
.back-btn:hover { color: var(--primary); }

/* ── Rating groups ──────────────────────────────────────────── */
.rating-groups { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.rating-group {
  background: var(--bg); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--border);
}
.rating-group-label { display: block; font-weight: 600; margin-bottom: 10px; font-size: 0.95rem; }
.star-rating {
  display: flex; justify-content: center; gap: 6px;
  font-size: 2.2rem; cursor: pointer;
}
.star-rating .star { color: #d4d4d4; transition: color 0.12s, transform 0.12s; user-select: none; line-height: 1; }
.star-rating .star.active, .star-rating .star.hover { color: #f6c90e; transform: scale(1.15); }
.rating-hint { display: block; text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 6px; min-height: 18px; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 0.95rem; font-family: var(--font-body);
  color: var(--primary); background: var(--surface); outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--error); }
.field-error { display: block; color: var(--error); font-size: 0.78rem; margin-top: 4px; min-height: 16px; }
.required { color: var(--error); }
.optional { color: var(--muted); font-weight: 400; font-size: 0.78rem; }
.hp-field { position: absolute; left: -9999px; visibility: hidden; }

/* ── Upload area ─────────────────────────────────────────────── */
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.btn-upload {
  background: var(--bg); border: 1.5px solid var(--accent); border-radius: 8px;
  padding: 8px 20px; cursor: pointer; color: var(--primary); font-weight: 600;
  font-family: var(--font-body); font-size: 0.88rem; margin-bottom: 10px;
}
.btn-upload:hover { background: var(--accent); }
.upload-hint { color: var(--muted); font-size: 0.75rem; margin-top: 8px; }
.photo-previews { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.photo-preview-item { position: relative; width: 80px; height: 80px; }
.photo-preview-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 2px solid var(--border); }
.photo-remove {
  position: absolute; top: -6px; right: -6px;
  background: var(--error); color: #fff; border: none; border-radius: 50%;
  width: 20px; height: 20px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1;
}

/* ── Alert ──────────────────────────────────────────────────── */
.alert { border-radius: 8px; padding: 10px 14px; font-size: 0.88rem; margin-bottom: 14px; }
.alert-error { background: #FFF5F5; color: #C53030; border: 1px solid #FEB2B2; }
.alert-success { background: #F0FFF4; color: #276749; border: 1px solid #9AE6B4; }

/* ── Loader ─────────────────────────────────────────────────── */
.loader { display: none; text-align: center; padding: 12px 0; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite; margin: 0 auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader p { color: var(--muted); font-size: 0.88rem; }

/* ── Coupon card ─────────────────────────────────────────────── */
.coupon-card {
  background: var(--bg); border: 2px dashed var(--accent);
  border-radius: var(--radius); padding: 24px; text-align: center; margin-bottom: 16px;
}
.coupon-card .greeting { color: var(--muted); font-size: 0.82rem; margin-bottom: 4px; }
.coupon-card .customer-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 12px; }
.coupon-card .code-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.coupon-card .code { color: var(--accent); font-size: 2rem; font-weight: 800; letter-spacing: 4px; margin-bottom: 8px; }
.dashed-divider { border: none; border-top: 1px dashed var(--border); margin: 12px 0; }
.coupon-card .expires { color: var(--muted); font-size: 0.82rem; }
.save-note { text-align: center; color: var(--muted); font-size: 0.82rem; line-height: 1.6; margin-top: 12px; }

/* ── Thank you card ─────────────────────────────────────────── */
.thankyou-card { text-align: center; padding: 8px 0; }
.thankyou-card h3 { font-family: var(--font-heading); font-size: 1.3rem; margin-bottom: 12px; }
.thankyou-card p { color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.thiep-img { width: 100%; max-width: 320px; border-radius: var(--radius); margin-bottom: 16px; }
.quote-box { background: var(--bg); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; border-left: 3px solid var(--accent); }
.quote-box p { color: var(--accent); font-style: italic; font-size: 0.9rem; margin: 0; }
.icon-big { font-size: 56px; margin-bottom: 12px; }

/* ── Info & commitment boxes ─────────────────────────────────── */
.info-box { background: var(--bg); border-radius: var(--radius); padding: 16px; margin: 16px 0; border: 1px solid var(--accent); }
.commitment-box {
  background: #F0FFF4; border-radius: var(--radius); padding: 14px 18px;
  margin-top: 16px; border: 1px solid #9AE6B4; color: #276749; font-size: 0.9rem; font-weight: 600;
}

/* ── Footer & notes ─────────────────────────────────────────── */
.footer { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 16px; padding-bottom: 8px; }
.form-note { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 12px; line-height: 1.5; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 480px) {
  .section { padding: 24px 16px; }
  .card-body { padding: 28px 28px; }
  .card-header { padding: 32px 28px 24px; }
  .card-header h2 { font-size: 1.3rem; }
  .star-rating { gap: 10px; font-size: 2.6rem; }
}
@media (max-width: 360px) {
  .star-rating { font-size: 1.9rem; gap: 4px; }
  .card-body { padding: 18px 14px; }
  .btn-primary { font-size: 0.93rem; }
}
