/* ═══════════════════════════════════════════════════════════
   SML Birthday SaaS — CSS v6
   Design : Fond blanc · Texte noir · Interface propre moderne
   ═══════════════════════════════════════════════════════════ */

:root {
  --sml-primary:   #0f172a;
  --sml-accent:    #f59e0b;
  --sml-pink:      #ec4899;
  --sml-green:     #16a34a;
  --sml-wa:        #25D366;
  --sml-bg:        #ffffff;
  --sml-surface:   #f8fafc;
  --sml-border:    #e2e8f0;
  --sml-text:      #0f172a;
  --sml-muted:     #64748b;
  --sml-radius:    16px;
  --sml-shadow:    0 4px 24px rgba(0,0,0,.08);
}

/* ── Reset body ──────────────────────────────────────────── */
.sml-bday-body,
.sml-bday-view-body {
  background: var(--sml-bg);
  color: var(--sml-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.sml-bday-app,
.sml-bday-view-app {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ── Panel (carte blanche) ───────────────────────────────── */
.sml-bday-panel {
  background: var(--sml-bg);
  border: 1px solid var(--sml-border);
  border-radius: var(--sml-radius);
  padding: 32px 28px;
  margin-bottom: 24px;
  box-shadow: var(--sml-shadow);
}

.sml-bday-panel-header { text-align: center; margin-bottom: 28px; }
.sml-bday-panel-header h2 { color: var(--sml-text); margin: 10px 0 6px; font-size: 22px; font-weight: 700; }
.sml-bday-panel-header p  { color: var(--sml-muted); margin: 0; font-size: 14px; }

.sml-bday-panel-error { border-color: #fecaca; text-align: center; }
.sml-bday-panel-error h2 { color: #dc2626; }

.sml-bday-icon { font-size: 52px; margin-bottom: 8px; }

/* ── Loading ─────────────────────────────────────────────── */
.sml-bday-loading { text-align: center; padding: 80px 20px; color: var(--sml-muted); }
.sml-bday-spinner {
  font-size: 52px;
  display: inline-block;
  animation: sml-cake-bounce 1.6s ease-in-out infinite;
}
@keyframes sml-cake-bounce {
  0%,100% { transform: translateY(0) rotate(-5deg); }
  50%      { transform: translateY(-12px) rotate(5deg); }
}

/* ── Champs ──────────────────────────────────────────────── */
.sml-bday-field { margin-bottom: 20px; }
.sml-bday-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--sml-text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.sml-bday-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--sml-surface);
  border: 1.5px solid var(--sml-border);
  border-radius: 10px;
  color: var(--sml-text);
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s, box-shadow .2s;
}
.sml-bday-input:focus {
  border-color: var(--sml-accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}
.sml-bday-input-otp {
  font-size: 30px;
  text-align: center;
  letter-spacing: 10px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
}
.sml-bday-textarea {
  width: 100%;
  padding: 13px 16px;
  background: var(--sml-surface);
  border: 1.5px solid var(--sml-border);
  border-radius: 10px;
  color: var(--sml-text);
  font-size: 15px;
  resize: vertical;
  min-height: 100px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s;
}
.sml-bday-textarea:focus { border-color: var(--sml-accent); }
.sml-bday-textarea-sm { min-height: 70px; }

/* ── Boutons ─────────────────────────────────────────────── */
.sml-bday-btn {
  display: inline-block;
  padding: 13px 22px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all .18s;
  margin: 6px 0;
}
.sml-bday-btn-primary {
  background: var(--sml-primary);
  color: #fff;
  display: block;
  width: 100%;
}
.sml-bday-btn-primary:hover { background: #1e293b; transform: translateY(-1px); }
.sml-bday-btn-lg { padding: 16px 24px; font-size: 17px; }
.sml-bday-btn-ghost {
  background: var(--sml-surface);
  border: 1.5px solid var(--sml-border);
  color: var(--sml-muted);
  display: block;
  width: 100%;
}
.sml-bday-btn-ghost:hover { border-color: #94a3b8; color: var(--sml-text); }
.sml-bday-btn-wa {
  background: var(--sml-wa);
  color: #fff;
  display: block;
  width: 100%;
}
.sml-bday-btn-wa:hover { background: #1ebe5d; }

/* ── Alerte ──────────────────────────────────────────────── */
.sml-bday-alert {
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin: 10px 0;
}
.sml-bday-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.sml-required { color: var(--sml-pink); }
.sml-hint { color: var(--sml-muted); font-size: 12px; margin: 4px 0; }

/* ── Badge WhatsApp ──────────────────────────────────────── */
.sml-wa-badge {
  display: inline-block;
  background: rgba(22,163,74,.08);
  border: 1px solid rgba(22,163,74,.25);
  color: var(--sml-green);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin: 8px 0;
}

/* ── Lien WhatsApp OTP ───────────────────────────────────── */
.sml-wa-link-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin: 12px 0;
}
.sml-wa-link-box p { color: var(--sml-muted); margin: 0 0 10px; font-size: 13px; }

/* ── Upload Média ────────────────────────────────────────── */
.sml-media-upload-zone {
  border: 2px dashed var(--sml-border);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--sml-surface);
  color: var(--sml-muted);
  position: relative;
}
.sml-media-upload-zone:hover,
.sml-media-upload-zone.sml-drag-over {
  border-color: var(--sml-accent);
  background: #fffbeb;
}
.sml-media-preview-el {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 10px;
}
.sml-media-remove-btn {
  margin-top: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.sml-progress-bar {
  height: 6px;
  background: var(--sml-border);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
.sml-progress-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--sml-accent), var(--sml-pink));
  border-radius: 3px;
  transition: width .3s;
}

/* ── Templates ───────────────────────────────────────────── */
.sml-bday-templates { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.sml-tpl-card {
  background: var(--sml-surface);
  border: 2px solid var(--sml-border);
  border-radius: 12px;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  font-size: 12px;
  color: var(--sml-muted);
  font-weight: 500;
}
.sml-tpl-card input { display: none; }
.sml-tpl-card:hover, .sml-tpl-selected {
  border-color: var(--sml-accent);
  color: var(--sml-text);
  background: #fffbeb;
}
.sml-tpl-preview { display: block; font-size: 30px; margin-bottom: 6px; }

/* ── Résultat ────────────────────────────────────────────── */
.sml-result-card {
  background: var(--sml-surface);
  border: 1px solid var(--sml-border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.sml-result-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sml-muted);
  margin-bottom: 10px;
}
.sml-copy-row { display: flex; gap: 8px; align-items: center; }
.sml-copy-row .sml-bday-input { flex: 1; margin: 0; }
.sml-copy-btn {
  padding: 13px 14px;
  background: var(--sml-surface);
  border: 1.5px solid var(--sml-border);
  color: var(--sml-text);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  white-space: nowrap;
  transition: background .15s;
}
.sml-copy-btn:hover { background: #e2e8f0; }
.sml-mono { font-family: 'Courier New', monospace; font-size: 13px; }

.sml-bday-expiry-info {
  text-align: center;
  padding: 16px;
  color: var(--sml-muted);
  font-size: 14px;
  line-height: 1.7;
}

/* ── Partage ─────────────────────────────────────────────── */
.sml-share-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.sml-share-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  min-width: 90px;
  transition: opacity .15s;
}
.sml-share-btn:hover { opacity: .88; }
.sml-share-wa { background: #25D366; }
.sml-share-tg { background: #0088cc; }
.sml-share-fb { background: #1877f2; }

/* ════ PAGE VUE ════════════════════════════════════════════ */

/* Média en haut */
.sml-bday-media-section { margin-bottom: 24px; }
.sml-bday-media-el {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--sml-radius);
  box-shadow: var(--sml-shadow);
  display: block;
}

/* Musique */
.sml-bday-music-bar { text-align: right; padding: 12px 0 0; }
.sml-bday-music-bar button {
  background: var(--sml-surface);
  border: 1px solid var(--sml-border);
  color: var(--sml-text);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.sml-bday-music-bar button:hover { background: #e2e8f0; }

/* Hero */
.sml-bday-hero {
  position: relative;
  text-align: center;
  padding: 60px 20px 48px;
  overflow: hidden;
  background: linear-gradient(135deg, #fffbeb 0%, #fff0f6 100%);
  border-radius: var(--sml-radius);
  margin-bottom: 24px;
  border: 1px solid var(--sml-border);
}

/* Ballons — animation infinie */
.sml-bday-balloons {
  position: absolute;
  top: 0; left: 0; width: 100%;
  display: flex;
  justify-content: space-around;
  pointer-events: none;
}
.sml-balloon {
  font-size: 36px;
  display: inline-block;
  animation: sml-balloon-float var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--del, 0s);
}
.sml-balloon:nth-child(1) { --dur:3.0s; --del:0.0s; }
.sml-balloon:nth-child(2) { --dur:3.4s; --del:0.5s; }
.sml-balloon:nth-child(3) { --dur:2.8s; --del:1.0s; }
.sml-balloon:nth-child(4) { --dur:3.6s; --del:0.3s; }
.sml-balloon:nth-child(5) { --dur:3.2s; --del:0.8s; }
@keyframes sml-balloon-float {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-18px) rotate(3deg); }
}

/* Étoiles scintillantes — animation infinie */
.sml-bday-stars {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.sml-star {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--sml-accent);
  border-radius: 50%;
  animation: sml-star-twinkle var(--dur, 2s) ease-in-out infinite;
  animation-delay: var(--del, 0s);
  left: var(--x, 50%); top: var(--y, 50%);
  opacity: 0;
}
.sml-star:nth-child(1)  { --dur:2.1s; --del:0.0s; --x:5%;  --y:20%; }
.sml-star:nth-child(2)  { --dur:1.8s; --del:0.4s; --x:15%; --y:70%; }
.sml-star:nth-child(3)  { --dur:2.4s; --del:0.8s; --x:25%; --y:35%; }
.sml-star:nth-child(4)  { --dur:1.9s; --del:0.2s; --x:35%; --y:80%; }
.sml-star:nth-child(5)  { --dur:2.6s; --del:0.6s; --x:45%; --y:15%; }
.sml-star:nth-child(6)  { --dur:2.0s; --del:1.0s; --x:55%; --y:60%; }
.sml-star:nth-child(7)  { --dur:2.3s; --del:0.3s; --x:65%; --y:25%; }
.sml-star:nth-child(8)  { --dur:1.7s; --del:0.7s; --x:75%; --y:75%; }
.sml-star:nth-child(9)  { --dur:2.5s; --del:0.1s; --x:85%; --y:40%; }
.sml-star:nth-child(10) { --dur:2.2s; --del:0.5s; --x:92%; --y:85%; }
.sml-star:nth-child(11) { --dur:1.6s; --del:0.9s; --x:10%; --y:50%; }
.sml-star:nth-child(12) { --dur:2.7s; --del:0.4s; --x:80%; --y:10%; }
@keyframes sml-star-twinkle {
  0%,100% { opacity:0; transform:scale(.5); }
  50%      { opacity:1; transform:scale(1.2); }
}

/* Gâteau animé — infini */
.sml-bday-cake-anim {
  font-size: 80px;
  display: inline-block;
  animation: sml-cake-pulse 2s ease-in-out infinite;
  margin-bottom: 12px;
}
@keyframes sml-cake-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.08) rotate(2deg); }
}

.sml-bday-hero h1 {
  font-size: clamp(22px, 5vw, 36px);
  font-weight: 800;
  color: var(--sml-text);
  margin: 0 0 8px;
  background: linear-gradient(135deg, var(--sml-accent), var(--sml-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sml-bday-sender { color: var(--sml-muted); font-size: 14px; margin: 0 0 10px; font-style: italic; }
.sml-bday-countdown { font-size: 13px; color: var(--sml-muted); }

/* Message */
.sml-bday-message-section { margin-bottom: 24px; }
.sml-bday-message-card {
  background: var(--sml-surface);
  border: 1px solid var(--sml-border);
  border-radius: var(--sml-radius);
  padding: 28px 24px;
}
.sml-bday-message-icon { font-size: 32px; text-align: center; margin-bottom: 14px; }
.sml-bday-message-text { font-size: 17px; line-height: 1.8; color: var(--sml-text); white-space: pre-wrap; text-align: center; }
.sml-bday-stats-row { text-align: center; color: var(--sml-muted); font-size: 13px; margin-top: 12px; }

/* Réactions */
.sml-bday-reactions-section { text-align: center; margin-bottom: 28px; }
.sml-bday-reactions-section h3 { color: var(--sml-text); font-size: 17px; margin-bottom: 14px; }
.sml-bday-reactions-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sml-reaction-btn {
  background: var(--sml-surface);
  border: 1.5px solid var(--sml-border);
  color: var(--sml-text);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 18px;
  cursor: pointer;
  transition: all .15s;
  font-weight: 600;
}
.sml-reaction-btn:hover { background: #fffbeb; border-color: var(--sml-accent); transform: scale(1.08); }
.sml-reaction-btn.sml-reacted { border-color: var(--sml-accent); background: #fffbeb; }
.sml-reaction-btn:disabled { opacity: .7; cursor: default; transform: none; }

/* Commentaires */
.sml-bday-comments-section { margin-bottom: 28px; }
.sml-bday-comments-section h3 { color: var(--sml-text); font-size: 17px; margin-bottom: 16px; }
.sml-bday-comments-list { margin-bottom: 20px; }
.sml-bday-comment {
  background: var(--sml-surface);
  border: 1px solid var(--sml-border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.sml-bday-comment-author { font-weight: 700; color: var(--sml-accent); font-size: 13px; margin-bottom: 4px; }
.sml-bday-comment-text   { font-size: 15px; color: var(--sml-text); line-height: 1.6; }
.sml-bday-comment-date   { font-size: 11px; color: var(--sml-muted); margin-top: 6px; }
.sml-bday-no-comments    { text-align: center; color: var(--sml-muted); font-size: 13px; padding: 20px; }

/* OTP box commentaires */
.sml-bday-otp-box {
  background: #f8fafc;
  border: 1px solid var(--sml-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.sml-bday-otp-box p { color: var(--sml-muted); font-size: 14px; margin: 0 0 14px; }
.sml-bday-otp-row { display: flex; gap: 8px; }
.sml-bday-otp-row .sml-bday-input { flex: 1; margin: 0; }
.sml-bday-otp-row .sml-bday-btn { width: auto; padding: 13px 16px; margin: 0; white-space: nowrap; }

/* Formulaire commentaire */
.sml-bday-comment-form { display: flex; flex-direction: column; gap: 10px; }

/* Partage viral */
.sml-bday-viral-section { text-align: center; margin-bottom: 28px; }
.sml-bday-viral-section h3 { color: var(--sml-text); margin-bottom: 14px; }

/* Upgrade */
.sml-bday-upgrade-section { margin-bottom: 40px; }
.sml-bday-upgrade-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}
.sml-bday-upgrade-card h3 { color: #92400e; margin-bottom: 8px; font-size: 17px; }
.sml-bday-upgrade-card p  { color: #78350f; font-size: 14px; margin-bottom: 16px; }

/* Ma liste */
.sml-bday-my-list { margin-top: 20px; }
.sml-bday-my-card {
  background: var(--sml-bg);
  border: 1px solid var(--sml-border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.sml-bday-my-card-icon  { font-size: 30px; }
.sml-bday-my-card-info  { flex: 1; min-width: 0; }
.sml-bday-my-card-name  { font-weight: 700; font-size: 16px; color: var(--sml-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sml-bday-my-card-meta  { font-size: 12px; color: var(--sml-muted); margin-top: 3px; }
.sml-bday-my-card-link  { font-size: 20px; text-decoration: none; color: var(--sml-muted); transition: color .15s; }
.sml-bday-my-card-link:hover { color: var(--sml-text); }

.sml-bday-badge { display:inline-block; padding:2px 10px; border-radius:12px; font-size:11px; font-weight:700; }
.sml-bday-badge-active  { background:#dcfce7; color:#16a34a; }
.sml-bday-badge-expired { background:#fee2e2; color:#dc2626; }
.sml-bday-empty { text-align:center; color:var(--sml-muted); padding:40px 20px; }

/* ════ POPUPS ANNONCES ADMIN ════════════════════════════════ */
.sml-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.sml-popup-overlay.sml-popup-visible { opacity: 1; pointer-events: all; }
.sml-popup-box {
  position: relative;
  max-width: 500px;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: translateY(20px);
  transition: transform .25s;
}
.sml-popup-overlay.sml-popup-visible .sml-popup-box { transform: translateY(0); }
.sml-popup-close {
  position: absolute;
  top: 12px; right: 14px;
  background: rgba(0,0,0,.12);
  border: none;
  color: inherit;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background .15s;
}
.sml-popup-close:hover { background: rgba(0,0,0,.25); }
.sml-popup-img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.sml-popup-body { padding: 22px 24px 24px; }
.sml-popup-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 10px;
  line-height: 1.3;
}
.sml-popup-content { font-size: 15px; line-height: 1.7; margin-bottom: 14px; }
.sml-popup-link {
  display: inline-block;
  padding: 10px 22px;
  background: rgba(0,0,0,.12);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s;
  color: inherit;
}
.sml-popup-link:hover { background: rgba(0,0,0,.22); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .sml-bday-templates    { grid-template-columns: repeat(2,1fr); }
  .sml-bday-panel        { padding: 22px 16px; }
  .sml-bday-reactions-row { gap: 6px; }
  .sml-reaction-btn      { padding: 8px 12px; font-size: 16px; }
  .sml-bday-otp-row      { flex-direction: column; }
  .sml-bday-otp-row .sml-bday-btn { width: 100%; }
  .sml-bday-hero h1      { font-size: 22px; }
}
