/* === Reset + base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: linear-gradient(135deg, #ffd6e0, #fff1f3);
  font-family: 'Poppins', sans-serif;
  color: #333;
}

#challengeBlock button {
  margin: 6px 8px;
}

/* === Structure principale === */
.main-wrapper {
  width: 100%;
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "countdown countdown"
    "content log";
  gap: 20px;
  align-items: start;
}

/* === Countdown === */
.countdown-container {
  grid-area: countdown;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  height: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  background: url('https://www.brithotel.fr/images/resized/categories_minisite_diapo/photos/falaises-dieppe.jpg')
    center/cover no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.countdown-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.countdown-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
}
.countdown-content p {
  font-weight: 600;
  color: #fff0f5;
}
#daysLeft {
  font-size: 2.8rem;
  font-weight: 700;
  color: #ffe3ec;
}

/* === Colonne principale === */
.content-column {
  grid-area: content;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
}

/* === Carte login === */
.login {
  background: white;
  border-radius: 20px;
  padding: 2rem 2.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  text-align: center;
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.6s ease;
}

#loginForm input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 2px solid #ffd6e0;
  outline: none;
  font-size: 1rem;
  transition: border-color 0.2s;
}
#loginForm input:focus {
  border-color: #ff8fa3;
}

#loginBtn {
  background: #ff8fa3;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 25px;
  cursor: pointer;
  transition: 0.25s;
  font-size: 1rem;
}
#loginBtn:hover { background: #ff5c8a; }

#loginError {
  color: #ff3b70;
  font-size: 0.9rem;
  margin-top: 5px;
}

/* === Carte challenge === */
.container {
  background: white;
  border-radius: 20px;
  padding: 2rem 2.5rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  text-align: center;
  width: 100%;
  max-width: 650px;
}
#challengeBlock h1 {
  color: #ff5c8a;
  margin-bottom: 1rem;
}
#challengeBlock p { margin-bottom: 1rem; }

button {
  background: #ff8fa3;
  border: none;
  padding: 10px 25px;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  transition: 0.25s;
}
button:hover { background: #ff5c8a; }

/* === Log panel === */
.log-panel {
  grid-area: log;
  background: white;
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  height: fit-content;
  min-width: 260px;
}
.log-panel h2 { color: #ff5c8a; text-align: center; margin-bottom: 8px; }
.log-entry {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #fff0f5;
  border-left: 4px solid #ff5c8a;
  border-radius: 8px;
}
.log-entry .date {
  font-size: 0.85rem;
  color: #ff5c8a;
}

/* === Modal popup === */
#addChallengeModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  transition: opacity 0.3s ease;
}
#addChallengeModal.show {
  opacity: 1;
  visibility: visible;
}

#addChallengeModal .modal-content {
  background: #fff0f5;
  border-radius: 20px;
  padding: 2rem 2.5rem;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  position: relative;
  text-align: center;
  animation: popIn 0.3s ease-out;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#addChallengeModal h2 {
  margin-bottom: 1rem;
  color: #ff5c8a;
  font-size: 1.5rem;
}

#addChallengeModal textarea,
#addChallengeModal input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 2px solid #ffb6c1;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
#addChallengeModal textarea:focus,
#addChallengeModal input[type="text"]:focus {
  border-color: #ff8fa3;
}

.checkbox-group {
  margin-bottom: 1rem;
}
.specific-user {
  margin-bottom: 1rem;
}
.specific-user input {
  width: 100%;
  border: 1px solid #ccc;
  padding: 6px 8px;
  border-radius: 8px;
}

#addChallengeModal button {
  background: #ff8fa3;
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: 0.25s;
}
#addChallengeModal button:hover {
  background: #ff5c8a;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #ff8fa3;
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-btn:hover { background: #ff5c8a; }

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Responsive === */
@media (max-width: 900px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas:
      "countdown"
      "content"
      "log";
  }
  .container, .login, .log-panel {
    width: 100%;
  }
}

/* === Popup confirmation reset === */
#confirmResetModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  transition: 0.3s ease;
}

#confirmResetModal.show {
  opacity: 1;
  visibility: visible;
}

#confirmResetModal .modal-content {
  background: #fff0f5;
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 25px rgba(0,0,0,0.25);
  animation: popIn 0.3s ease-out;
}

#confirmResetModal h2 {
  color: #ff5c8a;
  margin-bottom: 1rem;
}

#confirmResetModal p {
  font-size: 1rem;
  color: #444;
  margin-bottom: 1.5rem;
}

#confirmResetModal .confirm-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

#confirmResetModal button {
  background: #ff8fa3;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.25s;
}

#confirmResetModal button:hover {
  background: #ff5c8a;
}

#confirmResetModal #confirmResetYes {
  background: #ff8fa3;
}

#confirmResetModal #confirmResetNo {
  background: #ccc;
  color: #333;
}

#dailyChallengeReminder {
  background: #fff6f9;
  border: 2px dashed #ff8fa3;
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 20px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

#dailyChallengeReminder h2 {
  color: #ff5c8a;
  margin-bottom: 10px;
}

#todayChallengeText {
  font-style: italic;
  color: #555;
}

/* --- Boîte secrète pour Victor --- */
.secret-letter {
  margin: 20px auto;
  text-align: center;
  animation: fadeIn 0.7s ease;
}

.secret-envelope {
  display: inline-block;
  padding: 18px 24px;
  background: #fff0f5;
  border: 2px solid #ff8fa3;
  border-radius: 14px;
  color: #ff5c8a;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.25s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.secret-envelope:hover {
  transform: scale(1.05);
  background: #ffe6ee;
}

/* --- Modale de la lettre secrète --- */
.secret-modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 2000;
}

.secret-modal.show {
  display: flex;
}

.secret-modal-content {
  background: #fff0f5;
  padding: 2rem;
  max-width: 500px;
  border-radius: 18px;
  text-align: left;
  box-shadow: 0 12px 25px rgba(0,0,0,0.2);
  position: relative;
  animation: popIn 0.3s ease;
}

/* Close button */
.secret-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #ff8fa3;
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Texte de la lettre */
#secretLetterText {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 1rem;
  color: #444;
}

