@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;
  --green-light: #3d7a52;
  --cream: #F4ECD7;
  --cream-dark: #e8d5b0;
  --gold: #B9944E;
  --gold-light: #d4aa6a;
  --gold-dark: #8a6a30;
  --red: #c0392b;
  --red-dark: #8b2020;
  --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);
}

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

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


/* ========================
   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) !important;
  color: var(--text-dark) !important;
  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(--gold);
  color: var(--text-dark);
}

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

.btn-danger {
  background: var(--red) !important;
  color: white !important;
}

.btn-danger:hover {
  background: #e74c3c !important;
  color: white !important;
}

.btn-success {
  background: var(--green-success) !important;
  color: white !important;
}

.btn-success:hover {
  background: #4caf50 !important;
  color: white !important;
}

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

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

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

.error { color: #e74c3c; font-size: 0.85rem; margin-top: 0.5rem; }


/* ========================
   LAYOUT & NAVIGATION
======================== */
nav.navbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.75rem 2rem;
  background: var(--green-mid);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
  position: static;
  z-index: 100;
}

.logo { display: none; }

.nav-links {
  grid-column: 2;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

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

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

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

.nav-right {
  grid-column: 3;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

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

.page h2 {
  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 #B09B66;
  border-radius: 8px;
  padding: 1.5rem 1rem;
  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;
  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;
}

.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;
}

.no-list-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

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

#christmas-countdown p {
  color: #6D2A2A !important;
  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% !important;
  margin: 1.5rem 0 0 !important;
  padding: 1.5rem 2rem;
  background: var(--cream) !important;
  border: 2px solid #B09B66;
  border-radius: 16px;
  box-sizing: border-box;
  color: var(--text-dark);
}


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

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

.gifts-grid-small .gift-card { min-height: 185px; }
.gifts-grid:not(.gifts-grid-small) .gift-card { min-height: 310px; }

.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;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.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.6rem;
  border-bottom: 1px solid rgba(201,168,76,0.35);
}

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

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


/* ========================
   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;
}


/* ========================
   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: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

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

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

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

.popup-buttons button { flex: 1; }


/* ========================
   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-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);
}


/* ========================
   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;
  cursor: pointer;
  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; }

.notif-tooltip {
  position: absolute;
  top: 28px;
  right: 0;
  background: var(--green-mid);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  color: var(--cream);
  white-space: nowrap;
  z-index: 20;
  box-shadow: var(--shadow);
}


/* ========================
   UTILITAIRES
======================== */
.error { color: #e74c3c; font-size: 0.85rem; margin-top: 0.5rem; }

#scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  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;
}
