/**
 * s1-plans.css — Composants MES PLANS
 * Réutilisables : .plan-metrics-grid, .metric-card, .progress-track,
 *                 .section-row, .bottom-nav
 */

/* ─── FOND D'ÉCRAN ───────────────────────────────────────────────────────── */

#screen-1 { background: linear-gradient(to right, #F8F6FD, #FAF8FF); min-height: 100dvh; }

/* ─── HEADER ─────────────────────────────────────────────────────────────── */

.s1-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + var(--s-4)) var(--s-4) var(--s-2);
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(to right, #F8F6FD, #FAF8FF);
}

.s1-header-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink);
}

/* Bouton logout dans un cercle avec ombre douce */
.btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c-surface);
  box-shadow: 0 2px 10px rgba(0,0,0,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  color: var(--c-ink-2);
  flex-shrink: 0;
}

.btn-circle:active { background: var(--c-bg); }

/* ─── GREETING ───────────────────────────────────────────────────────────── */

.greeting {
  padding: var(--s-3) var(--s-4) var(--s-4);
}

.greeting-line {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.25;
}

.greeting-name  { color: var(--c-accent); }

.greeting-sub {
  font-size: 14px;
  color: var(--c-ink-3);
  margin-top: 3px;
}

/* ─── PLAN CARD (plan actif — featured) ──────────────────────────────────── */

.plan-card {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  padding: var(--s-4);
  margin: 0 var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  border: 2px dashed var(--c-accent);
}

/* Ligne supérieure : durée + menu ⋮ — toujours sur la même ligne */
.plan-card-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.plan-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
  background: var(--c-accent-light);
  padding: 4px 10px;
  border-radius: var(--r-s);
}

.plan-card-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--c-accent);
  border-radius: var(--r-s);
  font-size: 20px;
  letter-spacing: 1px;
}

.plan-card-menu:active { background: var(--c-bg); }

/* Titre + devise inline (sans badge) */
.plan-card-title-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}

.plan-card-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--c-ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Devise inline — pas de background, juste du texte */
.plan-card-currency {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-ink);
}

/* Dates + durée */
.plan-card-dates {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: 14px;
  color: var(--c-ink-3);
  padding: 4px 0px 18px;
}

.plan-card-dates svg { flex-shrink: 0; }

.plan-card-duration {
  font-size: 12px;
  color: var(--c-ink-3);
  font-weight: 500;
}

/* ─── 2 METRIC CARDS (budget restant | budget/jour) ─────────────────────── */

.plan-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

/* Chaque card métrique individuelle */
.metric-card {
  background: #FAF8FF;
  border-radius: var(--r-m);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-gray);
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* Budget/jour — accent indigo, jamais rouge */
.metric-value--jour { color: var(--c-accent); }

.metric-sub {
  font-size: 14px;
  color: var(--c-ink-3);
  font-variant-numeric: tabular-nums;
}

/* Barre de progression — arrondie et douce */
.progress-track {
  height: 5px;
  background: rgba(79,86,211,0.12);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--c-accent);
  transition: width 0.4s ease;
}

/* ─── CTA DU PLAN CARD ────────────────────────────────────────────────────── */

.plan-card-cta {
  display: block;
  text-align: center;
  width: 100%;
  padding: 14px var(--s-4);
  background: var(--c-accent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: background .15s;
}

.plan-card-cta:hover  { background: #3d44b8; }
.plan-card-cta:active { background: #3034a0; }

/* ─── EN-TÊTE DE SECTION (réutilisable) ──────────────────────────────────── */

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--s-4) var(--s-2);
}

.section-row-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-ink-2);
}

.section-row-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* ─── ITEM COMPACT (autres séjours) ──────────────────────────────────────── */

.plans-list {
  margin: 0 var(--s-4);
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  overflow: hidden;
}

.plan-mini {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  text-decoration: none;
  transition: background .1s;
}

.plan-mini:active { background: #F4F5FC; }
.plan-mini + .plan-mini { border-top: 1px solid var(--c-border); }

.plan-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--r-m);
  background: var(--c-accent-light);
  color: var(--c-accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan-mini-body    { flex: 1; min-width: 0; }

.plan-mini-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-mini-sub  { font-size: 12px; color: var(--c-ink-3); margin-top: 1px; }
.plan-mini-right { text-align: right; flex-shrink: 0; }

.plan-mini-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}

.plan-mini-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-green);
  margin-top: 1px;
}

/* ─── DONNÉES & SÉCURITÉ ─────────────────────────────────────────────────── */

.data-list {
  margin: 0 var(--s-4);
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  overflow: hidden;
}

.data-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  transition: background .1s;
}

.data-row:active { background: #F4F5FC; }
.data-row + .data-row { border-top: 1px solid var(--c-border); }

.data-row-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-m);
  background: #F4F5FC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent);
  flex-shrink: 0;
}

.data-row-body  { flex: 1; }

.data-row-title { font-size: 14px; font-weight: 600; color: var(--c-ink); }
.data-row-sub   { font-size: 12px; color: var(--c-ink-3); margin-top: 1px; }

/* ─── BOTTOM NAV (4 onglets) ─────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--s-2) 0;
  text-decoration: none;
  color: var(--c-ink-3);
  font-size: 10px;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .1s;
}

.bottom-nav-item.is-active { color: var(--c-accent); }

/* Espace pour que le contenu ne passe pas sous la nav */
.main-with-nav {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* ─── ACTION SHEET (⋮ menu plan actif) ───────────────────────────────────── */

.plan-action-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.25);
}

.plan-action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 301;
  background: var(--c-surface);
  border-radius: 16px 16px 0 0;
  padding: var(--s-3) var(--s-4) calc(env(safe-area-inset-bottom, 0px) + var(--s-4));
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  animation: dh-slide-up .22s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.plan-action-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink-3);
  text-align: center;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-1);
}

.plan-action-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-4);
  background: var(--c-bg);
  border: none;
  border-radius: var(--r-m);
  font-size: 15px;
  font-weight: 600;
  color: var(--c-ink);
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
}

.plan-action-item:active            { background: var(--c-border); }
.plan-action-item--danger           { color: var(--c-red); }

.plan-action-cancel {
  width: 100%;
  padding: var(--s-3);
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-ink-3);
  cursor: pointer;
  font-family: inherit;
  margin-top: var(--s-1);
}

/* ─── TOAST ──────────────────────────────────────────────────────────────── */

.s1-toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  max-width: 340px;
  width: calc(100% - 48px);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-m);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: toast-in .22s ease both;
  transition: opacity .35s, transform .35s;
}

.s1-toast--success { background: var(--c-ink);  color: #fff; }
.s1-toast--error   { background: var(--c-red);  color: #fff; }

.s1-toast--fade {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── SWIPE-TO-DELETE (autres séjours) ───────────────────────────────────── */

/* Conteneur qui clippe l'overflow et gère la révélation du bouton delete */
.plan-mini-wrap {
  position: relative;
  overflow: hidden;
}

.plan-mini-wrap + .plan-mini-wrap { border-top: 1px solid var(--c-border); }
/* Annule la règle précédente sur .plan-mini direct */
.plan-mini-wrap + .plan-mini-wrap > .plan-mini { border-top: none; }
.plan-mini + .plan-mini { border-top: none; }

/* Bouton delete caché à droite */
.plan-mini-delete {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 84px;
  background: var(--c-red);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transform: translateX(100%);  /* caché par défaut */
  transition: transform .0s;   /* pas d'anim — géré par JS */
}

/* Le lien plan-mini slide vers la gauche lors du swipe */
.plan-mini {
  background: var(--c-surface);
  will-change: transform;
}

/* ─── Item action sheet cadenassé (V2) ───────────────────────────────────── */

.plan-action-item--locked {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-4);
  background: var(--c-bg);
  border-radius: var(--r-m);
  font-size: 15px;
  font-weight: 600;
  opacity: 0.5;           /* grisé = non disponible */
  cursor: not-allowed;
  pointer-events: none;   /* non cliquable */
  color: var(--c-ink-2);
}

.plan-action-locked-text {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.plan-action-badge-v2 {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-accent);
  background: var(--c-accent-light);
  padding: 1px 6px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}

.plan-action-lock-icon { color: var(--c-ink-3); flex-shrink: 0; }


/* ─── Action sheet : drag handle + bouton fermeture ─────────────────────── */
/* position: fixed déjà défini plus haut — ne pas redéclarer */

/* Barre drag handle centrée en tête de la modale */
.plan-action-sheet-bar {
  display: flex;
  justify-content: center;
  padding: var(--s-2) 0 0;
}

.plan-action-sheet-bar .drag-handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 100px;
  background: var(--c-border);
}

/* Croix — coin supérieur droit */
.plan-action-close {
  position: absolute;
  top: var(--s-2);
  right: var(--s-3);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-ink-2);
  z-index: 1;
}

.plan-action-close:active { background: var(--c-border); }
