/* ============================================================
   ICI Creuse – Scannez & Gagnez
   Thème : bleu ciel dégradé, mobile-first
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&family=DM+Sans:ital,wght@0,400;0,500;1,400&display=swap');

/* ---------- Variables ---------- */
:root {
  --blue-sky:    #a8d8f0;
  --blue-mid:    #4aa8d8;
  --blue-deep:   #1a6fa0;
  --blue-dark:   #0d3d5c;
  --blue-brand:  #1565c0; /* bleu logo ICI */
  --accent:      #f5a623;
  --white:       #ffffff;
  --gray-soft:   #f0f6fb;
  --gray-text:   #4a5568;
  --success:     #22c55e;
  --error:       #ef4444;
  --radius:      18px;
  --radius-sm:   10px;
  --shadow:      0 8px 32px rgba(13,61,92,.18);
  --shadow-card: 0 4px 20px rgba(13,61,92,.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--blue-dark);
  min-height: 100vh;
  background: linear-gradient(160deg, #e8f4fd 0%, #c2e0f4 30%, #a8d8f0 60%, #7bbfd8 100%);
  background-attachment: fixed;
}

/* ---------- Fond décoratif ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(255,255,255,.5) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 90%, rgba(26,111,160,.2) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout commun ---------- */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

/* ---------- Header / Logo ---------- */
.site-header {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo-wrap {
  background: white;
  border-radius: 20px;
  padding: 14px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.logo-text-group { display: flex; flex-direction: column; line-height: 1; }

.logo-ici {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 2rem;
  color: var(--blue-dark);
  letter-spacing: -.03em;
}

.logo-creuse {
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  color: var(--blue-mid);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.page-subtitle {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--blue-dark);
  text-align: center;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

/* ---------- Card ---------- */
.card {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  width: 100%;
  max-width: 480px;
}

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

.form-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .85rem;
  color: var(--blue-deep);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(74,168,216,.3);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--blue-dark);
  background: rgba(255,255,255,.9);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 4px rgba(74,168,216,.18);
}

.form-input::placeholder { color: #a0b8c8; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-mid) 0%, var(--blue-brand) 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(26,111,160,.4);
}

.btn-primary:hover { box-shadow: 0 6px 24px rgba(26,111,160,.5); opacity: .95; }

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #e8920d 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(245,166,35,.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #c0392b 100%);
  color: white;
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: .85rem;
  border-radius: 8px;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--blue-mid);
  color: var(--blue-deep);
  width: auto;
  padding: 8px 16px;
  font-size: .85rem;
  border-radius: 8px;
}

/* ---------- Alertes / badges ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: .95rem;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success {
  background: rgba(34,197,94,.12);
  border: 1px solid rgba(34,197,94,.3);
  color: #166534;
}

.alert-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.25);
  color: #991b1b;
}

.alert-info {
  background: rgba(74,168,216,.12);
  border: 1px solid rgba(74,168,216,.3);
  color: var(--blue-deep);
}

.alert-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

/* ---------- Section titre (participant) ---------- */
.contest-hero {
  text-align: center;
  margin-bottom: 24px;
}

.contest-emoji { font-size: 3rem; margin-bottom: 8px; display: block; }

.contest-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  color: var(--blue-dark);
  line-height: 1.2;
  margin-bottom: 6px;
}

.contest-desc {
  color: var(--gray-text);
  font-size: .95rem;
}

.contest-end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(74,168,216,.15);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--blue-deep);
  margin-top: 10px;
}

/* ---------- Page already-played ---------- */
.big-status {
  text-align: center;
  padding: 20px 0;
}

.big-status-icon { font-size: 4rem; display: block; margin-bottom: 12px; }

.big-status-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.big-status-sub { color: var(--gray-text); font-size: .95rem; }

/* ---------- Admin : nav ---------- */
.admin-header {
  width: 100%;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--blue-dark);
}

/* ---------- Admin : cards ---------- */
.admin-grid {
  width: 100%;
  max-width: 860px;
  display: grid;
  gap: 20px;
}

.game-card {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 22px 20px;
  position: relative;
}

.game-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.game-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--blue-dark);
}

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.badge-active  { background: rgba(34,197,94,.15);  color: #166534; }
.badge-expired { background: rgba(239,68,68,.12);  color: #991b1b; }

.game-meta {
  font-size: .85rem;
  color: var(--gray-text);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.game-meta span { display: flex; align-items: center; gap: 5px; }

.game-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Admin : form création jeu ---------- */
.create-game-card {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border: 2px dashed rgba(74,168,216,.4);
  border-radius: var(--radius);
  padding: 22px 20px;
  width: 100%;
  max-width: 860px;
  margin-bottom: 28px;
}

.create-game-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--blue-deep);
  margin-bottom: 16px;
}

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

@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
  .admin-grid { max-width: 100%; }
  .admin-header { max-width: 100%; }
  .create-game-card { max-width: 100%; }
}

/* ---------- Tirage au sort modale ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,61,92,.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: modalIn .25s ease;
}

@keyframes modalIn {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.winner-icon { font-size: 4rem; margin-bottom: 12px; display: block; }

.winner-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  color: var(--blue-dark);
  margin-bottom: 4px;
}

.winner-details { color: var(--gray-text); font-size: .95rem; margin-bottom: 20px; }

.participants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: 12px;
}

.participants-table th {
  background: var(--gray-soft);
  color: var(--blue-deep);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid rgba(74,168,216,.2);
}

.participants-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(74,168,216,.1);
  color: var(--blue-dark);
}

.participants-table tr:last-child td { border-bottom: none; }

.participants-table tbody tr:hover { background: var(--gray-soft); }

.winner-row { background: rgba(245,166,35,.12) !important; font-weight: 600; }

.participants-section {
  margin-top: 20px;
  max-height: 300px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74,168,216,.2);
}

/* ---------- Countdown ---------- */
.countdown-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.cd-block {
  background: var(--blue-deep);
  color: white;
  border-radius: 8px;
  padding: 6px 10px;
  text-align: center;
  min-width: 48px;
}

.cd-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  line-height: 1;
}

.cd-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Divers ---------- */
.divider {
  border: none;
  border-top: 1px solid rgba(74,168,216,.2);
  margin: 20px 0;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }

/* ---------- Animations entrée ---------- */
@keyframes fadeUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.card, .game-card, .create-game-card {
  animation: fadeUp .4s ease both;
}
