/* ==========================================
   CALENDRIER D'OUVERTURE - PUY DU CRAFT
   Style inspiré du Puy du Fou
   ========================================== */

.calendrier-page {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #fefbf3;
  padding-top: 160px;
  padding-bottom: 60px;
  min-height: 100vh;
}

/* --- EN-TÊTE --- */
.cal-hero {
  text-align: center;
  padding: 30px 15px 20px;
}

.cal-hero h1 {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.cal-hero p {
  font-size: 1rem;
  color: #555;
  margin-bottom: 0;
}

/* --- LAYOUT PRINCIPAL --- */
.cal-main-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto 40px auto;
  padding: 0 15px;
}

.cal-calendar-side {
  flex: 1;
  max-width: 800px;
  width: 100%;
}

.cal-legend-side {
  width: 250px;
  flex-shrink: 0;
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e5e0d8;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  margin-top: 61px; /* Aligné avec le haut de la grille */
}

.cal-legend-side h3 {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.2rem;
  color: #800020;
  margin-bottom: 15px;
  border-bottom: 2px solid #e5e0d8;
  padding-bottom: 8px;
}

/* --- LÉGENDE --- */
.cal-legend {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

.cal-legend-dot {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
}

.cal-legend-dot.closed {
  background-color: transparent;
  border: 1px solid #e8e8e8;
}

.cal-legend-dot.open {
  background-color: transparent;
  border: 1px solid #2e7d32;
}

.cal-legend-dot.noces {
  background-color: transparent;
  border: 1px solid #cc0000;
}

.cal-legend-dot.noel {
  background-color: transparent;
  border: 1px solid #1e88e5;
}

.cal-legend-dot.foulee {
  background-color: transparent;
  border: 1px solid #8e24aa;
}

/* --- NAVIGATION MOIS --- */
.cal-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 25px;
}

.cal-current-label {
  text-align: center;
  min-width: 280px;
}

.cal-current-label .month-label {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #800020;
  display: inline-block;
}

.cal-nav-btn {
  background: #800020;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  transition: background 0.2s, transform 0.15s;
}

.cal-nav-btn:hover {
  background: #a80020;
  transform: scale(1.1);
}

/* --- GRILLE CALENDRIER --- */
.cal-container {
  width: 100%;
  margin: 0;
  padding: 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}

.cal-month {
  background: #ffffff;
  border: 1px solid #e5e0d8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.cal-month-header {
  background: transparent;
  color: #800020;
  border-bottom: 1px solid #e5e0d8;
  text-align: center;
  padding: 10px 12px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cal-month-body {
  padding: 8px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #888;
  padding: 4px 0;
  text-transform: uppercase;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

/* --- CELLULES JOURS --- */
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: default;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  min-height: 32px;
}

.cal-day.empty {
  background: transparent;
  cursor: default;
}

.cal-day.closed {
  background-color: transparent;
  border: 1px solid #e8e8e8;
  color: #999;
}

.cal-day.open {
  background-color: transparent;
  border: 1px solid #2e7d32;
  color: #2e7d32;
  cursor: pointer;
}

.cal-day.open:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(46, 125, 50, 0.2);
  z-index: 2;
  background-color: #f1f8e9;
}

.cal-day.open_noces {
  background-color: transparent;
  border: 1px solid #cc0000;
  color: #cc0000;
  cursor: pointer;
}

.cal-day.open_noces:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(204, 0, 0, 0.2);
  z-index: 2;
  background-color: #ffebee;
}

.cal-day.noel {
  background-color: transparent;
  border: 1px solid #1e88e5;
  color: #1e88e5;
  cursor: pointer;
}
.cal-day.noel:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(30, 136, 229, 0.2);
  z-index: 2;
  background-color: #e3f2fd;
}

.cal-day.foulee {
  background-color: transparent;
  border: 1px solid #8e24aa;
  color: #8e24aa;
  cursor: pointer;
}
.cal-day.foulee:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(142, 36, 170, 0.2);
  z-index: 2;
  background-color: #f3e5f5;
}

.cal-day.today {
  outline: 3px solid #800020;
  outline-offset: -1px;
  font-weight: 800;
}

/* --- TOOLTIP (info au survol) --- */
.cal-tooltip {
  display: none;
  position: fixed;
  background: #ffffff;
  border: 1px solid #e5e0d8;
  border-top: 4px solid #800020;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  min-width: 220px;
  max-width: 280px;
  font-size: 0.85rem;
  pointer-events: none;
}

.cal-tooltip.visible {
  display: block;
}

.cal-tooltip-date {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 700;
  font-size: 1rem;
  color: #800020;
  margin-bottom: 8px;
}

.cal-tooltip-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.cal-tooltip-status.closed {
  background: transparent;
  border: 1px solid #e8e8e8;
  color: #666;
}

.cal-tooltip-status.open {
  background: transparent;
  border: 1px solid #2e7d32;
  color: #2e7d32;
}

.cal-tooltip-status.open_noces {
  background: transparent;
  border: 1px solid #cc0000;
  color: #cc0000;
}

.cal-tooltip-status.noel {
  background: transparent;
  border: 1px solid #1e88e5;
  color: #1e88e5;
}

.cal-tooltip-status.foulee {
  background: transparent;
  border: 1px solid #8e24aa;
  color: #8e24aa;
}

.cal-tooltip-hours {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #444;
}

.cal-tooltip-hours span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-tooltip-note {
  margin-top: 6px;
  font-style: italic;
  color: #777;
  font-size: 0.8rem;
}

.cal-tooltip-click-hint {
  margin-top: 12px;
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.cal-tooltip-click-hint .fake-btn {
  display: inline-block;
  background: #800020;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.cal-tooltip-click-hint .fake-btn.edit {
  background: #555;
}

/* --- PANNEAU ADMIN --- */
.cal-admin-section {
  max-width: 1200px;
  margin: 30px auto 0;
  padding: 0 15px;
}

.cal-admin-toggle {
  display: block;
  margin: 0 auto 20px;
  padding: 12px 24px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.cal-admin-toggle:hover {
  background: #444;
}

.cal-admin-panel {
  display: none;
  background: #f8f6f2;
  border: 1px solid #800020;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.cal-admin-panel.active {
  display: block;
}

.cal-admin-panel h3 {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: #800020;
  font-size: 1.2rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e5e0d8;
}

.cal-admin-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.cal-admin-quick label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #333;
}

.cal-admin-quick select,
.cal-admin-quick input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
}

.cal-admin-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.cal-admin-btn:active {
  transform: scale(0.97);
}

.cal-admin-btn.primary {
  background: #800020;
  color: #fff;
}

.cal-admin-btn.primary:hover {
  background: #a80020;
}

.cal-admin-btn.success {
  background: #2e7d32;
  color: #fff;
}

.cal-admin-btn.success:hover {
  background: #1b5e20;
}

.cal-admin-btn.danger {
  background: #c62828;
  color: #fff;
}

.cal-admin-btn.danger:hover {
  background: #b71c1c;
}

.cal-admin-edit {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.cal-admin-edit h4 {
  font-size: 0.95rem;
  color: #800020;
  margin-bottom: 12px;
}

.cal-admin-edit .form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.cal-admin-edit .form-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
  min-width: 100px;
}

.cal-admin-edit .form-row select,
.cal-admin-edit .form-row input {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

.cal-admin-range {
  background: #eef2f5;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.cal-admin-range h4 {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 12px;
}

.cal-admin-range .form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.cal-admin-range .form-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
}

.cal-admin-range .form-row input,
.cal-admin-range .form-row select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

.cal-admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e5e0d8;
}

.cal-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #2e7d32;
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 10001;
  pointer-events: none;
}

.cal-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.cal-toast.error {
  background: #c62828;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
  .cal-main-layout {
    flex-direction: column;
    align-items: center;
  }
  .cal-legend-side {
    width: 100%;
    max-width: 500px;
    margin-top: 0;
  }
  .cal-legend {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .calendrier-page {
    padding-top: 120px;
  }
  
  .cal-hero h1 {
    font-size: 1.6rem;
  }

  .cal-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Afficher 1 seul mois sur mobile */
  .cal-month:nth-child(2),
  .month-sep,
  .month-2 {
    display: none !important;
  }

  .cal-legend {
    gap: 12px;
  }

  .cal-legend-item {
    font-size: 0.78rem;
  }

  .cal-day {
    font-size: 0.7rem;
    min-height: 28px;
  }
}

@media (max-width: 480px) {
  .cal-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    max-width: 350px;
    margin: 0 auto;
  }

  .cal-day {
    font-size: 0.85rem;
    min-height: 36px;
  }

  .cal-admin-quick {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- Évènement du mois --- */
.cal-month-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cal-month-event-text {
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 3px;
  display: block;
  opacity: 0.95;
}

.cal-admin-month-event {
  background: #fdfaf5;
  border: 1px solid #e5e0d8;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}

.cal-admin-month-event h4 {
  font-size: 0.95rem;
  color: #800020;
  margin-bottom: 12px;
}

.cal-admin-month-event .form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.cal-admin-month-event .form-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
  min-width: 100px;
}

.cal-admin-month-event .form-row input[type="text"],
.cal-admin-month-event .form-row input[type="month"] {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

.cal-admin-month-event .form-row input[type="color"] {
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 45px;
  height: 35px;
  cursor: pointer;
}

/* --- MODAL JOUR --- */
.cal-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 99999;
  display: flex; align-items: center; justify-content: center;
}
.cal-modal-content {
  background: #fff; padding: 25px; border-radius: 12px;
  text-align: center; max-width: 350px; width: 90%;
  position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.cal-modal-close {
  position: absolute; top: 12px; right: 15px; font-size: 26px;
  background: none; border: none; cursor: pointer; color: #888;
  line-height: 1; padding: 0;
}
.cal-modal-close:hover { color: #333; }
.cal-modal-content h3 {
  margin: 0 0 15px 0; font-size: 1.3rem; color: #333;
}
.cal-modal-content #cal-modal-hours span {
  display: block; margin-bottom: 5px; font-size: 0.9rem;
}
.cal-modal-btn {
  display: inline-block; margin-top: 20px; background: #800020;
  color: white !important; text-decoration: none; padding: 12px 20px;
  border-radius: 8px; font-weight: bold; font-size: 1rem;
  transition: background 0.2s;
}
.cal-modal-btn:hover { background: #600018; }

/* --- Mois avec évènement spécial (carte à contour coloré) --- */
.cal-month-header.has-event {
  --pdc-event-color: #d2783a;
  background: #ffffff;
  border: 4px solid var(--pdc-event-color);
  border-radius: 8px;
  margin: 10px;
  padding: 12px 16px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pdc-event-color) 35%, transparent);
  text-transform: none;
  letter-spacing: 0;
}
.cal-month-header.has-event > span {
  color: #111;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}
.cal-month-header.has-event .cal-month-event-text {
  color: var(--pdc-event-color);
  font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 8px;
  opacity: 1;
}
@media (max-width: 768px) {
  .cal-month-header.has-event > span { font-size: 1.3rem; }
  .cal-month-header.has-event .cal-month-event-text { font-size: 0.85rem; }
}
