@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap');

/* ========================
   VARIABLES & RESET
======================== */
:root {
  --green-dark: #133222;
  --green-mid: #1F4633;
  --cream: #F4ECD7;
  --cream-dark: #e8d5b0;
  --gold: #B9944E;
  --gold-light: #d4aa6a;
  --gold-dark: #8a6a30;
  --red: #c0392b;
  --green-success: #2e7d32;
  --text-dark: #1a2e1a;
  --text-muted: #8a9e8a;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --red-bright: #e74c3c;
  --brown-dark: #6D2A2A;
  --gold-muted: #a07830;
  --gold-pale: #B09B66;
  --grey-muted: #888;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--green-dark);
  color: var(--cream);
  min-height: 100vh;
  min-width: 1145px;
}


/* ========================
   TYPOGRAPHIE & ÉLÉMENTS DE BASE
======================== */
select, input {
  width: 100%;
  padding: 0.8rem 1.1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 10px;
  background: var(--green-dark);
  color: var(--cream);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--gold);
}

input::placeholder { color: rgba(245,234,214,0.4); }
select option { background: var(--green-dark); }

button {
  width: 100%;
  padding: 0.8rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: var(--gold);
  color: var(--text-dark);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.03em;
}

button:hover {
  background: var(--cream);
  color: var(--text-dark);
  transform: translateY(-1px);
}

button:active { transform: translateY(0); }

.btn-small {
  width: auto;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  margin-right: 0.3rem;
  margin-top: 0.3rem;
  border-radius: 7px;
  background: var(--cream);
  color: var(--text-dark);
}

.btn-secondary {
  background: var(--cream);
  color: var(--text-dark);
}

.btn-danger {
  background: var(--gold);
  color: white;
}

.btn-danger:hover {
  background: var(--red-bright);
  color: white;
}

.btn-success {
  background: var(--gold);
  color: white;
}

.btn-success:hover {
  background: var(--cream);
  color: var(--text-dark);
}

.btn-warning {
  background: var(--gold);
  color: var(--text-dark);
}

.btn-power {
  background: var(--gold);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 0.825rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
}

.btn-hamburger {
  display: none;
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 1.5rem;
  width: auto;
  padding: 0 0.25rem;
  cursor: pointer;
  line-height: 1;
}

.btn-back {
  width: auto;
  padding: 0.5rem 1.2rem;
  background: var(--gold);
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}


/* ========================
   LAYOUT & NAVIGATION
======================== */
nav.navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
  padding-left: calc(2rem + env(safe-area-inset-left));
  padding-right: calc(2rem + env(safe-area-inset-right));
  background: var(--green-mid);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { display: none; }

.nav-links {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex: 0 1 auto;
  margin: 0;
}

.nav-links button {
  width: 150px;
  padding: 0.55rem 0.5rem;
  background: var(--gold);
  color: var(--text-dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
}

.nav-links button:hover {
  background: var(--cream);
  color: var(--text-dark);
  transform: translateY(-1px);
}

.nav-links button.active {
  background: var(--cream);
  color: var(--text-dark);
}

.nav-right {
  position: absolute;
  right: calc(2rem + env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.page { padding: 2rem; max-width: 1200px; margin: 0 auto; }

.page h1 {
  margin-bottom: 1.5rem;
  color: var(--gold);
  font-size: 1.8rem;
}


/* ========================
   AUTH
======================== */
#auth-section, #change-password-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.auth-box {
  background: var(--green-mid);
  border: 1px solid rgba(201,168,76,0.3);
  padding: 2.5rem;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-box h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--gold);
  font-size: 2rem;
}


/* ========================
   DASHBOARD
======================== */
#dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}

#dashboard-grid .user-card {
  aspect-ratio: 4 / 3;
}

.user-card {
  background: var(--green-mid);
  border: 2px solid var(--gold-pale);
  border-radius: 8px;
  padding: 1.5rem 0.5rem;
  position: relative;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow);
  min-height: 160px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.user-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(201,168,76,0.5);
}

.user-card h3 {
  font-size: 1rem;
  color: var(--cream);
  margin-bottom: 0.4rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  padding-right: 3px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.75rem;
  border: 2px solid rgba(201,168,76,0.4);
}

.avatar-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 auto 0.75rem;
}

#christmas-countdown {
  max-width: 100%;
  margin: 2rem 0 0;
  padding: 1.5rem 2rem;
  background: var(--cream);
  border: 2px solid var(--gold-pale);
  border-radius: 16px;
  text-align: center;
  box-sizing: border-box;
}

#christmas-countdown p {
  color: var(--brown-dark);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

#countdown-display {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

#activity-section {
  max-width: 100%;
  margin: 2rem 0 0;
  padding: 1.5rem 2rem;
  background: var(--cream);
  border: 2px solid var(--gold-pale);
  border-radius: 16px;
  box-sizing: border-box;
  color: var(--text-dark);
}

.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(201,168,76,0.15);
}

.activity-label { min-width: 0; }

.activity-date {
  color: var(--grey-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}


/* ========================
   CARTES CADEAUX
======================== */
.mylist-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.mylist-actions button {
  width: auto;
  padding: 0.75rem 1.5rem;
}

.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.gifts-grid .gift-card { min-height: 280px; }

.gift-card {
  background: var(--green-mid);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 14px;
  padding: 1rem;
  transition: border-color 0.2s;
  cursor: pointer;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.gift-card:hover { border-color: rgba(201,168,76,0.45); }

.gift-card-top { min-width: 0; }

.gift-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.gift-card h4 {
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gift-card-actions {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gift-card-actions .btn-small { width: 100%; margin: 0; }

.gift-card-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gift-card-price {
  color: var(--gold-light);
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.reserved-badge {
  background: var(--gold-dark);
  color: var(--cream);
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.purchased-badge {
  background: var(--green-success);
  color: white;
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  display: inline-block;
  margin-bottom: 0.5rem;
}


/* ========================
   LISTES
======================== */
.list-section { margin-bottom: 2.5rem; }

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(201,168,76,0.35);
}

.list-header h3 {
  color: var(--cream);
  font-size: 1.15rem;
}

.list-header .btn-small:not(.btn-danger) {
  background: var(--cream);
  color: var(--text-dark);
}


/* ========================
   PROFIL
======================== */
.profile-box {
  background: var(--green-mid);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 14px;
  padding: 2rem;
  max-width: 420px;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  display: block;
  border: 3px solid rgba(201,168,76,0.4);
}

.avatar-placeholder-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.avatar-edit-wrapper-container {
  position: relative;
  display: inline-block;
}

.avatar-edit-wrapper {
  position: relative;
  display: inline-block;
  width: 100px;
  cursor: pointer;
}

.avatar-hint-bubble {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  background: var(--green-mid);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  z-index: 5;
}

.avatar-hint-bubble::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--green-mid);
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
  rotate: 45deg;
}

.avatar-edit-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(10,20,10,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.avatar-edit-wrapper:hover .avatar-edit-overlay {
  opacity: 1;
}


/* ========================
   POPUPS
======================== */
.popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(10,20,10,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.popup-box {
  background: var(--green-mid);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 20px;
  padding: 2.75rem 2rem 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.popup-close-x {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--cream);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.popup-close-x:hover {
  background: rgba(244,236,215,0.15);
  color: var(--cream);
  transform: none;
}

.popup-single-btn {
  width: 100%;
  margin-top: 1rem;
}

/* --- POPUP TUTORIEL --- */
.popup-box.popup-tutorial-box {
  max-width: 1100px;
  width: 92vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 1.75rem;
}

.tutorial-slide-image {
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--cream-dark);
}

.tutorial-slide-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: var(--cream-dark);
}

.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0;
  flex-shrink: 0;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(244,236,215,0.25);
}

.tutorial-dot.active { background: var(--gold); }

.tutorial-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* Bouton suivant : rond, gold, l'or s'efface au survol, la flèche reste noire */
.tutorial-btn-next {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.tutorial-btn-next:hover { background: var(--cream); }

/* Bouton précédent : pas de cercle, crème en permanence, léger déplacement au survol */
.tutorial-btn-prev {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--cream);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.tutorial-btn-prev:hover { transform: translateX(-3px); }

.tutorial-btn-finish {
  width: auto;
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
}

/* Spécificité réelle (deux classes) plutôt que !important : cette règle doit
   battre .popup-overlay sur align-items/justify-content, peu importe l'ordre
   des règles dans le fichier. */
.popup-overlay.hamburger-overlay {
  align-items: flex-start;
  justify-content: flex-end;
}

.hamburger-menu {
  margin-top: 4.5rem;
  margin-right: 1rem;
  width: 150px;
  background: var(--green-mid);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.85rem;
}

.hamburger-menu button {
  width: 100%;
  color: var(--text-dark);
  text-align: center;
  letter-spacing: normal;
}

.popup-box p {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--cream);
}

.popup-box h3 {
  color: var(--cream);
  margin-bottom: 1rem;
}

.popup-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.popup-buttons button { flex: 1; }

#loading-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(10,20,10,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(185,148,78,0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Animation "cadeau qui tombe dans la hotte", jouée uniquement lors d'un achat.
   Durée ajustable ici — la variable --gift-anim-duration en dessous est le seul
   chiffre à changer pour accélérer/ralentir. Version .playing-reverse (même
   keyframes, sens inversé) jouée quand un achat est annulé : le cadeau ressort. */
.gift-sprite {
  --gift-anim-duration: 2.5s;
  width: 240px;
  height: 240px;
  background-image: url('/animations/santa-sack-sprite.png');
  background-repeat: no-repeat;
  display: none;
}

.gift-sprite.playing {
  animation: gift-sprite-steps var(--gift-anim-duration) steps(1) 1 forwards;
}

.gift-sprite.playing-reverse {
  animation: gift-sprite-steps var(--gift-anim-duration) steps(1) 1 reverse forwards;
}

@keyframes gift-sprite-steps {
  0.0% { background-position: 0px 0px; }
  2.083% { background-position: -240px 0px; }
  4.167% { background-position: -480px 0px; }
  6.25% { background-position: -720px 0px; }
  8.333% { background-position: -960px 0px; }
  10.417% { background-position: -1200px 0px; }
  12.5% { background-position: -1440px 0px; }
  14.583% { background-position: -1680px 0px; }
  16.667% { background-position: 0px -240px; }
  18.75% { background-position: -240px -240px; }
  20.833% { background-position: -480px -240px; }
  22.917% { background-position: -720px -240px; }
  25.0% { background-position: -960px -240px; }
  27.083% { background-position: -1200px -240px; }
  29.167% { background-position: -1440px -240px; }
  31.25% { background-position: -1680px -240px; }
  33.333% { background-position: 0px -480px; }
  35.417% { background-position: -240px -480px; }
  37.5% { background-position: -480px -480px; }
  39.583% { background-position: -720px -480px; }
  41.667% { background-position: -960px -480px; }
  43.75% { background-position: -1200px -480px; }
  45.833% { background-position: -1440px -480px; }
  47.917% { background-position: -1680px -480px; }
  50.0% { background-position: 0px -720px; }
  52.083% { background-position: -240px -720px; }
  54.167% { background-position: -480px -720px; }
  56.25% { background-position: -720px -720px; }
  58.333% { background-position: -960px -720px; }
  60.417% { background-position: -1200px -720px; }
  62.5% { background-position: -1440px -720px; }
  64.583% { background-position: -1680px -720px; }
  66.667% { background-position: 0px -960px; }
  68.75% { background-position: -240px -960px; }
  70.833% { background-position: -480px -960px; }
  72.917% { background-position: -720px -960px; }
  75.0% { background-position: -960px -960px; }
  77.083% { background-position: -1200px -960px; }
  79.167% { background-position: -1440px -960px; }
  81.25% { background-position: -1680px -960px; }
  83.333% { background-position: 0px -1200px; }
  85.417% { background-position: -240px -1200px; }
  87.5% { background-position: -480px -1200px; }
  89.583% { background-position: -720px -1200px; }
  91.667% { background-position: -960px -1200px; }
  93.75% { background-position: -1200px -1200px; }
  95.833% { background-position: -1440px -1200px; }
  97.917% { background-position: -1680px -1200px; }
  100% { background-position: -1680px -1200px; }
}


/* ========================
   ADMIN
======================== */
.admin-section {
  background: var(--green-mid);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.admin-section h3 {
  color: var(--gold);
  margin-bottom: 1rem;
}

.admin-users-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.admin-user-card {
  background: var(--green-dark);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 12px;
  padding: 1rem;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s;
  text-align: center;
}

.admin-user-card:hover { border-color: var(--gold); }

.admin-user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.admin-user-name {
  font-size: 0.85rem;
  color: var(--cream);
  font-weight: 600;
  line-height: 1.3;
}

.admin-user-role {
  color: var(--text-muted);
  font-weight: 400;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--green-dark);
  font-size: 0.82rem;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-table td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(201,168,76,0.1);
  font-size: 0.9rem;
  color: var(--cream-dark);
}

.countdown-box {
  background: transparent;
  border: 1px solid rgba(160,120,48,0.5);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  min-width: 70px;
}

.countdown-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--gold-muted);
}

.countdown-label {
  font-size: 0.75rem;
  color: var(--brown-dark);
  margin-top: 0.25rem;
}

/* .mobile-only / .desktop-only : classes utilitaires de bascule d'affichage,
   volontairement en !important. Elles doivent gagner face à n'importe quel
   composant sur lequel elles sont posées, peu importe sa propre spécificité —
   contrairement aux !important retirés ailleurs dans ce fichier, qui ne
   servaient qu'à battre le sélecteur "button" de base. */
.mobile-only { display: none !important; }

.list-header-title-desktop {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.list-header-actions {
  display: flex;
  gap: 0.2rem;
}

.btn-icon-gold {
  width: auto;
  background: transparent;
  border: none;
  color: var(--gold);
  padding: 0.4rem 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-icon-gold:hover {
  background: rgba(185,148,78,0.15);
  color: var(--gold);
  transform: none;
}

.btn-icon-cream {
  width: auto;
  background: transparent;
  border: none;
  color: var(--cream);
  padding: 0.4rem 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-icon-cream:hover {
  background: rgba(244,236,215,0.15);
  color: var(--cream);
  transform: none;
}

.gift-action-icons {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.gift-action-icons button {
  flex: 1;
  height: 40px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: transform 0.1s, filter 0.15s;
}

.btn-icon-bookmark {
  background: var(--cream);
}

.btn-icon-cart {
  background: var(--gold);
  color: var(--cream);
}

.gift-action-icons button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-icon-bookmark:hover {
  background: var(--cream);
  color: var(--text-dark);
}

.btn-icon-cart:hover {
  background: var(--gold);
  color: var(--cream);
}


/* ========================
   NOTIFICATIONS
======================== */
@keyframes ring {
  0%   { transform: rotate(0deg); }
  10%  { transform: rotate(15deg); }
  20%  { transform: rotate(-15deg); }
  30%  { transform: rotate(10deg); }
  40%  { transform: rotate(-10deg); }
  50%  { transform: rotate(5deg); }
  60%  { transform: rotate(-5deg); }
  70%  { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.notif-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--red);
  color: white;
  border-radius: 20px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 10;
  transform-origin: top center;
  animation: ring 1.5s ease-in-out infinite;
  animation-delay: calc(var(--card-index, 0) * 0.3s);
}

.notif-count { margin-left: 0.25rem; }


/* ========================
   UTILITAIRES
======================== */
.error { color: var(--red-bright); font-size: 0.85rem; margin-top: 0.5rem; }

#scroll-top-btn {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom));
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--text-dark);
  font-size: 1.2rem;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 0;
  display: none;
}


/* ========================
   MOBILE (< 1145px)
   Le desktop reste figé au-dessus de ce seuil (cf body { min-width }).
   En dessous, mise en page mobile dédiée — pas d'entre-deux "tablette".
======================== */
@media (max-width: 1144px) {
  body { min-width: 0; }

  /* --- Bascule desktop/mobile : les deux structures existent dans le DOM,
     seule celle qui correspond à la largeur d'écran est affichée. --- */
  .desktop-only { display: none !important; }
  .list-header-title.mobile-only { display: flex !important; }
  .list-header-actions.mobile-only { display: flex !important; }
  .admin-users-grid.mobile-only { display: grid !important; }
  .activity-date.mobile-only { display: inline !important; }

  .page { padding: 1rem; }

  .popup-box.popup-tutorial-box { padding: 1.1rem; width: 94vw; }

  /* --- Navbar : 2 boutons centraux, hamburger à droite --- */
  nav.navbar {
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
  }
  .nav-right { right: calc(1rem + env(safe-area-inset-right)); }

  /* #nav-admin reçoit un style inline en JS (nav-admin.style.display =
     'inline-block' pour les admins) — !important nécessaire pour le battre ici. */
  #nav-profile, #nav-admin, .btn-power { display: none !important; }
  .btn-hamburger { display: block; }

  /* --- Dashboard : 2 cartes par ligne --- */
  #dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  #dashboard-grid .user-card {
    aspect-ratio: auto;
  }

  /* --- Compte à rebours : une seule ligne, rétréci pour tenir sur 2 cartes de large --- */
  #christmas-countdown { padding: 1rem; }
  #countdown-display { gap: 0.4rem; }
  .countdown-box {
    padding: 0.5rem 0.3rem;
    min-width: 0;
    flex: 1;
  }
  .countdown-value { font-size: 1.2rem; }
  .countdown-label { font-size: 0.55rem; }

  /* --- Activité récente : plus de largeur utile, date courte --- */
  #activity-section { padding: 1.25rem 1rem; }
  .activity-label { font-size: 0.9rem; }

  /* --- Boutons "Ajouter un cadeau" / "Créer une catégorie" sur une seule ligne --- */
  .mylist-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }
  .mylist-actions button {
    padding: 0.6rem 0.4rem;
    font-size: 0.78rem;
    flex: 1;
  }

  /* --- Cartes cadeaux : 2 par ligne --- */
  .gifts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* --- Cartes utilisateurs admin : 2 par ligne --- */
  .admin-users-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* --- Zones tactiles un peu plus grandes pour le doigt --- */
  button, .btn-small, input, select {
    min-height: 42px;
  }
  .btn-power, .btn-hamburger, .btn-icon-gold, .btn-icon-cream {
    min-height: 0;
  }

  .auth-box { padding: 2rem 1.5rem; }
}
