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

:root {
  --cream: #fff8f0;
  --peach-light: #ffe8d6;
  --peach: #ffd3ae;
  --orange: #ff8c42;
  --orange-deep: #f4611e;
  --coral: #ff6b6b;
  --text-dark: #4a2e1e;
  --text-muted: #8a6a54;
  --white: #ffffff;
  --shadow: 0 8px 24px rgba(244, 97, 30, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  background: linear-gradient(160deg, var(--cream) 0%, var(--peach-light) 100%);
  color: var(--text-dark);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 1.5rem 1.5rem;
  position: relative;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-decor span {
  position: absolute;
  opacity: 0.22;
  line-height: 1;
  animation: bg-float 7s ease-in-out infinite;
}

.bg-emoji-desktop {
  display: none;
}

@media (min-width: 900px) {
  .bg-emoji-desktop {
    display: block;
  }
}

.bg-decor span:nth-child(even) {
  animation-duration: 8.5s;
  animation-delay: -2s;
}

.bg-decor span:nth-child(3n) {
  animation-duration: 6s;
  animation-delay: -4s;
}

@keyframes bg-float {
  0%,
  100% {
    transform: translateY(0) rotate(var(--r, 0deg));
  }
  50% {
    transform: translateY(-10px) rotate(var(--r, 0deg));
  }
}

.brand-title {
  margin: 0 0 1.5rem;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--orange-deep);
  text-align: center;
}

.frame-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem 2rem;
  max-width: 480px;
  width: 100%;
  min-height: 380px;
  overflow: hidden;
  transition: max-width 0.2s ease;
  display: flex;
  flex-direction: column;
}

.frame-card.is-wide {
  max-width: 1100px;
  min-height: 0;
  padding: 1.75rem 1.75rem 2rem;
}

.gate-view {
  /* La page de bienvenue garde toujours sa DA orange, meme si le calendrier est en theme bleu */
  --cream: #fff8f0;
  --peach-light: #ffe8d6;
  --peach: #ffd3ae;
  --orange: #ff8c42;
  --orange-deep: #f4611e;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 1.75rem;
  position: relative;
}

.gate-question {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--orange-deep);
}

.gate-buttons-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.gate-btn {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gate-btn:hover {
  transform: translateY(-1px);
}

.gate-btn-oui {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(244, 97, 30, 0.3);
}

.gate-btn-oui-bleu {
  background: linear-gradient(135deg, #4dabf7 0%, #1c7ed6 100%);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(28, 126, 214, 0.3);
}

.gate-btn-non {
  margin-top: 1.5rem;
  background: var(--cream);
  color: var(--text-muted);
  border: 1.5px solid var(--peach-light);
  position: absolute;
  transition: left 0.15s ease, top 0.15s ease;
}

.gate-message {
  margin: 1.2rem 0 0;
  min-height: 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--coral);
}

.frame-card.theme-blue {
  --cream: #f2f8ff;
  --peach-light: #e7f5ff;
  --peach: #a5d8ff;
  --orange: #4dabf7;
  --orange-deep: #1c7ed6;
  --shadow: 0 8px 24px rgba(28, 126, 214, 0.12);
}

.calendar-view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.back-btn {
  flex-shrink: 0;
  background: var(--white);
  border: 1.5px solid var(--peach);
  color: var(--orange-deep);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.back-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 97, 30, 0.18);
}

.calendar-intro {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 1.5rem;
}

@media (max-width: 800px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .day-limit {
    font-size: 0.5rem;
  }
}

.calendar-panel,
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.calendar-panel {
  align-self: start;
  position: relative;
}

.unavailable-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--text-dark);
  color: var(--white);
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.calendar-nav h2 {
  margin: 0;
  font-size: 1.3rem;
  text-transform: capitalize;
  color: var(--orange-deep);
}

.nav-btn {
  background: var(--peach-light);
  border: none;
  color: var(--orange-deep);
  font-size: 1.4rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease, transform 0.15s ease;
}

.nav-btn:hover {
  background: var(--peach);
  transform: scale(1.05);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-dark);
  transition: all 0.15s ease;
  padding: 4px;
}

.day-cell:hover {
  border-color: var(--peach);
}

.day-cell.other-month {
  opacity: 0.35;
  cursor: default;
}

.day-cell.other-month:hover {
  border-color: transparent;
}

.day-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--orange);
}

.day-cell.selected {
  background: var(--orange);
  color: var(--white);
  border-color: var(--orange-deep);
}

.day-cell.unavailable {
  background: repeating-linear-gradient(
    -45deg,
    var(--peach-light),
    var(--peach-light) 4px,
    var(--cream) 4px,
    var(--cream) 8px
  );
  color: var(--text-muted);
  cursor: not-allowed;
}

.day-cell.unavailable:hover {
  border-color: transparent;
}

.day-cell.partial-unavailable {
  border: 1.5px dashed var(--orange);
}

.day-limit {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--orange-deep);
  line-height: 1;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-cell.admin-mode {
  cursor: pointer;
}

.day-cell.admin-mode:hover {
  border-color: var(--orange-deep);
}

.day-dots {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  min-height: 6px;
}

.day-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--peach-light);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-zone {
  margin-top: 1rem;
  text-align: right;
}

.admin-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0;
  text-decoration: underline;
}

.admin-link:hover {
  color: var(--orange-deep);
}

.admin-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--orange-deep);
  text-align: left;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--orange-deep);
}

.selected-dates-preview {
  background: var(--peach-light);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-dark);
  min-height: 1.2rem;
}

.selected-dates-preview em {
  color: var(--text-muted);
}

.selected-date-chip {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--peach);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 0.8rem;
}

form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.8rem 0 0.3rem;
}

form input,
form select,
form textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1.5px solid var(--peach-light);
  background: var(--cream);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  resize: vertical;
}

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

.primary-btn {
  margin-top: 1.2rem;
  width: 100%;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  color: var(--white);
  border: none;
  padding: 0.75rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(244, 97, 30, 0.3);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-message {
  min-height: 1.2rem;
  font-size: 0.85rem;
  margin: 0.7rem 0 0;
  font-weight: 600;
}

.form-message.success {
  color: #2f9e44;
}

.form-message.error {
  color: var(--coral);
}

.upcoming-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 340px;
  overflow-y: auto;
}

.upcoming-item {
  background: var(--cream);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--orange);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.upcoming-item .details {
  font-size: 0.85rem;
}

.upcoming-item .date-label {
  font-weight: 700;
  color: var(--orange-deep);
  display: block;
}

.upcoming-item .who {
  color: var(--text-muted);
}

.upcoming-item .comment {
  font-style: italic;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.cancel-btn {
  flex-shrink: 0;
  background: var(--white);
  border: 1.5px solid var(--peach);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cancel-btn:hover {
  color: var(--coral);
  border-color: var(--coral);
  transform: translateY(-1px);
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.roulette-modal {
  position: fixed;
  inset: 0;
  background: rgba(74, 46, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.roulette-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.roulette-card h3 {
  margin: 0 0 1.2rem;
  color: var(--orange-deep);
  font-size: 1.1rem;
}

.roulette-wheel-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto;
}

.roulette-wheel-wrap canvas {
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.roulette-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
  color: var(--orange-deep);
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.roulette-result {
  margin: 1.2rem 0 0;
  min-height: 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--orange-deep);
}

.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(74, 46, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}

.admin-modal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  text-align: left;
  max-width: 360px;
  width: 100%;
}

.admin-modal-card h3 {
  margin: 0 0 1rem;
  color: var(--orange-deep);
  font-size: 1.1rem;
}

.admin-modal-card p {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.admin-modal-card input[type="password"],
.admin-modal-card select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1.5px solid var(--peach-light);
  background: var(--cream);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-top: 0.3rem;
}

.admin-modal-card input:focus,
.admin-modal-card select:focus {
  outline: none;
  border-color: var(--orange);
}

.modal-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.admin-modal-error {
  min-height: 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--coral);
  margin: 0.4rem 0 0;
}

.admin-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.3rem;
}

.admin-modal-actions button {
  flex: 1 1 auto;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.admin-modal-actions button:hover {
  transform: translateY(-1px);
}

.admin-modal-actions .primary-btn {
  margin-top: 0;
  width: auto;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  color: var(--white);
}

.admin-modal-actions .secondary-btn {
  background: var(--peach-light);
  color: var(--text-dark);
}

.app-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
