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

:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --text: #e8e8f0;
  --text-muted: #9a9ab0;
  --primary: #e94560;
  --primary-hover: #d63050;
  --secondary: #533483;
  --accent: #16213e;
  --success: #00c9a7;
  --warning: #ffc93c;
  --error: #ff6b6b;
  --border: #2a2a45;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --transition: 0.2s ease;
}

/* Theme variants */
.theme-winter { --primary: #4fc3f7; --primary-hover: #29b6f6; --secondary: #1565c0; --bg-card: #1a2332; }
.theme-elegant { --primary: #d4af37; --primary-hover: #c9a030; --secondary: #8b6914; --bg-card: #1a1a1a; }
.theme-fun { --primary: #ff6b9d; --primary-hover: #ff5089; --secondary: #c44dff; --bg-card: #1e1e3a; }
.theme-minimal { --primary: #555; --primary-hover: #333; --secondary: #888; --bg: #f5f5f5; --bg-card: #fff; --text: #222; --text-muted: #666; --border: #ddd; }

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* RTL */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .nav-inner { flex-direction: row-reverse; }
[dir="rtl"] .nav-links { flex-direction: row-reverse; }
[dir="rtl"] .participant-row { flex-direction: row-reverse; }
[dir="rtl"] .exclusion-row { flex-direction: row-reverse; }
[dir="rtl"] .share-buttons { flex-direction: row-reverse; }
[dir="rtl"] .link-box { flex-direction: row-reverse; }
[dir="rtl"] .chat-mine { flex-direction: row-reverse; }
[dir="rtl"] .input-with-select { flex-direction: row-reverse; }

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

/* ─── Layout ─── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 680px; }
.text-center { text-align: center; }

/* ─── Nav ─── */
.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo:hover { text-decoration: none; color: var(--primary); }
.logo-icon { font-size: 1.8rem; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav-links a { color: var(--text-muted); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.lang-select {
  background: var(--accent);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  gap: 0.5rem;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--accent); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1.1rem; }
.btn-full { width: 100%; }
.btn-remove {
  background: none; border: none; color: var(--error); font-size: 1.3rem;
  cursor: pointer; padding: 0 0.5rem; line-height: 1;
}

/* ─── Hero ─── */
.hero {
  position: relative;
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--accent) 50%, var(--secondary) 100%);
  overflow: hidden;
}
.hero-content { text-align: center; position: relative; z-index: 2; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Snowflakes */
.hero-decoration { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.snowflake {
  position: absolute;
  color: rgba(255,255,255,0.15);
  animation: snowfall linear infinite;
  font-size: 1.5rem;
}
.sf-1 { left: 10%; animation-duration: 8s; font-size: 2rem; top: -20px; }
.sf-2 { left: 30%; animation-duration: 12s; animation-delay: 2s; top: -20px; }
.sf-3 { left: 55%; animation-duration: 10s; animation-delay: 4s; font-size: 1.8rem; top: -20px; }
.sf-4 { left: 75%; animation-duration: 9s; animation-delay: 1s; top: -20px; }
.sf-5 { left: 90%; animation-duration: 11s; animation-delay: 3s; font-size: 2.2rem; top: -20px; }

@keyframes snowfall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(calc(100vh + 20px)) rotate(360deg); opacity: 0; }
}

/* ─── How it Works ─── */
.section { padding: 3rem 0; }
.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-subtitle {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.step {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.step-number {
  width: 50px; height: 50px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}
.step h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.step p { color: var(--text-muted); font-size: 0.95rem; }

/* ─── Features ─── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: all var(--transition);
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; }

/* ─── Forms ─── */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-weight: 500; font-size: 0.95rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

input[type="text"], input[type="date"], input[type="email"],
select, textarea {
  background: var(--accent);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-family: var(--font);
  font-size: 0.95rem;
  width: 100%;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }

.input-with-select {
  display: flex;
  gap: 0;
}
.input-with-select input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  flex: 1;
}
.input-with-select select {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  width: auto;
  min-width: 100px;
  border-left: none;
}
[dir="rtl"] .input-with-select input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
[dir="rtl"] .input-with-select select {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-left: 1px solid var(--border);
  border-right: none;
}

.participant-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}
.participant-row input { flex: 1; }

.exclusion-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.exclusion-row select { flex: 1; min-width: 120px; }
.exclusion-arrow { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }

.checkbox-group { margin-top: 0.5rem; }
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 20px; height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}
.help-text { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.exclusions-section summary {
  cursor: pointer;
  font-weight: 500;
  padding: 0.5rem 0;
}

/* ─── Alerts ─── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.alert-success { background: rgba(0,201,167,0.15); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(255,107,107,0.15); border: 1px solid var(--error); color: var(--error); }
.alert-warning { background: rgba(255,201,60,0.1); border: 1px solid var(--warning); color: var(--warning); }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title { font-size: 1.2rem; margin-bottom: 1rem; }

/* ─── Manage Page ─── */
.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }

.exchange-info {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.info-item { color: var(--text-muted); }
.info-badge {
  display: inline-block;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.participants-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}
.participant-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.participant-info h3 { margin-bottom: 0.25rem; }
.participant-info .assignment { color: var(--text-muted); font-size: 0.9rem; }
.participant-actions { margin-top: 0.75rem; }

.link-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.link-input {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.5rem;
  background: var(--accent);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.share-btn {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: #fff;
}
.share-whatsapp { background: #25d366; }
.share-telegram { background: #0088cc; }
.share-email { background: #555; }
.share-sms { background: #ff9500; }
.share-btn:hover { opacity: 0.9; text-decoration: none; }

.manage-actions { margin-bottom: 1.5rem; }
.manage-tip { font-size: 0.9rem; }
.inline-form { display: inline; }

/* ─── Reveal Page ─── */
.reveal-page { padding-top: 2rem; }
.reveal-greeting { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1rem; }

.countdown {
  text-align: center;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.reveal-card {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  margin: 2rem 0;
  text-align: center;
  min-height: 200px;
}
.reveal-front { padding: 1rem; }
.gift-icon { font-size: 4rem; margin-bottom: 1.5rem; animation: gift-bounce 2s ease infinite; }

@keyframes gift-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.reveal-btn { font-size: 1.1rem; }
.reveal-back { padding: 1rem; }
.reveal-label { color: var(--text-muted); margin-bottom: 0.5rem; }
.reveal-name {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.reveal-animate {
  animation: reveal-in 0.6s ease-out;
}
@keyframes reveal-in {
  0% { opacity: 0; transform: scale(0.8) rotateY(90deg); }
  100% { opacity: 1; transform: scale(1) rotateY(0); }
}

/* ─── Wish List ─── */
.wishlist-view {
  background: var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1rem;
  text-align: left;
}
[dir="rtl"] .wishlist-view { text-align: right; }
.wishlist-view h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.wishlist-content { white-space: pre-wrap; color: var(--text-muted); }
.no-wishlist { color: var(--text-muted); font-style: italic; }

/* ─── Chat ─── */
.chat-messages {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-empty { color: var(--text-muted); text-align: center; font-style: italic; }
.chat-msg { display: flex; }
.chat-mine { justify-content: flex-end; }
.chat-theirs { justify-content: flex-start; }
.chat-bubble {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}
.chat-mine .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-theirs .chat-bubble { background: var(--accent); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
[dir="rtl"] .chat-mine .chat-bubble { border-bottom-right-radius: var(--radius); border-bottom-left-radius: 4px; }
[dir="rtl"] .chat-theirs .chat-bubble { border-bottom-left-radius: var(--radius); border-bottom-right-radius: 4px; }
.chat-sender { font-size: 0.75rem; font-weight: 600; opacity: 0.8; display: block; margin-bottom: 0.25rem; }
.chat-bubble p { margin: 0; font-size: 0.95rem; }
.chat-time { font-size: 0.7rem; opacity: 0.6; display: block; margin-top: 0.25rem; }

.chat-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.chat-form input { flex: 1; }

/* ─── Gift Ideas ─── */
.gift-ideas-card { text-align: center; }
.gift-ideas-card .btn { margin-bottom: 0.75rem; }
.affiliate-disclosure { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.5rem; }

/* ─── Error Page ─── */
.error-page { padding: 4rem 0; }
.error-icon { font-size: 4rem; margin-bottom: 1.5rem; }
.error-page h1 { margin-bottom: 1.5rem; }

/* ─── Legal Pages ─── */
.legal-page h1 { margin-bottom: 0.5rem; }
.legal-page h2 { margin-top: 2rem; margin-bottom: 0.5rem; font-size: 1.2rem; }
.legal-page p, .legal-page ul { margin-bottom: 1rem; color: var(--text-muted); }
.legal-page ul { padding-left: 1.5rem; }
[dir="rtl"] .legal-page ul { padding-left: 0; padding-right: 1.5rem; }

/* ─── Footer ─── */
.footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer p { color: var(--text-muted); font-size: 0.85rem; }
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a { color: var(--text-muted); font-size: 0.85rem; }

/* ─── Ad Slot ─── */
.ad-slot { margin: 2rem 0; text-align: center; }

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .hero { padding: 3rem 0; }
  .hero-title { font-size: 2rem; }
  .nav-links { gap: 0.75rem; }
  .nav-links a:first-child { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
  .share-buttons { justify-content: center; }
  .link-box { flex-direction: column; }
}
