@import url('https://fonts.googleapis.com/css2?family=Mountains+of+Christmas:wght@700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-deep: #071912;
  --bg-forest: #0d281d;
  --bg-card: rgba(16, 43, 31, 0.82);
  --bg-card-elevated: rgba(22, 56, 41, 0.92);
  --crimson: #d42426;
  --crimson-dark: #9e1416;
  --crimson-glow: rgba(212, 36, 38, 0.45);
  --gold: #f6c453;
  --gold-light: #ffe49e;
  --gold-glow: rgba(246, 196, 83, 0.35);
  --pine-light: #2b7a57;
  --mint: #6ee7b7;
  --snow: #f8fafc;
  --snow-muted: #cbd5e1;
  --border-gold: rgba(246, 196, 83, 0.28);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at 50% 0%, #163e2e 0%, #091d15 55%, #05110c 100%);
  color: var(--snow);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Arrière-plan décoratif de Noël */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(rgba(246, 196, 83, 0.07) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: 0 0, 25px 25px;
  pointer-events: none;
  z-index: 0;
}

#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Guirlande lumineuse de Noël en haut */
.fairy-lights {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 36px;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.fairy-lights::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 18px;
  border-bottom: 2px solid #1f3a2c;
  border-radius: 50%;
}

.bulb {
  width: 12px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  margin-top: 6px;
  position: relative;
  animation: twinkle 2.4s infinite ease-in-out alternate;
}

.bulb::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 3px;
  width: 6px;
  height: 5px;
  background: #2a4736;
  border-radius: 2px;
}

.bulb.red {
  background: #ff3b3f;
  box-shadow: 0 4px 16px 4px rgba(255, 59, 63, 0.75);
  animation-delay: 0s;
}
.bulb.gold {
  background: #ffd166;
  box-shadow: 0 4px 16px 4px rgba(255, 209, 102, 0.75);
  animation-delay: 0.6s;
}
.bulb.green {
  background: #06d6a0;
  box-shadow: 0 4px 16px 4px rgba(6, 214, 160, 0.75);
  animation-delay: 1.2s;
}
.bulb.blue {
  background: #4cc9f0;
  box-shadow: 0 4px 16px 4px rgba(76, 201, 240, 0.75);
  animation-delay: 1.8s;
}

@keyframes twinkle {
  0% { opacity: 0.45; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.08); }
}

/* Barre de navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 32px 14px;
  background: linear-gradient(180deg, rgba(5, 19, 13, 0.92) 0%, rgba(5, 19, 13, 0.65) 80%, transparent 100%);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 8px rgba(246, 196, 83, 0.5));
  animation: floatSlow 3.5s ease-in-out infinite;
}

.brand-title {
  font-family: 'Mountains of Christmas', cursive;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, #ffe49e 50%, #f6c453 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 12px rgba(246, 196, 83, 0.25);
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--crimson), var(--crimson-dark));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  letter-spacing: 0.6px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-gold);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}

.user-pill .avatar {
  font-size: 1.25rem;
}

/* Conteneur principal */
.app-container {
  position: relative;
  z-index: 10;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px 80px;
}

/* Bannière Hero */
.hero-header {
  text-align: center;
  margin: 12px auto 32px;
  max-width: 720px;
}

.hero-title {
  font-family: 'Mountains of Christmas', cursive;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  color: var(--gold-light);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 25px rgba(246, 196, 83, 0.35);
  margin-bottom: 8px;
  line-height: 1.15;
}

.hero-subtitle {
  color: var(--snow-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Cartes style Noël Givré + Bordure Sucre d'orge / Or */
.festive-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.festive-card.candy-border::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    45deg,
    #d42426,
    #d42426 14px,
    #ffffff 14px,
    #ffffff 28px,
    #1f7a4c 28px,
    #1f7a4c 42px,
    #ffffff 42px,
    #ffffff 56px
  );
}

/* Authentification */
.auth-wrapper {
  max-width: 580px;
  margin: 0 auto;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--snow-muted);
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--crimson-glow);
}

/* Formulaires */
.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: rgba(5, 18, 12, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 11px;
  padding: 12px 14px;
  color: var(--snow);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Sélecteur d'avatar de Noël */
.avatar-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.avatar-option {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.avatar-option:hover {
  transform: translateY(-2px);
  border-color: rgba(246, 196, 83, 0.5);
}

.avatar-option.selected {
  border-color: var(--gold);
  background: rgba(246, 196, 83, 0.22);
  box-shadow: 0 0 12px var(--gold-glow);
  transform: scale(1.06);
}

/* Choix lors de l'inscription : Rejoindre ou Créer une session */
.choice-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.choice-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.choice-card:hover {
  background: rgba(255, 255, 255, 0.09);
}

.choice-card.selected {
  border-color: var(--gold);
  background: rgba(246, 196, 83, 0.16);
  box-shadow: 0 4px 16px rgba(246, 196, 83, 0.2);
}

.choice-card-icon {
  font-size: 1.65rem;
  margin-bottom: 4px;
}

.choice-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--snow);
}

.choice-card-desc {
  font-size: 0.72rem;
  color: var(--snow-muted);
  margin-top: 2px;
}

.conditional-subform {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed var(--border-gold);
  animation: fadeIn 0.25s ease;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 20px var(--crimson-glow);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(212, 36, 38, 0.65);
}

.btn-gold {
  background: linear-gradient(135deg, #ffd875 0%, #e5a930 100%);
  color: #1c1302;
  box-shadow: 0 6px 20px var(--gold-glow);
}

.btn-gold:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.06);
  color: var(--snow);
  border: 1px solid var(--border-gold);
}

.btn-outline:hover {
  background: rgba(246, 196, 83, 0.14);
}

.btn-danger {
  background: rgba(212, 36, 38, 0.22);
  color: #fecaca;
  border: 1px solid rgba(255, 90, 95, 0.55);
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-dark) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 18px var(--crimson-glow);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.84rem;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

/* Grille du Tableau de bord */
.dashboard-top-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.action-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(22, 58, 42, 0.9), rgba(11, 31, 22, 0.92));
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-lg);
}

.action-banner h3 {
  font-size: 1.2rem;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.action-banner p {
  font-size: 0.88rem;
  color: var(--snow-muted);
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.session-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.6), 0 0 20px rgba(246, 196, 83, 0.15);
  border-color: var(--gold);
}

.session-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-open {
  background: rgba(246, 196, 83, 0.18);
  color: var(--gold-light);
  border: 1px solid rgba(246, 196, 83, 0.4);
}

.status-drawn {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.session-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 12px 0 6px;
  color: #fff;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--snow-muted);
  margin: 10px 0 16px;
}

.session-code-pill {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(246, 196, 83, 0.5);
}

.my-draw-preview {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(212, 36, 38, 0.22), rgba(246, 196, 83, 0.15));
  border: 1px solid rgba(246, 196, 83, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Vue Détaillée d'une Session */
.session-detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  margin-top: 20px;
}

/* Boîte Cadeau Secrète Interactive */
.secret-reveal-box {
  text-align: center;
  padding: 30px 22px;
  background: radial-gradient(circle at 50% 20%, rgba(212, 36, 38, 0.28), rgba(10, 31, 22, 0.95));
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(246, 196, 83, 0.12);
  position: relative;
}

.gift-icon-animated {
  font-size: 4.8rem;
  display: inline-block;
  cursor: pointer;
  filter: drop-shadow(0 8px 20px rgba(246, 196, 83, 0.5));
  animation: giftBounce 2s infinite ease-in-out;
  user-select: none;
}

@keyframes giftBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(-4deg); }
  75% { transform: translateY(-4px) rotate(4deg); }
}

.revealed-target-card {
  margin-top: 16px;
  padding: 24px;
  border-radius: 16px;
  background: rgba(5, 20, 14, 0.85);
  border: 2px solid var(--gold);
  box-shadow: 0 0 30px rgba(246, 196, 83, 0.25);
  animation: popReveal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popReveal {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.revealed-avatar {
  font-size: 3.6rem;
  margin-bottom: 8px;
}

.revealed-name {
  font-family: 'Mountains of Christmas', cursive;
  font-size: 2.5rem;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.target-wishlist-box {
  margin-top: 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
  border-radius: 12px;
  border-left: 4px solid var(--gold);
}

/* Liste des participants */
.participants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.participant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.participant-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.participant-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danger-zone-card {
  border-color: rgba(255, 90, 95, 0.35);
}

.participant-avatar {
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  background: rgba(246, 196, 83, 0.14);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Notifications Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(12, 34, 24, 0.96);
  border: 1px solid var(--gold);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  animation: fadeIn 0.25s ease;
}

.toast.error {
  border-color: #ff5a5f;
  background: rgba(65, 14, 16, 0.96);
}

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 500px;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 820px) {
  .dashboard-top-actions,
  .session-detail-grid,
  .form-row,
  .choice-cards {
    grid-template-columns: 1fr;
  }
  .navbar {
    padding: 20px 16px 12px;
    flex-wrap: wrap;
    gap: 10px;
  }
}
