/* ==========================================================================
   TCM Crowd Calendar v3.0 — Styles
   Les couleurs des niveaux sont injectées dynamiquement via wp_add_inline_style.
   Ce fichier ne contient que les fallbacks et la structure.
   ========================================================================== */

:root {
  --tcm-color-0: #e5e7eb;
  --tcm-color-1: #86efac;
  --tcm-color-2: #fde68a;
  --tcm-color-3: #f1aeb5;
  --tcm-color-4: #a370f7;
  --tcm-border: #e5e7eb;
  --tcm-text: #111827;
  --tcm-text-muted: #6b7280;
  --tcm-bg: #fff;
  --tcm-radius: 10px;
  --tcm-radius-lg: 12px;
  --tcm-transition: 0.2s ease;
}

/* Layout 2 colonnes */
.tcm-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 16px;
  align-items: start;
}
.tcm-col-left, .tcm-col-right { min-width: 0; }
.tcm-col-right { height: 100%; }

.tcm-calendar {
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius-lg);
  padding: 12px;
}

/* En-tête mois */
.tcm-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tcm-cal-header button {
  background: var(--tcm-bg);
  border: 1px solid var(--tcm-border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background var(--tcm-transition), border-color var(--tcm-transition);
}
.tcm-cal-header button:hover:not([disabled]) {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.tcm-title { margin: 0; text-transform: capitalize; }

/* Grille jours */
.tcm-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.tcm-grid-head {
  font-weight: 600;
  color: var(--tcm-text-muted);
  margin-bottom: 6px;
  text-align: center;
  font-size: 13px;
}

/* Cellule jour */
.tcm-grid-body .tcm-day {
  position: relative;
  height: 72px;
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius);
  background: var(--tcm-bg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px 6px 5px;
  cursor: pointer;
  transition: transform var(--tcm-transition), box-shadow var(--tcm-transition), background var(--tcm-transition);
}
.tcm-grid-body .tcm-day:hover:not(.tcm-day--empty) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.tcm-day.is-selected {
  outline: 2px solid #3b82f6;
  border: 2px solid #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59,130,246,0.2);
}
.tcm-day.is-selected .tcm-daynum {
  color: var(--tcm-text);
  font-weight: 700;
}
.tcm-day.is-today { border-color: #3b82f6; }
.tcm-day.is-today .tcm-daynum { color: #3b82f6; font-weight: 700; }

/* Niveaux d'affluence (fallbacks — surchargés par inline style dynamique) */
.tcm-day[data-level="1"] { background: #86efac33; }
.tcm-day[data-level="2"] { background: #fde68a33; }
.tcm-day[data-level="3"] { background: #f1aeb5; }
.tcm-day[data-level="4"] { background: #a370f7; color: #fff; }

.tcm-day .tcm-daynum { font-weight: 600; }
.tcm-flag {
  position: absolute;
  right: 6px;
  top: 6px;
  font-size: 16px;
  line-height: 1;
}

/* Barre d'attente moyenne v2 */
.tcm-wait-wrap {
  width: 100%;
  margin-top: auto;
}
.tcm-wait-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.tcm-wait-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.tcm-wait-label {
  font-size: 9px;
  line-height: 1;
  color: var(--tcm-text-muted);
  text-align: right;
  margin-top: 1px;
}
/* Adaptation niveau 3 (fond rose — track plus visible) */
.tcm-day[data-level="3"] .tcm-wait-bar-wrap {
  background: rgba(255,255,255,0.5);
}
/* Adaptation niveau 4 (fond sombre) */
.tcm-day[data-level="4"] .tcm-wait-bar-wrap {
  background: rgba(255,255,255,0.2);
}
.tcm-day[data-level="4"] .tcm-wait-bar {
  background: rgba(255,255,255,0.75) !important;
}
.tcm-day[data-level="4"] .tcm-wait-label {
  color: rgba(255,255,255,0.7);
}

/* Légende v2 — Barre d'échelle */
.tcm-legend-v2 {
  margin-bottom: 12px;
}
.tcm-legend-scale {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  height: 30px;
}
.tcm-legend-seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.tcm-legend-seg--1 { background: #86efac55; color: #166534; }
.tcm-legend-seg--2 { background: #fde68a66; color: #92400e; }
.tcm-legend-seg--3 { background: #f1aeb5; color: #881337; }
.tcm-legend-seg--4 { background: #a370f7; color: #fff; }
.tcm-legend-hints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
  padding: 0 4px;
}
.tcm-legend-extras {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
  align-items: center;
}
.tcm-legend-extra {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* Mini-barre dans la légende */
.tcm-legend-bar {
  display: inline-block;
  width: 22px;
  height: 5px;
  background: rgba(0,0,0,0.08);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.tcm-legend-bar-fill {
  display: block;
  width: 60%;
  height: 100%;
  background: #6b7280;
  border-radius: 3px;
}

/* Ancien style légende (conservé pour rétrocompat shortcode 6m si besoin) */
.tcm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  padding: 8px 0;
  margin: 8px 0 0 0;
  font-size: 13px;
}
.tcm-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  margin-right: 6px;
  border: 1px solid #d1d5db;
  vertical-align: middle;
}
.tcm-dot[data-level="1"] { background: #86efac; }
.tcm-dot[data-level="2"] { background: #fde68a; }
.tcm-dot[data-level="3"] { background: #f1aeb5; }
.tcm-dot[data-level="4"] { background: #a370f7; }

/* Panneau de détails v2 */
.tcm-details {
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}
.tcm-details[hidden] { display: none !important; }
.tcm-details-empty {
  opacity: .8;
  font-style: italic;
  padding: 12px;
}

.tcm-panel {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.tcm-panel-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #e5e7eb;
}
.tcm-panel-date {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.tcm-panel-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.1);
  color: #111827;
  white-space: nowrap;
}
.tcm-panel-body {
  padding: 14px;
}
.tcm-panel-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.tcm-metric {
  background: #f9fafb;
  border-radius: 8px;
  padding: 10px;
}
.tcm-metric-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}
.tcm-metric-value {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
}
.tcm-metric-unit {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
}
.tcm-panel-gauge {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.tcm-panel-gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.tcm-panel-level-bars {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}
.tcm-panel-level-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  transition: background 0.3s ease;
}
.tcm-panel-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid #f3f4f6;
  font-size: 13px;
}
.tcm-panel-row[hidden] { display: none !important; }
.tcm-panel-row-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}
.tcm-panel-row-label {
  color: #6b7280;
  min-width: 75px;
  flex-shrink: 0;
}
.tcm-panel-row-value {
  color: #111827;
  font-weight: 500;
}
.tcm-panel-cta {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff !important;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s ease;
  box-sizing: border-box;
}
.tcm-panel-cta:hover { background: #2563eb; }

/* Section météo dans le panneau */
.tcm-panel-meteo {
  margin-top: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 10px;
}
.tcm-panel-meteo[hidden] { display: none !important; }
.tcm-panel-meteo-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.tcm-panel-meteo-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.tcm-meteo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
}
.tcm-meteo-cond {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
.tcm-meteo-temps {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-top: 2px;
}
.tcm-meteo-tmax {
  font-size: 18px;
  font-weight: 600;
  color: #dc2626;
}
.tcm-meteo-tmin {
  font-size: 14px;
  color: #3b82f6;
}
.tcm-panel-meteo-details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.tcm-meteo-detail {
  text-align: center;
}
.tcm-meteo-detail-icon {
  font-size: 16px;
  line-height: 1;
  margin-bottom: 2px;
}
.tcm-meteo-detail-val {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}
.tcm-meteo-detail-lbl {
  font-size: 10px;
  color: #6b7280;
}

/* Animation d'apparition du panneau */
.tcm-details-animate .tcm-panel {
  animation: tcm-fadeIn 0.3s ease;
}
@keyframes tcm-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Vue 6 mois compacte */
.tcm-multi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tcm-month {
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius);
  padding: 8px;
}
.tcm-cal-header--compact .tcm-title { font-size: 14px; }
.tcm-grid-head--compact { font-size: 12px; margin-bottom: 4px; }
.tcm-grid-body--compact .tcm-day { height: 32px; padding: 8px; }
.tcm-grid-body--compact .tcm-day .tcm-daynum { font-size: 12px; }

/* Nav désactivée */
.tcm-prev[disabled], .tcm-next[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* Admin */
.tcm-grid-admin {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.tcm-admin-cell {
  border: 1px solid var(--tcm-border);
  border-radius: var(--tcm-radius);
  padding: 8px;
  background: var(--tcm-bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background var(--tcm-transition), border-color var(--tcm-transition);
}
.tcm-admin-day { font-weight: 600; }
.tcm-select, .tcm-note, .tcm-wait, .tcm-event { width: 100%; }

.tcm-admin-cell.level-1 { background: #86efac33; border-color: #86efac; }
.tcm-admin-cell.level-2 { background: #fde68a33; border-color: #fde68a; }
.tcm-admin-cell.level-3 { background: #f1aeb5;   border-color: #f1aeb5; }
.tcm-admin-cell.level-4 { background: #a370f733; border-color: #a370f7; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .tcm-layout { grid-template-columns: 1fr; }
  .tcm-multi  { grid-template-columns: repeat(2, 1fr); }
  .tcm-grid-admin { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 600px) {
  .tcm-grid { gap: 3px; }
  .tcm-grid-body .tcm-day {
    height: 52px;
    padding: 4px 4px 3px;
    border-radius: 8px;
  }
  .tcm-grid-body .tcm-day .tcm-daynum { font-size: 12px; }
  .tcm-flag { font-size: 12px; right: 3px; top: 3px; }
  .tcm-wait-label { display: none; }
  .tcm-wait-bar-wrap { height: 5px; }
  .tcm-legend { gap: 8px; font-size: 11px; }
  .tcm-legend-scale { height: 26px; }
  .tcm-legend-seg { font-size: 10px; }
  .tcm-legend-extras { gap: 10px; font-size: 11px; }
  .tcm-multi { grid-template-columns: 1fr; }
  .tcm-grid-admin { grid-template-columns: repeat(2, 1fr); }
  .tcm-cal-header button { padding: 4px 8px; font-size: 13px; }
}

@media (max-width: 400px) {
  .tcm-grid-body .tcm-day { height: 42px; }
  .tcm-grid-head { font-size: 11px; }
  .tcm-wait-bar-wrap { height: 4px; }
  .tcm-legend-scale { height: 22px; }
  .tcm-legend-seg { font-size: 9px; }
  .tcm-legend-hints { font-size: 9px; }
}

/* ==========================================================================
   TCM Price Calendar v4 — Tarifs
   ========================================================================== */

/* Période tarifaire — couleurs des cellules (6 niveaux Disney) */
.tcm-price-mode .tcm-day[data-price-level="green"]   { background: rgba(74,222,128,0.18); }
.tcm-price-mode .tcm-day[data-price-level="teal"]    { background: rgba(45,212,191,0.18); }
.tcm-price-mode .tcm-day[data-price-level="blue"]    { background: rgba(96,165,250,0.18); }
.tcm-price-mode .tcm-day[data-price-level="yellow"]  { background: rgba(250,204,21,0.18); }
.tcm-price-mode .tcm-day[data-price-level="orange"]  { background: rgba(251,146,60,0.18); }
.tcm-price-mode .tcm-day[data-price-level="red"]     { background: rgba(248,113,113,0.18); }
.tcm-price-mode .tcm-day[data-price-level="unknown"] { background: rgba(156,163,175,0.08); }

/* Prix affiché dans la cellule */
.tcm-price-tag {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  margin-top: auto;
  display: block;
  text-align: center;
}
.tcm-price-tag--compact {
  font-size: 9px;
}
.tcm-price-mode .tcm-day[data-price-level="green"] .tcm-price-tag   { color: #166534; }
.tcm-price-mode .tcm-day[data-price-level="teal"] .tcm-price-tag    { color: #115e59; }
.tcm-price-mode .tcm-day[data-price-level="blue"] .tcm-price-tag    { color: #1e40af; }
.tcm-price-mode .tcm-day[data-price-level="yellow"] .tcm-price-tag  { color: #854d0e; }
.tcm-price-mode .tcm-day[data-price-level="orange"] .tcm-price-tag  { color: #9a3412; }
.tcm-price-mode .tcm-day[data-price-level="red"] .tcm-price-tag     { color: #991b1b; }

/* Légende tarifaire (6 segments) */
.tcm-price-legend {
  margin-bottom: 12px;
}
.tcm-price-legend-scale {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  height: 28px;
}
.tcm-price-seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}
.tcm-price-seg--green  { background: rgba(74,222,128,0.3);  color: #166534; }
.tcm-price-seg--teal   { background: rgba(45,212,191,0.3);  color: #115e59; }
.tcm-price-seg--blue   { background: rgba(96,165,250,0.3);  color: #1e40af; }
.tcm-price-seg--yellow { background: rgba(250,204,21,0.25); color: #854d0e; }
.tcm-price-seg--orange { background: rgba(251,146,60,0.3);  color: #9a3412; }
.tcm-price-seg--red    { background: rgba(248,113,113,0.3); color: #991b1b; }

.tcm-price-legend-hints {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
  padding: 0 4px;
}

/* Cards prix dans le panneau détails */
.tcm-panel-price-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.tcm-price-card {
  background: #f9fafb;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #f3f4f6;
}
.tcm-price-card-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.tcm-price-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
}
.tcm-price-card-label {
  font-size: 12px;
  color: #6b7280;
}
.tcm-price-val {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

/* Admin — champs prix */
.tcm-prix {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fefce8;
}
.tcm-prix:focus {
  border-color: #f59e0b;
  outline: none;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.2);
}

/* Responsive price calendar */
@media (max-width: 600px) {
  .tcm-price-legend-scale { height: 24px; }
  .tcm-price-seg { font-size: 9px; }
  .tcm-price-tag { font-size: 9px; }
  .tcm-price-tag--compact { font-size: 8px; }
  .tcm-panel-price-cards { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .tcm-price-legend-scale { height: 20px; }
  .tcm-price-seg { font-size: 8px; }
}
