/* ============================================================================
 * JOURNEY — Page Journée (calendrier hebdo + édition jour par jour)
 * ============================================================================
 * Layout :
 *   ┌─ Header (semaine + flèches navigation)
 *   ├─ Barre 7 jours (Lun → Dim, scrollable horizontalement)
 *   ├─ Page jour (swipable)
 *   └─ Récap semaine (Total Travail / Trajet / H. supp)
 * ============================================================================ */

/* Page Journey en layout absolu : couvre toute la zone disponible
   au-dessus de la bottom-nav, sans dépendre de .app */
#page-journey {
  display: none;
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  flex-direction: column;
  padding: 0;
  gap: 0;
  /* v3.4.1 : fond opaque pour que la home ne transparaisse pas en dessous */
  background: var(--page-bg);
  z-index: 50;
}
#page-journey.active {
  display: flex;
  animation: page-enter var(--duration-page) var(--ease-out);
}

/* v3.4.1 : Titre de la page (HISTORIQUE) au-dessus de "Semaine 19" */
.journey-page-title {
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 8px 0 4px;
  flex-shrink: 0;
}

/* ── HEADER SEMAINE ─────────────────────────────────────────── */
.journey-week-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--app-padding-x) 12px;
  border-bottom: 1px solid var(--card-stroke);
}

.journey-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white-soft-04);
  border: 1px solid var(--card-stroke);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-base) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.journey-nav-btn:active {
  transform: scale(0.92);
  background: var(--white-soft-08);
}
.journey-nav-ico svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#journeyNextIco svg {
  transform: rotate(180deg);
}

.journey-week-title {
  flex: 1;
  text-align: center;
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  border-radius: var(--radius-button);
  transition: background var(--duration-base) var(--ease-out);
}
.journey-week-title:active {
  background: var(--white-soft-04);
}
.journey-week-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}
.journey-week-range {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── BARRE 7 JOURS ──────────────────────────────────────────── */
.journey-days-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 12px var(--app-padding-x);
  border-bottom: 1px solid var(--card-stroke);
}

.journey-day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: var(--radius-button);
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}
.journey-day-cell:active {
  background: var(--white-soft-04);
}
.journey-day-cell.active {
  background: var(--white-soft-08);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow-soft);
}
.journey-day-cell.today .journey-day-cell-num {
  color: var(--accent);
  font-weight: 700;
}
.journey-day-cell-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.journey-day-cell-num {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.journey-day-cell-dot {
  /* v3.4.1 : plus gros pour mieux voir l'état */
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
}
/* v3.4.1 : "filled" = jour validé/badgé → VERT (success), pas accent */
.journey-day-cell-dot.filled  { background: var(--success); }
.journey-day-cell-dot.ferie   { background: var(--orange); }
.journey-day-cell-dot.repos   { background: var(--text-dim); }
.journey-day-cell-dot.maladie { background: var(--danger); }
.journey-day-cell-dot.vacances{ background: var(--success); }

/* ── PAGE JOUR ──────────────────────────────────────────────── */
.journey-day-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* Pour le swipe horizontal ↔ */
  touch-action: pan-y;
}

.journey-day {
  /* v3.4.1 : padding-bottom + safe-bottom pour que le contenu en bas
     ne soit jamais coupé par le recap+nav fixés en bas */
  padding: 16px var(--app-padding-x) 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Animation slide quand on change de jour */
.journey-day.slide-out-left  { animation: slideOutLeft  240ms var(--ease-out) forwards; }
.journey-day.slide-out-right { animation: slideOutRight 240ms var(--ease-out) forwards; }
.journey-day.slide-in-left   { animation: slideInLeft   240ms var(--ease-out) forwards; }
.journey-day.slide-in-right  { animation: slideInRight  240ms var(--ease-out) forwards; }

@keyframes slideOutLeft  { to { transform: translateX(-30%); opacity: 0; } }
@keyframes slideOutRight { to { transform: translateX(30%);  opacity: 0; } }
@keyframes slideInLeft   { from { transform: translateX(30%);  opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInRight  { from { transform: translateX(-30%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── HEADER DU JOUR (date + statut) ─────────────────────────── */
.journey-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.journey-day-date-wrap {
  display: flex;
  flex-direction: column;
}
.journey-day-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.journey-day-date {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.journey-status-badge {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform var(--duration-fast) var(--ease-out);
}
.journey-status-badge:active {
  transform: scale(0.96);
}
.journey-status-badge[data-color="blue"]   { background: rgba(59, 130, 246, 0.18);  color: #93c5fd; border-color: rgba(59, 130, 246, 0.4); }
.journey-status-badge[data-color="orange"] { background: rgba(251, 146, 60, 0.18);  color: #fdba74; border-color: rgba(251, 146, 60, 0.4); }
.journey-status-badge[data-color="gray"]   { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.32); }
.journey-status-badge[data-color="red"]    { background: rgba(239, 68, 68, 0.18);   color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }
.journey-status-badge[data-color="green"]  { background: rgba(16, 185, 129, 0.18);  color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.journey-status-badge[data-color="cyan"]   { background: rgba(34, 211, 238, 0.18);  color: #67e8f9; border-color: rgba(34, 211, 238, 0.4); }

/* ── CHANTIER ───────────────────────────────────────────────── */
.journey-section {
  background: var(--card-bg);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.journey-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.journey-chantier-input {
  width: 100%;
  background: var(--white-soft-04);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-button);
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
}
.journey-chantier-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}

/* ── HORAIRES (4 inputs time) ───────────────────────────────── */
.journey-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.journey-time-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--white-soft-04);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-button);
  transition: border-color var(--duration-base) var(--ease-out);
}
.journey-time-block:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.journey-time-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.journey-time-input {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  /* Cacher le picto par défaut sur Safari */
  -webkit-appearance: none;
  appearance: none;
}
.journey-time-input:focus { outline: none; }
.journey-time-input::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  opacity: 0.5;
}

/* ── TOTAUX DU JOUR ──────────────────────────────────────────── */
.journey-totals {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.journey-total {
  text-align: center;
  padding: 12px 8px;
  background: var(--card-bg);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-button);
}
.journey-total-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.journey-total-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.journey-total-value.empty { color: var(--text-dim); font-weight: 500; }
.journey-total-value.ferie { color: var(--orange); }
.journey-total-value.supp  { color: var(--orange); font-style: italic; }

/* ── RÉCAP SEMAINE EN BAS ────────────────────────────────────── */
.journey-week-recap {
  padding: 12px var(--app-padding-x);
  border-top: 1px solid var(--card-stroke);
  background: var(--dark-deep-55);
  display: flex;
  justify-content: space-around;
  flex-shrink: 0;
}
.journey-week-recap-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.journey-week-recap-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.journey-week-recap-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.journey-week-recap-value.supp { color: var(--orange); }

/* ── BOTTOM SHEET STATUT ─────────────────────────────────────── */
.status-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background var(--duration-base) var(--ease-out);
}
.status-sheet-overlay.show {
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.status-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--card-stroke-strong);
  border-radius: 24px 24px 0 0;
  padding: 14px 18px calc(28px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--duration-base) var(--ease-momentum);
}
.status-sheet-overlay.show .status-sheet {
  transform: translateY(0);
}
.status-sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--white-soft-15);
  margin: 0 auto 14px;
}
.status-sheet-title {
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  text-align: center;
  margin-bottom: 14px;
}
.status-sheet-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.status-sheet-item {
  padding: 12px 14px;
  border-radius: var(--radius-button);
  background: var(--white-soft-04);
  border: 1.5px solid transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}
.status-sheet-item:active {
  background: var(--white-soft-08);
}
.status-sheet-item.selected {
  border-color: var(--accent);
  background: var(--white-soft-08);
}
.status-sheet-item-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-sheet-item-dot[data-color="blue"]   { background: #3b82f6; }
.status-sheet-item-dot[data-color="orange"] { background: #fb923c; }
.status-sheet-item-dot[data-color="gray"]   { background: #94a3b8; }
.status-sheet-item-dot[data-color="red"]    { background: #ef4444; }
.status-sheet-item-dot[data-color="green"]  { background: #10b981; }
.status-sheet-item-dot[data-color="cyan"]   { background: #22d3ee; }

.status-sheet-close {
  width: 100%;
  padding: 12px;
  background: var(--white-soft-04);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-button);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ── État férié forfait : on cache horaires ─────────────────── */
.journey-day[data-no-times="true"] .journey-times,
.journey-day[data-no-times="true"] .journey-chantier-section {
  display: none;
}
.journey-day-empty-msg {
  display: none;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
  background: var(--card-bg);
  border: 1px dashed var(--card-stroke);
  border-radius: var(--radius-card);
}
.journey-day[data-no-times="true"] .journey-day-empty-msg {
  display: block;
}
