/* ============================================================
   PHUKET360 — calendrier.css
   Page calendrier des événements. Mobile-first.
   ============================================================ */

/* --- Page wrapper --- */
.cal-page {
  padding: 40px 0 60px;
}

.cal-header-section {
  text-align: center;
  margin-bottom: 28px;
}
.cal-subtitle {
  color: var(--text-light);
  font-size: 1rem;
  margin-top: 6px;
}
/* --- Navigation mois --- */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.cal-nav-btn {
  background: var(--ocean);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}
.cal-nav-btn:hover { background: var(--ocean-deep); }
.cal-month-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ocean-deep);
  min-width: 220px;
  text-align: center;
  text-transform: capitalize;
}

/* --- Légende catégories ---
   Une seule rangee scrollable, jamais de retour a la ligne (coherent avec
   #p360-parents-bar de la carte). Purement informative (pas de filtre au
   clic) : reste une legende, juste rendue compacte. Degrade de bord = indice
   discret que ca continue vers la droite. */
.cal-legend {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 2px;
}
.cal-legend::-webkit-scrollbar { display: none; }
.cal-legend::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 2px;
  width: 30px;
  background: linear-gradient(to right, transparent, var(--sable));
  pointer-events: none;
}
@media (min-width: 768px) {
  .cal-legend { justify-content: center; }
}
.legend-item {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 18px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* --- Couleurs catégories --- */
.cat-festival, .legend-item.cat-festival,
.agenda-badge.cat-festival, .detail-badge.cat-festival  { background: var(--sunset);      color: #fff; }
.cat-gastro,   .legend-item.cat-gastro,
.agenda-badge.cat-gastro,   .detail-badge.cat-gastro    { background: var(--soleil);      color: var(--ocean-deep); }
.cat-nature,   .legend-item.cat-nature,
.agenda-badge.cat-nature,   .detail-badge.cat-nature    { background: var(--emeraude);    color: #fff; }
.cat-sport,    .legend-item.cat-sport,
.agenda-badge.cat-sport,    .detail-badge.cat-sport     { background: var(--ocean);       color: #fff; }
.cat-culture,  .legend-item.cat-culture,
.agenda-badge.cat-culture,  .detail-badge.cat-culture   { background: var(--ocean-light); color: #fff; }
.cat-nightlife,.legend-item.cat-nightlife,
.agenda-badge.cat-nightlife,.detail-badge.cat-nightlife { background: var(--violet);      color: #fff; }

/* ============================================================
   CALENDRIER GRILLE — Desktop (>= 768px)
   ============================================================ */
.cal-grid { display: none; }

@media (min-width: 768px) {
  .cal-grid   { display: block; }
  .cal-agenda { display: none !important; }
}

/* En-têtes jours */
.cal-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--ocean-deep);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.cal-col-head {
  padding: 10px 6px;
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Semaine */
.cal-week {
  border-left: 1px solid #e0d9ce;
  border-right: 1px solid #e0d9ce;
  border-bottom: 1px solid #e0d9ce;
  background: #fff;
}
.cal-week:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

/* Rangée de jours (numéros) */
.cal-days-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid #ede8de;
}
.cal-day {
  padding: 6px 8px;
  min-height: 44px;
  border-right: 1px solid #ede8de;
  background: var(--sable);
}
.cal-day:last-child { border-right: none; }

.cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text);
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.cal-day.is-today .cal-day-num {
  background: var(--ocean-light);
  color: #fff;
}
.cal-day.is-other-month {
  background: #f5f1ea;
}
.cal-day.is-other-month .cal-day-num {
  color: var(--text-light);
  opacity: 0.5;
}

/* Rangée des barres d'événements */
.cal-events-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 22px;
  row-gap: 2px;
  padding: 3px 0 5px;
}

.cal-bar {
  height: 20px;
  border-radius: 3px;
  padding: 0 5px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  margin: 0 1px;
  transition: opacity 0.15s, filter 0.15s;
}
.cal-bar:hover    { opacity: 0.80; filter: brightness(1.06); }
.cal-bar:focus    { outline: 2px solid var(--ocean-light); outline-offset: 1px; }
.cal-bar-title {
  font-size: 0.70rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  flex: 1;
  min-width: 0;
}

/* Texte barres gastro (fond clair) */
.cal-bar.cat-gastro .cal-bar-title { color: var(--ocean-deep); }
.cal-bar:not(.cat-gastro) .cal-bar-title { color: #fff; }

/* États de chargement / erreur */
.cal-loading,
.cal-error {
  text-align: center;
  color: var(--text-light);
  padding: 60px 20px;
  font-size: 0.9rem;
}

/* ============================================================
   OVERLAY DRAWER (mobile uniquement)
   ============================================================ */
.cal-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 399;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.cal-drawer-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 768px) {
  .cal-drawer-overlay { display: none !important; }
}

/* ============================================================
   PANNEAU DE DÉTAIL — Mobile : drawer fixe remontant du bas
   ============================================================ */
.cal-detail {
  position: fixed;
  bottom: var(--mobile-nav-h, 65px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 24px 24px 32px;
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.18);
  z-index: 400;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              visibility 0.32s;
}
.cal-detail.is-open {
  transform: translateY(0);
  visibility: visible;
}

/* Desktop : panneau inline sous le calendrier */
@media (min-width: 768px) {
  .cal-detail {
    position: static;
    transform: none;
    visibility: visible;
    transition: none;
    max-height: none;
    overflow-y: visible;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--ocean-light);
    box-shadow: var(--shadow-md);
    margin-top: 20px;
    padding: 24px;
    display: none;
  }
  .cal-detail.is-open {
    display: block;
    animation: detail-in 0.18s ease;
  }
}

@keyframes detail-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.detail-close:hover { color: var(--text); background: #f0ebe2; }
.detail-inner { padding-right: 40px; }
.detail-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.detail-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ocean-deep);
  margin-bottom: 6px;
  line-height: 1.2;
}
.detail-date {
  font-size: 0.84rem;
  color: var(--text-light);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-desc {
  font-size: 0.90rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 18px;
}
.detail-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
  display: block;
}

.detail-link {
  display: inline-block;
  background: var(--ocean);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition);
}
.detail-link:hover { background: var(--ocean-deep); color: #fff; text-decoration: none; }

/* ============================================================
   VUE AGENDA — Mobile (< 768px)
   ============================================================ */
.cal-agenda { display: block; }

.cal-empty {
  text-align: center;
  color: var(--text-light);
  padding: 40px 0;
  font-size: 0.92rem;
}

.agenda-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: box-shadow var(--transition), transform 0.12s;
}
.agenda-card:hover  { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.agenda-card:focus  { outline: 2px solid var(--ocean-light); outline-offset: 2px; }

.cat-border-festival  { border-left-color: var(--sunset); }
.cat-border-gastro    { border-left-color: var(--soleil); }
.cat-border-nature    { border-left-color: var(--emeraude); }
.cat-border-sport     { border-left-color: var(--ocean); }
.cat-border-culture   { border-left-color: var(--ocean-light); }
.cat-border-nightlife { border-left-color: var(--violet); }

.agenda-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.agenda-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.agenda-badge.cat-gastro { color: var(--ocean-deep); }
.agenda-date {
  font-size: 0.80rem;
  color: var(--text-light);
}
.agenda-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ocean-deep);
  margin-bottom: 6px;
  line-height: 1.25;
}
.agenda-desc {
  font-size: 0.84rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

/* ============================================================
   FILTRES RAPIDES — au-dessus de la grille (mobile-first)
   Rangee distincte de la legende categories : ce sont de vrais filtres
   cliquables, les melanger avec la legende (purement informative) nuirait
   a la comprehension de ce qui est actionnable. Meme rangee scrollable
   compacte que le reste, degrade de bord inclus.
   ============================================================ */
.cal-filtres-rapides {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 2px;
}
.cal-filtres-rapides::-webkit-scrollbar { display: none; }
.cal-filtres-rapides::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 2px;
  width: 30px;
  background: linear-gradient(to right, transparent, var(--sable));
  pointer-events: none;
}
@media (min-width: 768px) {
  .cal-filtres-rapides { justify-content: center; }
}
.cal-filtre-btn {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 6px 13px;
  border-radius: 18px;
  border: 1.5px solid var(--ocean-light);
  background: #fff;
  color: var(--ocean-deep);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.cal-filtre-btn:hover { background: rgba(46,134,193,0.12); }
.cal-filtre-btn.is-active {
  background: var(--ocean);
  border-color: var(--ocean);
  color: #fff;
}

/* ============================================================
   SEO — liste HTML crawlable du mois, sous la grille JS
   ============================================================ */
.cal-seo-liste {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.cal-seo-titre {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ocean-deep);
  margin-bottom: 16px;
}
.cal-seo-vide {
  color: var(--text-light);
  font-size: 0.9rem;
}
.cal-seo-item {
  padding: 16px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.cal-seo-item:last-child { border-bottom: none; }
.cal-seo-item-titre {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ocean-deep);
  margin-bottom: 4px;
}
.cal-seo-item-titre a {
  color: inherit;
  text-decoration: none;
}
.cal-seo-item-titre a:hover { text-decoration: underline; }
.cal-seo-item-date {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 6px;
}
.cal-seo-item-desc {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
}

@media (min-width: 768px) {
  .cal-seo-liste { max-width: 760px; margin-left: auto; margin-right: auto; }
}
