/* ============================================================
   Amipo Location — Styles frontend & admin
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --amipo-primary:    #1a3a6b;
  --amipo-accent:     #e8b200;
  --amipo-success:    #2d8a4e;
  --amipo-danger:     #c0392b;
  --amipo-warning:    #d68910;
  --amipo-muted:      #6b7280;
  --amipo-border:     #dde1e7;
  --amipo-bg:         #f8f9fb;
  --amipo-card-bg:    #ffffff;
  --amipo-radius:     8px;
  --amipo-shadow:     0 2px 8px rgba(0,0,0,.08);
}

/* ── Wrapper ────────────────────────────────────────────────── */
.amipo-loc-wrapper {
  font-family: inherit;
  color: #1f2937;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Notices ────────────────────────────────────────────────── */
.amipo-notice {
  padding: .85rem 1.2rem;
  border-radius: var(--amipo-radius);
  margin-bottom: 1.5rem;
  font-size: .95rem;
}
.amipo-notice a { color: inherit; font-weight: 600; }
.amipo-notice-info    { background: #e8f0fe; border-left: 4px solid #4285f4; }
.amipo-notice-success { background: #e6f4ea; border-left: 4px solid var(--amipo-success); }
.amipo-notice-warning { background: #fef9e7; border-left: 4px solid var(--amipo-warning); }
.amipo-notice-error   { background: #fdecea; border-left: 4px solid var(--amipo-danger); }

/* ── Sections ───────────────────────────────────────────────── */
.amipo-section { margin-bottom: 2.5rem; }
.amipo-section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--amipo-primary);
  margin-bottom: 1.2rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--amipo-accent);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Spinner ────────────────────────────────────────────────── */
.amipo-loading {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 0;
  color: var(--amipo-muted);
}
.amipo-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--amipo-border);
  border-top-color: var(--amipo-primary);
  border-radius: 50%;
  animation: amipo-spin .8s linear infinite;
}
@keyframes amipo-spin { to { transform: rotate(360deg); } }

/* ── Grille équipements ─────────────────────────────────────── */
.amipo-equip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.amipo-empty { color: var(--amipo-muted); font-style: italic; }

.amipo-equip-card {
  background: var(--amipo-card-bg);
  border: 2px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  overflow: hidden;
  position: relative;
}
.amipo-equip-card:hover {
  border-color: var(--amipo-primary);
  box-shadow: var(--amipo-shadow);
  transform: translateY(-2px);
}
.amipo-equip-card.selected {
  border-color: var(--amipo-accent);
  box-shadow: 0 0 0 3px rgba(232,178,0,.25);
}
.amipo-equip-img img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  display: block;
  background: #fff;
  padding: .35rem;
  box-sizing: border-box;
}
.amipo-no-img {
  height: 150px;
  background: var(--amipo-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amipo-muted);
  font-size: 2.5rem;
}
.amipo-equip-info {
  padding: 1rem;
}
.amipo-equip-info h3 {
  margin: 0 0 .4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--amipo-primary);
}
.amipo-equip-info p {
  margin: 0 0 .6rem;
  font-size: .875rem;
  color: var(--amipo-muted);
  line-height: 1.4;
}
.amipo-equip-tarif {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .875rem;
}
.amipo-equip-tarif strong {
  color: var(--amipo-primary);
  font-size: 1rem;
}
.amipo-equip-tarif span { color: var(--amipo-muted); }

/* ── Layout réservation ─────────────────────────────────────── */
.amipo-booking-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) {
  .amipo-booking-layout { grid-template-columns: 1fr; }
}
/* (responsive complet en bas du fichier) */

/* ── Calendrier ─────────────────────────────────────────────── */
.amipo-cal-container {
  background: var(--amipo-card-bg);
  border: 1px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  padding: 1.25rem;
  box-shadow: var(--amipo-shadow);
}
.amipo-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.amipo-cal-header span {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--amipo-primary);
}
.amipo-cal-prev,
.amipo-cal-next {
  background: #fff;
  border: 2px solid var(--amipo-primary);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--amipo-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.amipo-cal-prev svg,
.amipo-cal-next svg {
  width: 16px;
  height: 16px;
  display: block;
}
.amipo-cal-prev:hover,
.amipo-cal-next:hover {
  background: var(--amipo-primary);
  color: #fff;
}

.amipo-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.amipo-cal-dayname {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--amipo-muted);
  padding: .3rem 0;
}
.amipo-cal-day {
  text-align: center;
  padding: .45rem .2rem;
  border-radius: 4px;
  font-size: .875rem;
  cursor: default;
  transition: background .12s, color .12s;
  user-select: none;
}
.amipo-cal-day.available {
  cursor: pointer;
  background: #f0fdf4;
  color: var(--amipo-success);
  font-weight: 500;
}
.amipo-cal-day.available:hover {
  background: var(--amipo-success);
  color: #fff;
}
.amipo-cal-day.booked {
  background: #fef2f2;
  color: var(--amipo-danger);
  text-decoration: line-through;
  opacity: .7;
}
.amipo-cal-day.past {
  color: var(--amipo-muted);
  opacity: .5;
}
.amipo-cal-day.beyond-max,
.amipo-cal-day.too-close {
  color: var(--amipo-muted);
  opacity: .35;
  cursor: not-allowed;
  background: #f3f4f6;
}

.amipo-duration-hint {
  font-size: .8rem;
  color: var(--amipo-primary);
  margin: .5rem 0 0;
  font-weight: 600;
}

.amipo-duration-badge {
  display: inline-block;
  background: #e8f0fe;
  color: var(--amipo-primary);
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .45rem;
  border-radius: 10px;
  margin-left: .4rem;
  vertical-align: middle;
}
.amipo-cal-day.start-date,
.amipo-cal-day.end-date {
  background: var(--amipo-primary) !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 4px;
}
.amipo-cal-day.in-range {
  background: rgba(26,58,107,.12);
  color: var(--amipo-primary);
  border-radius: 0;
}
.amipo-cal-day.empty { pointer-events: none; }

/* Légende */
.amipo-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  margin: .75rem 0 .25rem;
  font-size: .78rem;
}
.amipo-leg {
  display: flex;
  align-items: center;
  gap: .3rem;
}
.amipo-leg::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.amipo-leg-available::before  { background: #f0fdf4; border: 1.5px solid var(--amipo-success); }
.amipo-leg-booked::before     { background: #fef2f2; border: 1.5px solid var(--amipo-danger); }
.amipo-leg-selected::before   { background: var(--amipo-primary); }
.amipo-leg-range::before      { background: rgba(26,58,107,.12); border: 1.5px solid var(--amipo-primary); }
.amipo-leg-past::before       { background: #e5e7eb; }

.amipo-cal-hint {
  font-size: .82rem;
  color: var(--amipo-muted);
  margin: .4rem 0 0;
}

/* ── Sidebar résumé ─────────────────────────────────────────── */
.amipo-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

.amipo-summary {
  background: var(--amipo-card-bg);
  border: 1px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  padding: 1.25rem;
  box-shadow: var(--amipo-shadow);
}
.amipo-summary h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--amipo-primary);
}
.amipo-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-bottom: 1rem;
}
.amipo-summary-table th,
.amipo-summary-table td {
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--amipo-bg);
  text-align: left;
}
.amipo-summary-table th {
  color: var(--amipo-muted);
  font-weight: 500;
  white-space: nowrap;
  width: 40%;
}
.amipo-summary-table td { font-weight: 600; }

.amipo-form-field { margin-bottom: 1rem; }
.amipo-form-field label {
  display: block;
  font-size: .85rem;
  color: var(--amipo-muted);
  margin-bottom: .3rem;
}
.amipo-form-field textarea {
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--amipo-border);
  border-radius: 4px;
  font-size: .875rem;
  resize: vertical;
  box-sizing: border-box;
}

.amipo-stripe-info {
  font-size: .78rem;
  color: var(--amipo-muted);
  margin-top: .5rem;
}

/* ── Mes réservations ───────────────────────────────────────── */
.amipo-my-reservations {
  background: var(--amipo-card-bg);
  border: 1px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  padding: 1.25rem;
}
.amipo-my-reservations h3 {
  margin: 0 0 .75rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--amipo-primary);
}
.amipo-resa-item {
  padding: .6rem .75rem;
  background: var(--amipo-bg);
  border-radius: 4px;
  margin-bottom: .5rem;
  font-size: .82rem;
}
.amipo-resa-item .amipo-resa-equip { font-weight: 600; }
.amipo-resa-item .amipo-resa-dates { color: var(--amipo-muted); }
.amipo-resa-cancel-btn {
  background: none;
  border: none;
  color: var(--amipo-danger);
  font-size: .78rem;
  cursor: pointer;
  padding: 0;
  float: right;
}
.amipo-resa-cancel-btn:hover { text-decoration: underline; }

/* ── Boutons ────────────────────────────────────────────────── */
.amipo-btn {
  display: inline-block;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: var(--amipo-radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: opacity .15s, transform .1s;
  width: 100%;
  box-sizing: border-box;
}
.amipo-btn:hover   { opacity: .88; }
.amipo-btn:active  { transform: scale(.98); }
.amipo-btn-primary { background: var(--amipo-primary); color: #fff; }
.amipo-btn:disabled { opacity: .5; cursor: not-allowed; }

.amipo-btn-link {
  background: none;
  border: none;
  color: var(--amipo-primary);
  cursor: pointer;
  font-size: .85rem;
  text-decoration: underline;
  padding: 0;
}
.amipo-back-btn { font-size: .85rem; font-weight: 400; }

/* ── Message d'erreur flottant ──────────────────────────────── */
.amipo-error-msg {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amipo-danger);
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: var(--amipo-radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 9999;
  font-size: .9rem;
  max-width: 90vw;
  text-align: center;
}

/* ── Badges statut ──────────────────────────────────────────── */
.amipo-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.amipo-badge-en_attente  { background: #fef9e7; color: var(--amipo-warning); }
.amipo-badge-confirme    { background: #e6f4ea; color: var(--amipo-success); }
.amipo-badge-annule      { background: #fdecea; color: var(--amipo-danger); }
.amipo-badge-complete    { background: #e8f0fe; color: #1565c0; }
.amipo-badge-rembourse   { background: #f3e5f5; color: #6a1b9a; }

/* ── Admin ──────────────────────────────────────────────────── */
.amipo-admin-wrap { max-width: 1200px; }
.amipo-admin-wrap h1 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.amipo-card {
  background: #fff;
  border: 1px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  padding: 1.5rem;
  box-shadow: var(--amipo-shadow);
  margin-bottom: 1.5rem;
}
.amipo-card h2 { margin: 0 0 1rem; font-size: 1.1rem; color: var(--amipo-primary); }

.amipo-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 1.5rem;
}
.amipo-stat-card {
  background: #fff;
  border: 1px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  padding: 1rem 1.5rem;
  flex: 1;
  min-width: 140px;
  text-align: center;
  box-shadow: var(--amipo-shadow);
}
.amipo-stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--amipo-primary);
  display: block;
}
.amipo-stat-card .stat-label {
  font-size: .8rem;
  color: var(--amipo-muted);
}

.amipo-admin-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: var(--amipo-bg);
  border-radius: var(--amipo-radius);
}
.amipo-admin-filters label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
}
.amipo-admin-filters select { border-radius: 4px; }

.amipo-table-wrap { overflow-x: auto; }
.amipo-admin-loading {
  padding: 1.5rem;
  text-align: center;
  color: var(--amipo-muted);
}
.amipo-muted { color: var(--amipo-muted); }

/* Formulaire équipements */
.amipo-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .amipo-form-grid { grid-template-columns: 1fr; } }
.amipo-form-row { display: flex; flex-direction: column; gap: .3rem; }
.amipo-form-row label { font-weight: 600; font-size: .875rem; }
.amipo-form-row input,
.amipo-form-row textarea,
.amipo-form-row select {
  padding: .45rem .7rem;
  border: 1px solid var(--amipo-border);
  border-radius: 4px;
  font-size: .9rem;
}
.amipo-form-actions { margin-top: 1rem; display: flex; gap: .5rem; }

/* Modal */
.amipo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 10000;
}
.amipo-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: var(--amipo-radius);
  padding: 2rem;
  z-index: 10001;
  width: 480px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.amipo-modal h3 { margin: 0 0 1.25rem; color: var(--amipo-primary); }
.amipo-modal-actions { margin-top: 1.25rem; display: flex; gap: .5rem; }

.required { color: var(--amipo-danger); }

/* ── Calendrier des locations ───────────────────────────────── */
.amipo-cal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.amipo-cal-modal-box {
  background: var(--amipo-card-bg);
  border-radius: 14px;
  width: 100%;
  max-width: 860px;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
  overflow: hidden;
}
/* ── Header calendrier ─────────────────────── */
.amipo-cal-modal-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  background: var(--amipo-primary);
}
.amipo-cal-header-right {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.amipo-cal-modal-title {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}
.amipo-cal-nav-btn {
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.45);
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .15s, border-color .2s;
  flex-shrink: 0;
  padding: 0;
}
.amipo-cal-nav-btn:hover {
  background: rgba(255,255,255,.35);
  border-color: rgba(255,255,255,.8);
  transform: scale(1.1);
}
/* Chevron CSS pur — pas de caractère HTML */
.amipo-cal-nav-arrow {
  display: inline-block;
  width: 10px; height: 10px;
  border-top: 2.5px solid #fff;
  border-right: 2.5px solid #fff;
  border-radius: 1px;
  flex-shrink: 0;
}
.amipo-cal-nav-prev { transform: rotate(-135deg) translate(-1px, 1px); }
.amipo-cal-nav-next { transform: rotate(45deg)   translate(-1px, 1px); }

.amipo-cal-close {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.8);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .82rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s, color .2s;
  padding: 0; line-height: 1; flex-shrink: 0;
  margin-left: 4px;
}
.amipo-cal-close:hover {
  background: rgba(220,38,38,.75);
  border-color: rgba(220,38,38,.9);
  color: #fff;
}

/* ── Jours de la semaine ───────────────────── */
.amipo-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f1f5f9;
  border-bottom: 1px solid var(--amipo-border);
}
.amipo-cal-weekdays span {
  text-align: center;
  padding: .45rem 0;
  font-size: .72rem;
  font-weight: 700;
  color: var(--amipo-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Grille calendrier (container) ────────── */
/* Sélecteur spécifique pour ne pas hériter du display:grid du calendrier de réservation */
.amipo-cal-modal-box .amipo-cal-grid {
  display: block;
  border-top: 1px solid var(--amipo-border);
  border-left: 1px solid var(--amipo-border);
}

/* ── Semaine ───────────────────────────────── */
.amipo-cal-week {
  border-bottom: 1px solid var(--amipo-border);
}
.amipo-cal-week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.amipo-cal-day-cell {
  border-right: 1px solid var(--amipo-border);
  padding: .4rem .55rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--amipo-muted);
  min-height: 32px;
}
.amipo-cal-day-empty   { background: #f9fafb; }
/* Jours hors mois courant (mois précédent / suivant) — grisés */
.amipo-cal-day-outside {
  color: #c0c6cf;
  background: #f7f8fa;
}
.amipo-cal-today-cell {
  color: var(--amipo-primary);
  background: #eff6ff;
  font-weight: 800;
}

/* ── Barres d'événements ───────────────────── */
.amipo-cal-week-events { padding: 3px 0 5px; }
.amipo-cal-week-events-empty { height: 10px; }
.amipo-cal-event-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.amipo-cal-event-gap { /* spacer vide */ }
.amipo-cal-event-bar {
  padding: 3px 8px;
  color: #fff;
  font-size: .73rem;
  font-weight: 600;
  border-radius: 5px;
  margin: 0 2px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px;
  overflow: hidden;
  cursor: pointer;
  white-space: nowrap;
  min-height: 22px;
  transition: filter .15s, box-shadow .15s;
}
.amipo-cal-event-bar:hover {
  filter: brightness(1.12);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
/* Barre qui continue depuis la semaine précédente → pas de marge/arrondi gauche */
.amipo-cal-bar-cleft  { border-radius: 0 5px 5px 0; margin-left: 0; }
/* Barre qui continue vers la semaine suivante → pas de marge/arrondi droit */
.amipo-cal-bar-cright { border-radius: 5px 0 0 5px; margin-right: 0; }
.amipo-cal-bar-cleft.amipo-cal-bar-cright { border-radius: 0; margin-left: 0; margin-right: 0; }
.amipo-cal-bar-nom {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.amipo-cal-bar-info {
  flex-shrink: 0;
  width: 16px; height: 16px;
  background: rgba(255,255,255,.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem;
  pointer-events: none;
}

/* ── Popover info ──────────────────────────── */
.amipo-cal-popover {
  position: fixed;
  background: #fff;
  border: 1px solid var(--amipo-border);
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .82rem;
  line-height: 1.7;
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
  z-index: 100000;
  max-width: 240px;
  color: #1f2937;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 760px) {
  .amipo-cal-modal-overlay { padding: .5rem; }
  .amipo-cal-modal-title { font-size: .95rem; }
  .amipo-cal-event-bar { font-size: .65rem; padding: 2px 5px; }
}
@media (max-width: 500px) {
  .amipo-cal-modal-overlay { padding: 0; align-items: flex-end; }
  .amipo-cal-modal-box { border-radius: 14px 14px 0 0; max-height: 95vh; overflow-y: auto; }
  .amipo-cal-day-cell { font-size: .7rem; padding: .3rem .25rem; min-height: 26px; }
  .amipo-cal-event-bar { font-size: .63rem; padding: 2px 4px; min-height: 20px; margin: 0 1px; }
  .amipo-cal-bar-info { display: none; }           /* ℹ caché → plus de place pour le nom */
  .amipo-cal-bar-nom  { min-width: 0; }             /* flex truncation correcte */
  .amipo-cal-weekdays span { font-size: .62rem; letter-spacing: 0; }
  .amipo-cal-nav-btn  { width: 36px; height: 36px; }
  .amipo-cal-nav-arrow { width: 8px; height: 8px; }
}

/* ── Onglets gestionnaire ────────────────────────────────────── */
.amipo-gest-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  background: var(--amipo-bg);
  border: 1px solid var(--amipo-border);
  border-radius: 8px;
  padding: .3rem;
}
.amipo-gest-tab {
  background: none;
  border: none;
  padding: .5rem 1.1rem;
  border-radius: 6px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--amipo-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.amipo-gest-tab:hover  { background: #e9edf4; color: var(--amipo-primary); }
.amipo-gest-tab.active { background: var(--amipo-primary); color: #fff; }

/* ── Badges état équipement ──────────────────────────────────── */
.amipo-etat-badge {
  display: inline-block;
  padding: .28rem .75rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.amipo-etat-bon          { background: #d1fae5; color: #065f46; }
.amipo-etat-surveiller   { background: #fef3c7; color: #92400e; }
.amipo-etat-hors-service { background: #fee2e2; color: #991b1b; }

/* ── Fiche : entrées du journal ──────────────────────────────── */
.amipo-fiche-entry {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--amipo-border);
}
.amipo-fiche-entry:last-child { border-bottom: none; }
.amipo-fiche-entry-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}
.amipo-fiche-type-label {
  font-weight: 700;
  font-size: .87rem;
  color: var(--amipo-primary);
}
.amipo-fiche-entry-meta {
  font-size: .78rem;
  color: var(--amipo-muted);
  margin-left: auto;
}
.amipo-fiche-entry-desc {
  font-size: .9rem;
  color: #374151;
  line-height: 1.5;
  white-space: pre-wrap;
}
.amipo-fiche-statut-badge {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 700;
}
.amipo-fiche-statut-ouvert   { background: #fee2e2; color: #991b1b; }
.amipo-fiche-statut-en-cours { background: #fef3c7; color: #92400e; }
.amipo-fiche-statut-resolu   { background: #d1fae5; color: #065f46; }
.amipo-fiche-statut-btn {
  background: none;
  border: 1px solid var(--amipo-border);
  border-radius: 5px;
  padding: .25rem .65rem;
  cursor: pointer;
  color: var(--amipo-muted);
  transition: background .12s;
}
.amipo-fiche-statut-btn:hover { background: var(--amipo-bg); color: var(--amipo-primary); }

/* ── Zone de dépôt photos ────────────────────────────────────── */
.amipo-photo-dropzone {
  border: 2px dashed var(--amipo-border);
  border-radius: 8px;
  padding: .75rem;
  transition: border-color .15s, background .15s;
  min-height: 54px;
}
.amipo-photo-dropzone-hover {
  border-color: var(--amipo-primary);
  background: #eef2fb;
}
.amipo-photo-pick-btn {
  background: none;
  border: 1px solid var(--amipo-border);
  border-radius: 6px;
  padding: .4rem .9rem;
  font-size: .85rem;
  color: var(--amipo-primary);
  cursor: pointer;
  font-weight: 600;
  transition: background .12s;
  margin-top: .4rem;
}
.amipo-photo-pick-btn:hover { background: var(--amipo-bg); }

/* Grille de previews avant envoi */
.amipo-photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .4rem;
}
.amipo-photo-thumb-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: visible;
}
.amipo-photo-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--amipo-border);
  display: block;
}
.amipo-photo-thumb-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--amipo-danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: .65rem;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}

/* ── Grille photos dans le journal ───────────────────────────── */
.amipo-fiche-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .6rem;
}
.amipo-fiche-photo-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}
.amipo-fiche-photo-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--amipo-border);
  cursor: zoom-in;
  display: block;
  transition: opacity .12s;
}
.amipo-fiche-photo-thumb:hover { opacity: .85; }
.amipo-fiche-photo-del {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  background: var(--amipo-danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: .6rem;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity .12s;
}
.amipo-fiche-photo-wrap:hover .amipo-fiche-photo-del { opacity: 1; }

/* ── Éléments desktop/mobile conditionnels ───────────────────── */
/* Sous-titre dates (mobile uniquement dans la cellule équipement) */
.amipo-mobile-sub {
  display: none;
  font-size: .77rem;
  color: var(--amipo-muted);
  margin-top: .15rem;
}
/* Bouton expand : caché sur desktop */
.amipo-row-expand-btn { display: none; }
/* Ligne de détails : jamais visible sur desktop */
.amipo-gest-details-row { display: none !important; }

/* ── Panneau de détails (dans la ligne dépliable) ────────────── */
.amipo-gest-details-panel {
  padding: .75rem 1rem;
  background: var(--amipo-bg);
}
.amipo-gest-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .75rem;
}
.amipo-gest-details-grid > div {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.amipo-gest-details-grid label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--amipo-primary);
}
.amipo-gest-details-grid span {
  font-size: .88rem;
  color: #1f2937;
}

/* ── Gestionnaire matériel ───────────────────────────────────── */
.amipo-gest-table-wrap {
  overflow-x: auto;
  border-radius: var(--amipo-radius);
  border: 1px solid var(--amipo-border);
}
.amipo-gest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.amipo-gest-table th,
.amipo-gest-table td {
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--amipo-border);
}
.amipo-gest-table th {
  background: var(--amipo-bg);
  font-weight: 600;
  color: var(--amipo-primary);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.amipo-gest-table tbody tr:last-child td { border-bottom: none; }
.amipo-gest-table tbody tr:hover { background: #f9fafb; }
.amipo-gest-row-retard td { background: #fff8f8; }
.amipo-gest-row-retard:hover td { background: #fff0f0 !important; }
.amipo-btn-success {
  background: var(--amipo-success);
  color: #fff;
  border: none;
  padding: .35rem .85rem;
  border-radius: var(--amipo-radius);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: opacity .15s;
}
.amipo-btn-success:hover { opacity: .85; }
.amipo-btn-success:disabled { opacity: .5; cursor: not-allowed; }

/* Badges statuts gestionnaire */
.amipo-badge { display:inline-block; padding:.25rem .6rem; border-radius:999px; font-size:.78rem; font-weight:600; }
.amipo-badge-success { background:#e6f4ea; color:#2d8a4e; border:1px solid #a9dfbf; }
.amipo-badge-danger  { background:#fdecea; color:#c0392b; border:1px solid #f5b7b1; }
.amipo-badge-muted   { background:#f3f4f6; color:#6b7280; border:1px solid #e5e7eb; }

/* Pagination historique */
.amipo-hist-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 0;
  flex-wrap: wrap;
  gap: .5rem;
}
.amipo-hist-page-btn {
  padding: .3rem .65rem;
  border: 1.5px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  background: #fff;
  cursor: pointer;
  font-size: .85rem;
  transition: background .15s, border-color .15s;
}
.amipo-hist-page-btn:hover:not(:disabled) { border-color: var(--amipo-primary); color: var(--amipo-primary); }
.amipo-hist-page-btn.active { background: var(--amipo-primary); color: #fff; border-color: var(--amipo-primary); }
.amipo-hist-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Search bar & category filters ─────────────────────────── */
.amipo-search-wrap {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

/* Champ de recherche */
.amipo-search-input-wrap {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.amipo-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--amipo-muted);
  pointer-events: none;
}
#amipo-search {
  width: 100%;
  box-sizing: border-box;
  padding: .75rem 2.8rem .75rem 2.75rem;
  border: 1.5px solid var(--amipo-border);
  border-radius: 999px;
  font-size: .95rem;
  outline: none;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  transition: border-color .2s, box-shadow .2s;
}
#amipo-search:focus {
  border-color: var(--amipo-primary);
  box-shadow: 0 0 0 3px rgba(26,58,107,.1);
}
.amipo-search-clear {
  position: absolute;
  right: .9rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--amipo-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.amipo-search-clear:hover { color: var(--amipo-danger); }

/* Filtres catégorie */
.amipo-cat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
}
.amipo-cat-filter {
  padding: .38rem 1rem;
  border: 1.5px solid var(--amipo-primary);
  border-radius: 999px;
  background: #fff;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--amipo-primary);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.amipo-cat-filter:hover {
  background: rgba(26,58,107,.08);
}
.amipo-cat-filter.active {
  background: var(--amipo-primary);
  border-color: var(--amipo-primary);
  color: #fff;
}
.amipo-no-result {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--amipo-muted);
  font-size: .95rem;
}

/* ── Info button on equipment cards ─────────────────────────── */
.amipo-info-btn {
  position: absolute !important;
  top: .6rem !important;
  right: .6rem !important;
  width: 28px !important;
  height: 28px !important;
  min-width: unset !important;
  min-height: unset !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  border: 2px solid var(--amipo-primary) !important;
  background: rgba(255,255,255,.95) !important;
  color: var(--amipo-primary) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 2 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.15) !important;
  transition: background .15s, color .15s, border-color .15s !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}
.amipo-info-btn svg {
  width: 14px !important;
  height: 14px !important;
  display: block !important;
  pointer-events: none !important;
}
.amipo-info-btn:hover {
  background: var(--amipo-primary) !important;
  color: #fff !important;
  border-color: var(--amipo-primary) !important;
}

/* ── Info modal (frontend popup) ─────────────────────────────── */
.amipo-info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 20000;
}
.amipo-info-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: var(--amipo-radius);
  z-index: 20001;
  width: 640px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.amipo-info-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.2rem 1.4rem .8rem;
  border-bottom: 1px solid var(--amipo-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.amipo-info-modal-header h3 {
  margin: 0;
  color: var(--amipo-primary);
  font-size: 1.1rem;
}
.amipo-info-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--amipo-muted);
  line-height: 1;
  padding: 0 .2rem;
}
.amipo-info-close:hover { color: var(--amipo-danger); }
.amipo-info-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.2rem;
  padding: 1.2rem 1.4rem;
}
@media (max-width: 540px) {
  .amipo-info-layout {
    grid-template-columns: 1fr;
  }
}
.amipo-info-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: contain;
  border-radius: var(--amipo-radius);
  background: var(--amipo-bg);
}
.amipo-info-img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--amipo-radius);
  background: var(--amipo-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.amipo-info-body { display: flex; flex-direction: column; gap: .85rem; }
/* Description dans la carte : limitée à 3 lignes */
.amipo-equip-desc {
  font-size: .83rem;
  color: var(--amipo-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: .3rem 0 .5rem;
}
/* Description dans la modale info : complète avec sauts de ligne */
.amipo-info-desc { font-size: .9rem; color: #374151; line-height: 1.65; white-space: normal; }
.amipo-info-tarifs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.amipo-info-tarifs-table th,
.amipo-info-tarifs-table td {
  padding: .3rem .6rem;
  border: 1px solid var(--amipo-border);
  text-align: left;
}
.amipo-info-tarifs-table th {
  background: var(--amipo-bg);
  font-weight: 600;
  color: var(--amipo-primary);
}
.amipo-info-meta {
  font-size: .82rem;
  color: var(--amipo-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.amipo-info-actions {
  padding: .9rem 1.4rem 1.2rem;
  border-top: 1px solid var(--amipo-border);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}

/* ── Admin media picker ──────────────────────────────────────── */
.amipo-img-preview {
  margin-top: .5rem;
  max-width: 180px;
  max-height: 120px;
  border-radius: var(--amipo-radius);
  border: 1px solid var(--amipo-border);
  display: none;
}
.amipo-img-preview.visible { display: block; }

/* ============================================================
   RESPONSIVE MOBILE — breakpoints 768px et 480px
   ============================================================ */

/* ── Tablette (≤ 768px) ─────────────────────────────────────── */
@media (max-width: 768px) {

  /* Wrapper : padding horizontal */
  .amipo-loc-wrapper { padding: 0 .75rem; }

  /* Sections */
  .amipo-section-title { font-size: 1.15rem; }

  /* Grille équipements : 2 colonnes */
  .amipo-equip-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .85rem;
  }

  /* Calendrier : cellules plus grandes pour le touch */
  .amipo-cal-day {
    padding: .55rem .1rem;
    font-size: .8rem;
  }
  .amipo-cal-container { padding: 1rem .75rem; }

  /* Recherche + filtres centrés */
  .amipo-search-bar { flex-direction: column; align-items: stretch; }
  .amipo-cat-filters { justify-content: center; }

  /* Récap réservation */
  .amipo-summary-table { font-size: .85rem; }

  /* Tableau gestionnaire → lignes compactes */
  .amipo-gest-table thead { display: none; }
  .amipo-gest-table,
  .amipo-gest-table tbody { display: block; }

  .amipo-gest-table tr.amipo-gest-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .5rem;
    padding: .75rem;
    border-bottom: 1px solid var(--amipo-border);
    margin-bottom: 0;
    padding: .75rem 1rem;
    background: #fff;
    box-shadow: var(--amipo-shadow);
  }
  .amipo-gest-row-retard { border-left: 3px solid var(--amipo-danger) !important; background: #fff8f8; }

  /* Masquer toutes les cellules par défaut sur mobile */
  .amipo-gest-table tr.amipo-gest-row td {
    display: none;
    border: none;
    padding: 0;
  }

  /* Activer les éléments mobile */
  .amipo-mobile-sub { display: block; }
  .amipo-row-expand-btn { display: flex; }
  .amipo-gest-details-row { display: none !important; }
  .amipo-gest-details-row.amipo-row-open { display: block !important; }

  /* Cellule équipement : pleine largeur, 1ère ligne */
  .amipo-gest-table tr.amipo-gest-row td[data-label="Équipement"] {
    display: flex;
    flex-direction: column;
    width: 100%;
    font-size: .92rem;
    padding-bottom: .25rem;
  }

  /* Statut + Action : 2ème ligne, alignés */
  .amipo-gest-table tr.amipo-gest-row .amipo-td-statut,
  .amipo-gest-table tr.amipo-gest-row .amipo-td-action { display: flex; align-items: center; gap: .35rem; }

  /* Bouton rendu : taille normale */
  .amipo-gest-table tr.amipo-gest-row .amipo-td-action .amipo-btn-success {
    font-size: .82rem;
    padding: .4rem .75rem;
    white-space: nowrap;
  }

  /* Bouton expand : chevron discret */
  .amipo-row-expand-btn {
    background: none;
    border: 1px solid var(--amipo-border);
    border-radius: 5px;
    width: 28px;
    height: 28px;
    font-size: .7rem;
    cursor: pointer;
    color: var(--amipo-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .12s, color .12s;
  }
  .amipo-row-expand-btn:hover,
  .amipo-row-expand-btn.amipo-expand-open { background: var(--amipo-primary); color: #fff; border-color: var(--amipo-primary); }

  /* Ligne de détails */
  .amipo-gest-details-row { display: none; }
  .amipo-gest-details-row.amipo-row-open { display: block; }
  .amipo-gest-details-row td { display: block !important; padding: 0 !important; border-bottom: 2px solid var(--amipo-border) !important; }

  .amipo-btn-success { margin-top: 0; }

  /* Pagination historique */
  .amipo-hist-pager { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

/* ── Mobile (≤ 480px) ───────────────────────────────────────── */
@media (max-width: 480px) {

  /* Grille équipements : 1 colonne sur très petits écrans */
  .amipo-equip-grid {
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  /* Cards équipements : image moins haute */
  .amipo-equip-img img,
  .amipo-no-img { height: 120px; }

  /* Calendrier : encore plus compact */
  .amipo-cal-day {
    padding: .5rem .05rem;
    font-size: .72rem;
  }
  .amipo-cal-dayname { font-size: .65rem; }
  .amipo-cal-header span { font-size: .95rem; }

  /* Info modal : padding réduit */
  .amipo-info-modal-header { padding: .9rem 1rem .6rem; }
  .amipo-info-layout { padding: .9rem 1rem; gap: .75rem; }
  .amipo-info-actions { padding: .75rem 1rem 1rem; }
  .amipo-info-modal { max-height: 95vh; }

  /* Filtres catégories : petits pills */
  .amipo-cat-filter { font-size: .75rem; padding: .3rem .65rem; }

  /* Onglets gestionnaire : plus compacts sur mobile */
  .amipo-gest-tab { padding: .4rem .75rem; font-size: .8rem; }

  /* Notices */
  .amipo-notice { font-size: .88rem; padding: .75rem 1rem; }

  /* Section title */
  .amipo-section-title { font-size: 1.05rem; }

  /* Bouton réserver */
  .amipo-btn { width: 100%; justify-content: center; text-align: center; }

  /* Sidebar réservation */
  .amipo-sidebar-card { padding: 1rem; }
  .amipo-summary-table th,
  .amipo-summary-table td { padding: .35rem .5rem; font-size: .82rem; }
}

/* ============================================================
   PANIER DE LOCATION
   ============================================================ */

/* ── Bouton "Ajouter au panier" sur les cartes ──────────────── */
.amipo-add-to-cart-btn {
  display: block;
  width: calc(100% - 2rem);
  margin: 0 1rem 1rem;
  padding: .5rem 1rem;
  background: #fff;
  border: 2px solid var(--amipo-primary);
  border-radius: var(--amipo-radius);
  color: var(--amipo-primary);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background .15s, color .15s;
}
.amipo-add-to-cart-btn:hover {
  background: var(--amipo-primary);
  color: #fff;
}
.amipo-add-to-cart-btn.in-cart {
  background: var(--amipo-success);
  border-color: var(--amipo-success);
  color: #fff;
}
.amipo-add-to-cart-btn.in-cart:hover {
  background: #1e6b3a;
  border-color: #1e6b3a;
}

/* ── Barre panier mobile (fixe en bas) ──────────────────────── */
.amipo-cart-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--amipo-primary);
  color: #fff;
  padding: .75rem 1.25rem;
  z-index: 8000;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 -2px 12px rgba(0,0,0,.18);
}
.amipo-cart-bar.visible { display: flex; }

.amipo-cart-bar-left {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .92rem;
  font-weight: 600;
}
.amipo-cart-bar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--amipo-accent);
  color: #1a3a6b;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
}
.amipo-cart-bar-btn {
  background: var(--amipo-accent);
  color: #1a3a6b;
  border: none;
  border-radius: var(--amipo-radius);
  padding: .5rem 1.1rem;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity .15s;
}
.amipo-cart-bar-btn:hover { opacity: .88; }

/* ── Overlay sombre ─────────────────────────────────────────── */
.amipo-cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 8500;
}
.amipo-cart-overlay.visible { display: block; }

/* ── Bottom sheet (mobile) ──────────────────────────────────── */
.amipo-cart-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 9000;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.amipo-cart-sheet.visible { display: block; }

.amipo-cart-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--amipo-border);
  border-radius: 2px;
  margin: .75rem auto .5rem;
  cursor: grab;
}

/* ── Panel desktop ──────────────────────────────────────────── */
.amipo-cart-panel {
  display: none;
  position: sticky;
  top: 1.5rem;
  background: var(--amipo-card-bg);
  border: 1px solid var(--amipo-border);
  border-radius: var(--amipo-radius);
  box-shadow: var(--amipo-shadow);
  overflow: hidden;
}
.amipo-cart-panel.visible { display: block; }

/* ── En-tête du panier ──────────────────────────────────────── */
.amipo-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.1rem .7rem;
  border-bottom: 2px solid var(--amipo-accent);
}
.amipo-cart-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--amipo-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.amipo-cart-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: var(--amipo-accent);
  color: #1a3a6b;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 800;
  padding: 0 4px;
}
.amipo-cart-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--amipo-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.amipo-cart-close:hover { color: var(--amipo-danger); }

/* ── Liste des articles ─────────────────────────────────────── */
.amipo-cart-items { padding: .5rem 0; }

.amipo-cart-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: .6rem;
  align-items: start;
  padding: .75rem 1.1rem;
  border-bottom: 1px solid var(--amipo-bg);
}
.amipo-cart-item:last-child { border-bottom: none; }

.amipo-cart-item-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--amipo-bg);
  flex-shrink: 0;
}
.amipo-cart-item-img-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--amipo-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.amipo-cart-item-body { min-width: 0; }
.amipo-cart-item-name {
  font-weight: 700;
  font-size: .88rem;
  color: var(--amipo-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .2rem;
}
.amipo-cart-item-qty {
  font-size: .78rem;
  color: var(--amipo-muted);
  margin-bottom: .35rem;
}

.amipo-cart-item-dates {
  font-size: .78rem;
}
.amipo-cart-item-dates-btn {
  background: none;
  border: 1.5px dashed var(--amipo-primary);
  border-radius: 5px;
  color: var(--amipo-primary);
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .6rem;
  cursor: pointer;
  transition: background .12s;
}
.amipo-cart-item-dates-btn:hover { background: rgba(26,58,107,.07); }
.amipo-cart-item-dates-set {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.amipo-cart-item-dates-val {
  color: var(--amipo-primary);
  font-weight: 600;
}
.amipo-cart-item-dates-ok { color: var(--amipo-success); font-size: .9rem; }
.amipo-cart-item-montant {
  font-size: .82rem;
  color: var(--amipo-muted);
  margin-top: .2rem;
}
.amipo-cart-item-modify-btn {
  background: none;
  border: none;
  color: var(--amipo-primary);
  font-size: .72rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.amipo-cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.amipo-cart-remove-btn {
  background: none;
  border: none;
  color: var(--amipo-danger);
  font-size: .72rem;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.amipo-cart-remove-btn:hover { text-decoration: underline; }
.amipo-cart-item-price {
  font-weight: 700;
  font-size: .88rem;
  color: var(--amipo-primary);
  white-space: nowrap;
}

/* ── Pied du panier (total + bouton) ────────────────────────── */
.amipo-cart-footer {
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--amipo-border);
}
.amipo-cart-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .95rem;
  font-weight: 700;
  color: var(--amipo-primary);
  margin-bottom: .85rem;
}
.amipo-cart-total-amount { font-size: 1.1rem; }

.amipo-cart-notes { margin-bottom: .85rem; }
.amipo-cart-notes textarea {
  width: 100%;
  box-sizing: border-box;
  padding: .45rem .65rem;
  border: 1px solid var(--amipo-border);
  border-radius: 4px;
  font-size: .85rem;
  resize: vertical;
  min-height: 56px;
}

.amipo-cart-checkout-btn {
  display: block;
  width: 100%;
  padding: .7rem 1rem;
  background: var(--amipo-primary);
  color: #fff;
  border: none;
  border-radius: var(--amipo-radius);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: opacity .15s;
}
.amipo-cart-checkout-btn:hover:not(:disabled) { opacity: .88; }
.amipo-cart-checkout-btn:disabled { opacity: .45; cursor: not-allowed; }
.amipo-cart-dates-hint {
  text-align: center;
  font-size: .78rem;
  color: var(--amipo-warning);
  margin-top: .5rem;
}

/* ── Modal de sélection de dates par article ────────────────── */
.amipo-cart-date-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 10000;
}
.amipo-cart-date-overlay.visible { display: block; }

.amipo-cart-date-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 12px;
  z-index: 10001;
  width: 480px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
}
.amipo-cart-date-modal.visible { display: block; }

.amipo-cart-date-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--amipo-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.amipo-cart-date-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--amipo-primary);
  font-weight: 700;
}
.amipo-cart-date-modal-body { padding: 1rem 1.25rem 1.25rem; }
.amipo-cart-date-confirm-btn {
  display: block;
  width: 100%;
  margin-top: .85rem;
  padding: .65rem;
  background: var(--amipo-success);
  color: #fff;
  border: none;
  border-radius: var(--amipo-radius);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.amipo-cart-date-confirm-btn:hover:not(:disabled) { opacity: .88; }
.amipo-cart-date-confirm-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Layout catalogue avec panel desktop ────────────────────── */
.amipo-catalogue-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .amipo-catalogue-layout { grid-template-columns: 1fr; }
  .amipo-cart-panel { display: none !important; }
  .amipo-cart-bar.visible { display: flex; }
}
@media (min-width: 901px) {
  .amipo-cart-bar { display: none !important; }
}

/* ── Animation badge panier ─────────────────────────────────── */
@keyframes amipo-cart-bounce {
  0%   { transform: scale(1);   }
  35%  { transform: scale(1.4); }
  70%  { transform: scale(.9);  }
  100% { transform: scale(1);   }
}
.amipo-cart-badge-bounce { animation: amipo-cart-bounce .35s ease-out; }

/* Mobile ≤ 480px */
@media (max-width: 480px) {
  .amipo-cart-item { grid-template-columns: 40px 1fr auto; }
  .amipo-cart-item-img, .amipo-cart-item-img-placeholder { width: 40px; height: 40px; }
  .amipo-cart-date-modal { border-radius: 12px 12px 0 0; top: auto; bottom: 0; left: 0; right: 0; transform: none; max-width: 100%; }
}
