/* Bourse au matériel — frontend styles */
.bam-app {
  --bam-bg: #ffffff;
  --bam-ink: #16202a;
  --bam-muted: #6b7a8c;
  --bam-line: #e5e9ef;
  --bam-accent: #0f766e;
  --bam-accent-dark: #0b5850;
  --bam-red: #e02424;
  --bam-red-dark: #b81c1c;
  --bam-radius: 16px;
  --bam-shadow: 0 8px 24px rgba(16, 32, 48, 0.08);
  --bam-max: 1120px;
  color: var(--bam-ink);
  font-size: 16px;
  line-height: 1.55;
  max-width: var(--bam-max);
  margin-left: auto;
  margin-right: auto;
}

.bam-app *,
.bam-app *::before,
.bam-app *::after { box-sizing: border-box; }

.bam-card {
  background: var(--bam-bg);
  border: 1px solid var(--bam-line);
  border-radius: var(--bam-radius);
  box-shadow: var(--bam-shadow);
  padding: 24px;
  margin-bottom: 28px;
}

/* Narrow, centered submit / manage blocks */
.bam-form-wrap,
.bam-manage {
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

/* Collapsible submit form: red button centered, form opens below without reload */
.bam-form-toggle { text-align: center; margin-bottom: 28px; }
.bam-form-toggle__btn { display: inline-flex; list-style: none; }
.bam-form-toggle__btn::-webkit-details-marker { display: none; }
.bam-form-toggle__btn::after { content: "▾"; margin-left: 8px; transition: transform .15s ease; }
.bam-form-toggle[open] > .bam-form-toggle__btn::after { transform: rotate(180deg); }
.bam-form-toggle .bam-form-wrap { text-align: left; margin-top: 18px; margin-bottom: 0; }

.bam-form-title { margin: 0 0 4px; font-size: 1.4rem; }
.bam-form-sub { margin: 0 0 18px; color: var(--bam-muted); font-size: 0.92rem; }

.bam-field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.bam-field label { font-weight: 600; font-size: 0.9rem; }
.bam-field input[type="text"],
.bam-field input[type="email"],
.bam-field input[type="url"],
.bam-field input[type="number"],
.bam-field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--bam-line);
  border-radius: 10px;
  font: inherit;
  background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s;
}
.bam-field input:focus,
.bam-field textarea:focus {
  outline: none;
  border-color: var(--bam-red);
  box-shadow: 0 0 0 3px rgba(224, 36, 36, .15);
}
.bam-hint { color: var(--bam-muted); font-size: .8rem; }
.bam-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .bam-grid-2 { grid-template-columns: 1fr; } }

.bam-hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* Flat red buttons */
.bam-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 20px; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; box-shadow: none;
  background: var(--bam-red); color: #fff;
  transition: background .15s ease;
}
.bam-btn:hover,
.bam-btn:focus-visible { background: var(--bam-red-dark); color: #fff; }
.bam-btn--primary { background: var(--bam-red); color: #fff; }
.bam-btn--primary:hover { background: var(--bam-red-dark); color: #fff; }
.bam-btn--ghost { background: var(--bam-red); color: #fff; border-color: var(--bam-red); }
.bam-btn--ghost:hover { background: var(--bam-red-dark); color: #fff; }

/* Bouton contour : fond blanc, texte et contour #E44A4A, survol gris #3f3f3f */
.bam-btn--outline {
  background: #fff; color: #e44a4a; border-color: #e44a4a;
}
.bam-btn--outline:hover,
.bam-btn--outline:focus-visible {
  background: #3f3f3f; color: #fff; border-color: #3f3f3f;
}

.bam-notice { border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-size: .95rem; }
.bam-notice--ok { background: #e7f6f2; color: #0b5850; }
.bam-notice--ko { background: #fdecec; color: #92231f; }
.bam-notice ul { margin: 0; padding-left: 18px; }

.bam-manage summary { cursor: pointer; font-weight: 600; }
.bam-form--inline { margin-top: 14px; }

.bam-file-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bam-file-preview img { width: 80px; height: 45px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bam-line); }

/* Listing */
.bam-list { display: grid; gap: 24px; justify-content: center; }
.bam-list--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .bam-list--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .bam-list--grid { grid-template-columns: minmax(0, 1fr); } }
.bam-list--list { grid-template-columns: minmax(0, 860px); }

.bam-ad {
  background: var(--bam-bg);
  border: 1px solid var(--bam-line);
  border-radius: var(--bam-radius);
  box-shadow: var(--bam-shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.bam-ad:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(16,32,48,.12); }
.bam-list--list .bam-ad { flex-direction: row; }
.bam-list--list .bam-ad__media { width: 42%; min-width: 280px; }
@media (max-width: 760px) { .bam-list--list .bam-ad { flex-direction: column; } .bam-list--list .bam-ad__media { width: 100%; } }

.bam-ad__stage { position: relative; aspect-ratio: 16 / 9; background: #0d1620; }
.bam-ad__stage img,
.bam-ad__stage iframe { width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.bam-ad__stage img { cursor: zoom-in; }
.bam-ad__noimg { display: grid; place-items: center; height: 100%; color: #7c8b9a; font-size: .9rem; }

.bam-thumbs {
  display: flex; gap: 8px; padding: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.bam-thumb {
  position: relative; flex: 0 0 calc((100% - 16px) / 3);
  aspect-ratio: 16 / 9; padding: 0; border: 2px solid transparent;
  border-radius: 8px; overflow: hidden; cursor: pointer; background: transparent;
  scroll-snap-align: start;
  transition: border-color .15s ease;
}
.bam-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block; margin: 0; border: 0; border-radius: 0;
}
.bam-thumb:hover { border-color: var(--bam-red); }
.bam-thumb.is-active { border-color: var(--bam-red); }
.bam-thumb__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; background: rgba(0,0,0,.35); font-size: 1.1rem;
}

.bam-ad__body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.bam-ad__title { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.bam-ad__meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .86rem; color: var(--bam-muted); }
.bam-price { background: #fdecec; color: var(--bam-red-dark); font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.bam-ad__desc { font-size: .95rem; color: #38485a; }
.bam-ad__desc p { margin: 0 0 8px; }
.bam-ad__body .bam-btn { align-self: flex-start; margin-top: auto; }

.bam-msg-form { margin-top: 14px; border-top: 1px dashed var(--bam-line); padding-top: 14px; }
.bam-msg-status { font-size: .88rem; margin: 8px 0 0; }
.bam-msg-status.is-ok { color: #0b5850; }
.bam-msg-status.is-ko { color: #92231f; }

.bam-empty { color: var(--bam-muted); }
.bam-pagination { display: flex; gap: 8px; margin-top: 24px; justify-content: center; }
.bam-page { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--bam-line); text-decoration: none; color: var(--bam-ink); }
.bam-page.is-current { background: var(--bam-red); color: #fff; border-color: var(--bam-red); }

/* Lightbox */
body.bam-noscroll { overflow: hidden; }
.bam-lightbox {
  position: fixed; inset: 0; z-index: 99999;
  display: none; align-items: center; justify-content: center;
  background: rgba(8, 12, 18, .92);
  padding: 32px 64px;
}
.bam-lightbox.is-open { display: flex; }
.bam-lb__stage { margin: 0; max-width: 100%; max-height: 100%; display: flex; }
.bam-lb__stage img {
  max-width: 100%; max-height: 88vh; width: auto; height: auto;
  object-fit: contain; border-radius: 6px; background: #000;
}
.bam-lb__close,
.bam-lb__nav {
  position: absolute; background: rgba(255,255,255,.12); color: #fff;
  border: 0; cursor: pointer; border-radius: 6px; line-height: 1;
  transition: background .15s ease;
}
.bam-lb__close:hover,
.bam-lb__nav:hover { background: var(--bam-red, #e02424); }
.bam-lb__close { top: 18px; right: 20px; font-size: 30px; width: 44px; height: 44px; }
.bam-lb__nav { top: 50%; transform: translateY(-50%); font-size: 24px; width: 46px; height: 64px; }
.bam-lb__prev { left: 12px; }
.bam-lb__next { right: 12px; }
.bam-lb__count { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #cfd8e3; font-size: .9rem; }
@media (max-width: 640px) {
  .bam-lightbox { padding: 16px; }
  .bam-lb__nav { width: 38px; height: 52px; font-size: 18px; }
}
