/**
 * Redevance Spéciale — Pays de Grasse
 * Tout est préfixé .rs-* et limité à .rs-layout / .rs-form : aucune règle globale
 * (pas de body, h1, label, input… hors de ce périmètre), donc sans effet sur le reste du site.
 * La police et le style des champs Webform viennent du thème (Gavias Dodo / Bootstrap 4).
 *
 * Contrastes vérifiés (WCAG AA) : texte #4A5560 / #5B6670 sur blanc, texte sombre sur jaune.
 */

.rs-layout {
  --rs-ink: #000;
  --rs-text: #4a5560;
  --rs-muted: #5b6670;
  --rs-line: rgba(0, 0, 0, .14);
  --rs-brand: #ecc311;
  --rs-brand-soft: #fdf6d6;
  --rs-dark: #2a2c38;
  --rs-error: #b3261e;
  --rs-warn: #fff4d6;
  --rs-p1: #b34a10;
  --rs-p2: #2a2c38;
  --rs-off: #eef0f2;
  --rs-focus: #2a2c38;
  --rs-omr: #5e2750;
  --rs-bio: #7a4e2d;
  --rs-carton: #2f6db5;
  --rs-emb: #e2b300;
  --rs-verre: #2e8b57;
  --rs-benne: #4a4f55;
  --rs-compost: #4e7d2e;
  --rs-sticky-top: 110px; /* à ajuster si l'en-tête du site est fixe */

  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
  color: var(--rs-text);
  font-size: 16px;
  line-height: 1.6;
  box-sizing: border-box;
}
.rs-layout *,
.rs-layout *::before,
.rs-layout *::after { box-sizing: inherit; }
@media (max-width: 960px) {
  .rs-layout { grid-template-columns: 1fr; }
}
.rs-layout [hidden] { display: none !important; }
.rs-layout h2, .rs-layout h3, .rs-layout h4, .rs-layout label, .rs-layout b, .rs-layout strong { color: var(--rs-ink); }
.rs-layout :focus-visible { outline: 3px solid var(--rs-focus); outline-offset: 2px; }
.rs-layout .rs-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.rs-form .rs-hidden { display: none !important; }

/* ---------- Étapes ---------- */
.rs-steps {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px;
  scroll-margin-top: var(--rs-sticky-top);
}
.rs-steps button {
  font: inherit; font-size: 14px; cursor: pointer; border: 1.5px solid var(--rs-line);
  background: #fff; color: var(--rs-muted); padding: 6px 14px;
}
.rs-steps button[aria-current="step"] { background: var(--rs-brand); border-color: var(--rs-brand); color: var(--rs-dark); font-weight: 700; }
.rs-steps button.done { color: var(--rs-ink); border-color: var(--rs-brand); }
.rs-steps button:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Panneaux (conteneurs Webform) ---------- */
.rs-panel {
  background: #fff; border: 1px solid rgba(0, 0, 0, .06); box-shadow: 0 10px 30px rgba(0, 0, 0, .1); padding: 48px;
}
@media (max-width: 640px) { .rs-panel { padding: 24px; } }
.rs-panel h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 600; line-height: 1.15; margin: 0 0 14px; }
.rs-panel h3 { font-size: 1.1rem; margin: 22px 0 8px; }
.rs-eyebrow {
  display: flex; align-items: center; gap: 14px; margin: 0 0 6px; text-transform: uppercase;
  letter-spacing: 2px; font-size: 14px; font-weight: 500; color: var(--rs-muted);
}
.rs-eyebrow::before { content: ""; width: 20px; height: 1px; background: var(--rs-brand); }
.rs-hint { color: var(--rs-muted); margin: 0 0 16px; font-size: .95rem; }
.rs-sub { color: var(--rs-muted); font-size: .9rem; font-weight: 400; }
.rs-opt { font-weight: 400; color: var(--rs-muted); font-size: 13px; white-space: nowrap; }
.rs-h3 { font-size: 1rem; margin: 16px 0 0; }
.rs-muted { color: var(--rs-muted); font-size: .88rem; }

/* Grille de champs (conteneurs Webform avec la classe rs-grid) */
.rs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; align-items: end; }
.rs-grid > .rs-full { grid-column: 1 / -1; }
.rs-periode-zone { margin-top: 22px; }

/* Erreurs de validation (ajoutées par le JS) */
.rs-form .rs-err { color: var(--rs-error); font-size: .9rem; margin-top: 4px; font-weight: 700; }

/* ---------- Boutons de navigation ---------- */
.rs-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.rs-nav-end { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rs-nav-end .form-actions { margin: 0; }
.rs-btn {
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; border: 1.5px solid var(--rs-dark);
  background: transparent; color: var(--rs-dark); padding: 14px 28px; border-radius: 0;
}
.rs-btn--primary { background: var(--rs-brand); border-color: var(--rs-brand); color: var(--rs-dark); }
.rs-btn--primary:hover { background: #d9b30f; border-color: #d9b30f; }
.rs-btn--ghost:hover { background: var(--rs-off); }
/* Bouton d'envoi fourni par Webform */
.rs-form .webform-button--submit {
  background: var(--rs-brand); border: 1.5px solid var(--rs-brand); color: var(--rs-dark);
  font-weight: 700; border-radius: 0; padding: 14px 32px;
}
.rs-form .webform-button--submit:hover { background: #d9b30f; border-color: #d9b30f; color: var(--rs-dark); }

/* ---------- Période : calendrier 12 mois ---------- */
.rs-cal { margin-top: 18px; }
.rs-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.rs-months div {
  height: 42px; background: var(--rs-off); display: flex; align-items: flex-end; justify-content: center;
  font-size: .78rem; padding-bottom: 4px; color: var(--rs-muted);
}
.rs-months div.is-p2 { background: var(--rs-p2); color: #fff; }
.rs-months div.is-p1 { background: var(--rs-p1); color: #fff; }
.rs-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: .9rem; color: var(--rs-muted); }
.rs-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.rs-typebadge { display: inline-block; font-weight: 700; background: var(--rs-dark); color: #fff; padding: 2px 10px; font-variant-numeric: tabular-nums; }
.rs-periodes { margin-top: 12px; font-variant-numeric: tabular-nums; }
.rs-periodes p { margin: 4px 0; }

/* ---------- Prestations ---------- */
.rs-flux-root label { display: block; font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.rs-flux-root .form-control { width: 100%; }
.rs-dispo { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.rs-dispo span { font-size: .85rem; padding: 3px 10px; border: 1.5px solid var(--rs-line); }
.rs-dispo span.non { text-decoration: line-through; color: var(--rs-muted); background: var(--rs-off); border-color: transparent; }
.rs-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; color: var(--rs-muted); font-size: .95rem; }
.rs-toggle { background: none; border: 1.5px solid var(--rs-line); color: var(--rs-ink); padding: 6px 14px; font: inherit; cursor: pointer; }
.rs-indispo { background: var(--rs-warn); padding: 10px 14px; margin-bottom: 12px; font-size: .93rem; }
.rs-empty { color: var(--rs-muted); padding: 12px 0; }

.rs-flux { border: 1.5px solid var(--rs-line); border-left: 8px solid var(--c); margin-bottom: 12px; background: #fff; }
.rs-flux.is-on { border-color: var(--c); }
.rs-flux summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.rs-flux summary::-webkit-details-marker { display: none; }
.rs-flux summary b { font-size: 1.05rem; }
.rs-reco { font-size: .78rem; background: var(--rs-brand); color: var(--rs-dark); padding: 2px 10px; margin-left: 8px; white-space: nowrap; font-weight: 700; }
.rs-body { padding: 0 16px 16px; }
.rs-price { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; color: var(--rs-ink); }
.rs-bloc { border-top: 1px dashed var(--rs-line); padding-top: 12px; margin-top: 12px; }
.rs-bloc:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.rs-bloc h3 { font-size: 1rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.rs-bloc h3 i { width: 12px; height: 12px; display: inline-block; }

.rs-stepper { display: flex; align-items: center; border: 1px solid var(--rs-line); background: #fff; overflow: hidden; }
.rs-stepper button { font: inherit; font-weight: 700; width: 40px; height: 42px; border: 0; background: transparent; color: var(--rs-dark); cursor: pointer; }
.rs-stepper button:hover { background: var(--rs-off); }
.rs-stepper input {
  width: 100%; border: 0 !important; border-radius: 0; text-align: center; padding: 10px 0; background: transparent;
  -moz-appearance: textfield; box-shadow: none !important; height: auto;
}
.rs-stepper input::-webkit-outer-spin-button,
.rs-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.rs-bflux { display: grid; gap: 8px; margin-top: 12px; }
.rs-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; align-items: start; border: 1.5px solid var(--rs-line); border-left: 4px solid var(--rs-benne); padding: 8px 12px; background: #fff; }
@media (max-width: 520px) { .rs-row { grid-template-columns: 1fr; } }

/* ---------- TEOM (conteneur Webform .rs-teom) ---------- */
.rs-teom { margin-top: 16px; border: 1.5px solid var(--rs-line); padding: 16px; background: #fff; }
.rs-teom h3 { margin: 0 0 4px; font-size: 1.05rem; }

/* ---------- Tableaux et grille tarifaire ---------- */
.rs-layout table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.rs-layout th, .rs-layout td { border-bottom: 1px solid var(--rs-line); padding: 6px 8px; text-align: right; vertical-align: top; }
.rs-layout th[scope="row"], .rs-layout th:first-child, .rs-layout td:first-child { text-align: left; }
.rs-layout th { font-weight: 700; color: var(--rs-ink); }
.rs-layout td.rs-hl { background: var(--rs-brand-soft); font-weight: 700; }
.rs-scroll { overflow-x: auto; }
.rs-ref { margin-top: 16px; border: 1px solid var(--rs-line); padding: 0 14px; background: #fff; }
.rs-ref summary { cursor: pointer; padding: 12px 0; font-weight: 700; color: var(--rs-ink); }
.rs-ref[open] { padding-bottom: 14px; }
.rs-ref h4 { margin: 14px 0 6px; font-size: .95rem; }
.rs-notice { margin-top: 12px; font-size: .88rem; color: var(--rs-muted); }
.rs-reminder { background: var(--rs-warn); padding: 10px 14px; margin-top: 14px; font-size: .93rem; }

/* ---------- Récapitulatif latéral ---------- */
.rs-aside { position: sticky; top: var(--rs-sticky-top); }
@media (max-width: 960px) { .rs-aside { position: static; } }
.rs-sum { background: #fff; border: 1px solid rgba(0, 0, 0, .06); box-shadow: 0 10px 30px rgba(0, 0, 0, .1); padding: 28px; }
.rs-sum h2 { font-size: 1.4rem; font-weight: 700; margin: 0 0 10px; }
.rs-sum dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: .92rem; }
.rs-sum dt { color: var(--rs-muted); font-weight: 400; }
.rs-sum dd { margin: 0; text-align: right; }
.rs-sum .rs-lines td { padding: 6px 4px; }
.rs-sum .rs-lines td:last-child { white-space: nowrap; }
.rs-sum .rs-deduc td { color: var(--rs-dark); font-weight: 700; }
.rs-tot { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--rs-brand); margin-top: 10px; padding-top: 10px; }
.rs-tot strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }

/* Barre de total (mobile) */
.rs-bar { display: none; }
@media (max-width: 960px) {
  .rs-bar {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--rs-dark);
    padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .rs-bar-in { display: flex; justify-content: space-between; align-items: center; }
  .rs-bar span, .rs-bar strong { color: #fff; }
  .rs-bar strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
  .rs-layout { padding-bottom: 64px; }
}

/* Message temporaire */
#rs-toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60; max-width: 90vw;
  background: var(--rs-dark, #2a2c38); color: #fff; padding: 10px 16px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#rs-toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #rs-toast { transition: none; } .rs-layout * { scroll-behavior: auto; } }
