/* ==================== VARIABLES CSS ==================== */
:root {
  --xmas-red: #C41E3A;
  --xmas-dark-red: #8B0000;
  --xmas-green: #165B33;
  --xmas-light-green: #228B22;
  --xmas-gold: #FFD700;
  --xmas-cream: #FFFEF2;
  --xmas-white: #FFFFFF;
  --xmas-dark: #2C2C2C;
  --xmas-gray: #E8E8E8;
  --xmas-light-gray: #F5F5F5;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(135deg, var(--xmas-cream) 0%, var(--xmas-light-gray) 100%);
  color: var(--xmas-dark);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

body.has-background {
  background-image: url('background2.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body.has-background::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 0;
  pointer-events: none;
}

/* ==================== FLOCONS DE NEIGE ==================== */
.snowflakes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -10%;
  color: var(--xmas-white);
  font-size: 1.5em;
  opacity: 0.7;
  animation: fall linear infinite;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

.snowflake:nth-child(1) { left: 10%; animation-duration: 12s; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 20%; animation-duration: 15s; animation-delay: 2s; }
.snowflake:nth-child(3) { left: 30%; animation-duration: 10s; animation-delay: 4s; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 13s; animation-delay: 1s; }
.snowflake:nth-child(5) { left: 50%; animation-duration: 14s; animation-delay: 3s; }
.snowflake:nth-child(6) { left: 60%; animation-duration: 11s; animation-delay: 5s; }
.snowflake:nth-child(7) { left: 70%; animation-duration: 16s; animation-delay: 2.5s; }
.snowflake:nth-child(8) { left: 80%; animation-duration: 12s; animation-delay: 4.5s; }

@keyframes fall {
  0% {
    top: -10%;
    opacity: 0.7;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* ==================== CONTENEUR ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ==================== EN-TÊTE ==================== */
.header {
  background: transparent;
  color: var(--xmas-white);
  padding: 12px 0;
  box-shadow: none;
  position: relative;
  z-index: 10;
}

body.has-background .header {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.header::before {
  content: '🎄';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 15px;
  font-size: 1.8em;
  opacity: 0.5;
}

.header::after {
  content: '🎁';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 15px;
  font-size: 1.8em;
  opacity: 0.5;
}

.title {
  display: none;
}

.user-info {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  padding: 0 50px;
}

.bg-switcher {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: var(--xmas-white);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.bg-switcher:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.bg-switcher:active {
  transform: scale(0.95);
}

/* Hidden admin link */
.admin-link {
  position: fixed;
  top: 0;
  left: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10001;
  background: transparent;
}

.admin-link:hover {
  opacity: 1;
  background: rgba(22, 91, 51, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.current-user {
  font-size: 0.95em;
  font-weight: 600;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

/* ==================== BOUTONS ==================== */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--xmas-light-green) 0%, var(--xmas-green) 100%);
  color: var(--xmas-white);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--xmas-green) 0%, var(--xmas-dark-red) 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--xmas-red);
  padding: 8px 16px;
  font-size: 0.9em;
}

.btn-secondary.user-icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: var(--xmas-white);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-secondary.user-icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.btn-secondary.user-icon-btn:active {
  transform: scale(0.95);
}

.btn-secondary:hover {
  background: var(--xmas-white);
}

.btn-danger {
  background: var(--xmas-red);
  color: var(--xmas-white);
  padding: 6px 12px;
  font-size: 0.9em;
}

.btn-link {
  background: none;
  border: none;
  color: var(--xmas-gold);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.95em;
  margin-top: 10px;
  padding: 8px;
}

.btn-link:hover {
  color: var(--xmas-white);
}

/* ==================== CARTES ==================== */
.card {
  background: var(--xmas-white);
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--xmas-gold);
  position: relative;
}

body.has-background .card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.card::before {
  content: '✨';
  position: absolute;
  top: -15px;
  left: 20px;
  font-size: 1.5em;
}

.card h2 {
  color: var(--xmas-red);
  margin-bottom: 20px;
  font-family: Georgia, serif;
  font-size: 1.8em;
}

/* ==================== MODAL ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--xmas-white);
  border-radius: 20px;
  padding: 40px;
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 5px solid var(--xmas-gold);
  animation: modalSlideIn 0.5s ease;
}

body.has-background .modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  color: var(--xmas-red);
  text-align: center;
  font-size: 2em;
  margin-bottom: 15px;
  font-family: Georgia, serif;
}

.modal-content p {
  text-align: center;
  margin-bottom: 30px;
  color: var(--xmas-dark);
}

.identity-select-group {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  margin: 30px 0 20px;
  flex-wrap: wrap;
}

.identity-select {
  flex: 1;
  min-width: 250px;
  padding: 15px 20px;
  font-size: 1.1em;
  font-weight: 500;
  border: 3px solid var(--xmas-green);
  border-radius: 12px;
  background: var(--xmas-white);
  color: var(--xmas-dark);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.identity-select:hover {
  border-color: var(--xmas-gold);
  box-shadow: 0 4px 12px rgba(22, 91, 51, 0.2);
}

.identity-select:focus {
  outline: none;
  border-color: var(--xmas-gold);
  box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.2);
}

.identity-select option {
  padding: 10px;
  font-size: 1em;
}

.identity-select-group .btn {
  padding: 15px 35px;
  font-size: 1.1em;
  font-weight: 700;
  white-space: nowrap;
}

/* ==================== PASSWORD MODAL ==================== */
#passwordModal .modal-content {
  max-width: 450px;
  text-align: center;
}

#passwordModal h2 {
  font-size: 2.2em;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--xmas-red), var(--xmas-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#passwordModal p {
  font-size: 1.1em;
  line-height: 1.6;
  color: var(--xmas-dark);
}

#passwordInput {
  width: 100%;
  padding: 18px 20px;
  font-size: 1.2em;
  border: 3px solid var(--xmas-green);
  border-radius: 12px;
  text-align: center;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#passwordInput:focus {
  outline: none;
  border-color: var(--xmas-gold);
  box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.2);
  transform: scale(1.02);
}

#passwordError {
  padding: 12px;
  border-radius: 8px;
  background: rgba(220, 53, 69, 0.1);
  border: 2px solid var(--danger);
  font-weight: 600;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

#verifyPasswordBtn {
  padding: 15px 40px;
  font-size: 1.2em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--xmas-green) 0%, #1a5c2e 100%);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(22, 91, 51, 0.3);
}

#verifyPasswordBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 91, 51, 0.4);
}

#verifyPasswordBtn:active {
  transform: translateY(0);
}

/* ==================== FORMULAIRE ==================== */
.form-group {
  margin-bottom: 20px;
}

.input {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--xmas-gray);
  border-radius: 8px;
  font-size: 1em;
  transition: all 0.3s ease;
}

.input:focus {
  outline: none;
  border-color: var(--xmas-green);
  box-shadow: 0 0 0 3px rgba(22, 91, 51, 0.1);
}

.checkbox-group {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--xmas-dark);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* ==================== LISTES DE SOUHAITS ==================== */
.wishlists-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  justify-content: center;
  max-width: 1400px;
  margin: 0 auto;
}

.wishlist-card {
  background: linear-gradient(135deg, var(--xmas-white) 0%, var(--xmas-cream) 100%);
  border-radius: 16px;
  padding: 20px;
  border: 3px solid var(--xmas-light-green);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  flex: 0 0 calc(33.333% - 17px);
  max-width: 400px;
}

body.has-background .wishlist-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  border: 3px solid rgba(34, 139, 34, 0.6);
}

.wishlist-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.wishlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--xmas-gold);
}

.wishlist-header h3 {
  font-size: 1.5em;
  color: var(--xmas-red);
  font-family: Georgia, serif;
}

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

.item-count {
  background: var(--xmas-gold);
  color: var(--xmas-dark);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9em;
}

.btn-add-item {
  background: var(--xmas-light-green);
  color: var(--xmas-white);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.btn-add-item:hover {
  background: var(--xmas-green);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.add-item-form-container {
  margin-bottom: 15px;
  padding: 15px;
  background: var(--xmas-light-gray);
  border-radius: 10px;
  border: 2px dashed var(--xmas-gold);
}

.inline-add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-inline {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--xmas-gray);
  border-radius: 6px;
  font-size: 0.95em;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9em;
}

.wishlist-items {
  list-style: none;
}

.wishlist-item {
  background: var(--xmas-white);
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 2px solid var(--xmas-gray);
  transition: all 0.3s ease;
  position: relative;
}

.wishlist-item:hover {
  border-color: var(--xmas-gold);
}

.wishlist-item.combo {
  border-color: var(--xmas-gold);
  background: linear-gradient(135deg, var(--xmas-white) 0%, #FFFEF9 100%);
}

.wishlist-item.combo::before {
  content: '🎁';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.3em;
}

.item-description {
  font-size: 1.1em;
  margin-bottom: 10px;
  color: var(--xmas-dark);
  font-weight: 500;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9em;
}

.item-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85em;
}

.badge-combo {
  background: var(--xmas-gold);
  color: var(--xmas-dark);
}

.badge-claimed {
  background: var(--xmas-green);
  color: var(--xmas-white);
}

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

.btn-claim {
  padding: 6px 14px;
  background: var(--xmas-light-green);
  color: var(--xmas-white);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-claim:hover {
  background: var(--xmas-green);
  transform: scale(1.05);
}

.btn-unclaim {
  background: var(--xmas-dark-red);
}

.btn-unclaim:hover {
  background: var(--xmas-red);
}

.empty-list {
  text-align: center;
  color: #888;
  font-style: italic;
  padding: 30px;
}

/* ==================== JOURNAL D'ACTIVITÉ ==================== */
.activity-header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.activity-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, var(--xmas-cream) 0%, var(--xmas-white) 100%);
  padding: 20px;
  border-radius: 12px;
  border: 2px solid var(--xmas-gold);
  text-align: center;
}

.stat-value {
  font-size: 2.5em;
  font-weight: 700;
  color: var(--xmas-red);
  margin-bottom: 5px;
}

.stat-label {
  color: var(--xmas-dark);
  font-weight: 600;
}

.activity-log {
  max-height: 600px;
  overflow-y: auto;
}

.activity-entry {
  background: var(--xmas-white);
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 10px;
  border-left: 4px solid var(--xmas-green);
  box-shadow: var(--shadow-sm);
}

.activity-entry:hover {
  border-left-color: var(--xmas-gold);
  box-shadow: var(--shadow-md);
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.activity-user {
  font-weight: 700;
  color: var(--xmas-red);
  font-size: 1.1em;
}

.activity-time {
  color: #666;
  font-size: 0.9em;
}

.activity-action {
  color: var(--xmas-dark);
  margin-bottom: 8px;
}

.activity-details {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 0.85em;
  color: #666;
}

.activity-detail {
  display: flex;
  align-items: center;
  gap: 5px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #888;
  font-size: 1.2em;
}

/* ==================== PIED DE PAGE ==================== */
.footer {
  text-align: center;
  padding: 30px 20px;
  margin-top: 50px;
  background: var(--xmas-red);
  color: var(--xmas-white);
  font-size: 1.2em;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 10;
}

body.has-background .footer {
  background: rgba(196, 30, 58, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 0 -8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .header {
    padding: 10px 0;
  }

  .header::before,
  .header::after {
    font-size: 1.5em;
    left: 8px;
  }

  .header::after {
    right: 8px;
  }

  .user-info {
    padding: 0 35px;
    gap: 8px;
  }

  .current-user {
    font-size: 0.85em;
    padding: 5px 10px;
  }

  .btn-secondary {
    padding: 6px 12px;
    font-size: 0.85em;
  }

  .btn-secondary.user-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1em;
  }

  .bg-switcher {
    width: 36px;
    height: 36px;
    font-size: 1.1em;
  }

  .wishlists-grid {
    grid-template-columns: 1fr;
  }

  .identity-buttons {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 25px;
  }

  .activity-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==================== ANIMATIONS ==================== */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.btn-primary:active,
.btn-claim:active {
  animation: pulse 0.3s ease;
}
