/* ===========================
   Variables & reset
   =========================== */
:root {
  --bg: #0b1220;
  --panel: #0f172a;
  --panel-2: #111827;
  --text: #e6edf6;
  --muted: #9aa4b2;
  --brand: #5aa4ff;
  --ring: rgba(90, 164, 255, .25);
  --card-border: rgba(255, 255, 255, .06);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* ===========================
   Topbar
   =========================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 8px;
}

.logo {
  height: 64px;
  width: 64px;
  border-radius: 12px
}

.brand {
  font-weight: 700;
  font-size: 22px
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  display: none
}

/* ===========================
   Filtres (desktop par défaut)
   =========================== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 0 18px 10px;
}

.filter-left,
.filter-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

label {
  color: var(--muted);
  font-size: 13px
}

input[type="text"],
select,
button {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

button {
  background: var(--brand);
  border-color: transparent;
  color: #081523;
  font-weight: 600;
  cursor: pointer
}

button.ghost {
  background: transparent;
  border-color: var(--card-border);
  color: var(--text)
}

button:hover,
.btn:hover {
  background-color: #1d4ed8
}

button:focus,
input:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring)
}

/* ===========================
   Compteur
   =========================== */
.count {
  padding: 0 18px 10px;
  color: var(--muted)
}

/* ===========================
   Grid & Cards
   =========================== */
.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
  justify-content: center;
  padding: 0 18px 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card .thumb {
  width: 100%;
  aspect-ratio: 16/9;
  height: clamp(160px, 22vw, 260px);
  border-radius: 16px 16px 0 0;
  background: var(--panel-2) center/cover no-repeat;
}

.card-body {
  padding: 14px
}

.title {
  font-weight: 700;
  margin: 6px 0 8px;
  font-size: 1.05rem
}

.meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.meta a {
  color: var(--brand);
  text-decoration: none
}

.meta a:hover {
  opacity: .9
}

details {
  background: var(--panel-2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-top: 8px
}

summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  user-select: none;
  font-size: .95rem
}

summary::-webkit-details-marker {
  display: none
}

details .text {
  padding: 12px;
  color: #dbe3ee;
  border-top: 1px solid var(--card-border);
  white-space: pre-wrap;
}

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px
}

/* ===========================
   Lightbox
   =========================== */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .7);
  padding: 2vmin;
  z-index: 9999;
}

.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* ===========================
   Page deck.php
   =========================== */
.wrap {
  max-width: 1100px;
  margin: 16px auto 32px;
  padding: 0 18px
}

.deck-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.deck-thumb img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  object-fit: cover;
  background: var(--panel-2);
}

.deck-info h1 {
  margin: 6px 0 8px
}

.deck-desc {
  color: #dbe3ee;
  margin-top: 8px
}

.actions {
  margin-top: 10px
}

@media (max-width:780px) {
  .deck-card {
    grid-template-columns: 1fr
  }
}

.block {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-top: 16px;
}

.muted {
  color: var(--muted)
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--card-border);
  font-size: .85rem;
}

.back {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--panel-2);
}

.back:hover {
  opacity: .9
}

.flash-ok {
  background: #0f2b1e;
  border: 1px solid #1e7f4f;
  color: #d1fae5;
  padding: .7rem 1rem;
  border-radius: 12px;
  margin-top: 12px;
}

.flash-err {
  background: #2b1515;
  border: 1px solid #9b1c1c;
  color: #fde2e2;
  padding: .7rem 1rem;
  border-radius: 12px;
  margin-top: 12px;
}

/* ===========================
   Commentaires
   =========================== */
form.comment {
  display: grid;
  gap: 12px;
  max-width: 720px
}

.form-row {
  display: grid;
  gap: 6px
}

form.comment input[type="text"],
form.comment textarea {
  background-color: #0f172a;
  color: #e5e7eb;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
}

form.comment textarea {
  min-height: 160px;
  resize: vertical
}

form.comment input[type="text"]:focus,
form.comment textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .35);
}

.comment-item {
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 12px;
}

.comment-meta {
  color: #9ca3af;
  font-size: .9rem;
  margin-bottom: 6px
}

.comment-body {
  white-space: pre-wrap;
  word-break: break-word
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 10px
}

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.pagination button {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
}

.pagination button:disabled {
  opacity: .5;
  cursor: not-allowed
}

/* ===========================
   Pager de l’index
   =========================== */
.pager {
  display: flex;
  justify-content: center;
  margin: 16px 0 40px
}

.pager-wrap {
  display: flex;
  gap: 12px;
  align-items: center
}

.pager-info {
  opacity: .8
}

.pager-prev,
.pager-next {
  padding: 8px 12px
}

/* ===========================
   Hamburger + Drawer mobile
   =========================== */

/* Bouton hamburger : caché par défaut (desktop) */
#filterToggle {
  display: none;
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1400;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #1f2937;
  border: 1px solid #2b3b52;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0;
  /* aucune chance de voir '---' */
  line-height: 0;
}

#filterToggle:focus-visible {
  outline: 2px solid #6aa2ff;
}

/* trois barres centrées avec un seul pseudo-élément */
#filterToggle::before {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: #e5ecff;
  border-radius: 2px;
  box-shadow: 0 -6px 0 #e5ecff, 0 6px 0 #e5ecff;
}

/* Backdrop : caché par défaut (desktop) */
.mobile-backdrop {
  display: none;
}

/* --------- Mode mobile (< 992px) --------- */
@media (max-width: 991.98px) {
  #filterToggle {
    display: grid;
  }

  /* Panneau latéral (le même #filters, on ne duplique pas) */
  #filters {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 85vw);
    height: 100dvh;
    background: var(--panel);
    border-left: 1px solid rgba(255, 255, 255, .08);
    z-index: 1300;
    transform: translateX(100%);
    transition: transform .25s ease;
    overflow: auto;
    padding: 16px 16px 24px;
  }

  #filters.open {
    transform: translateX(0);
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    display: block;
  }

  .mobile-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }
}

/* --------- Desktop (>= 992px) : inline --------- */
@media (min-width: 992px) {
  #filters {
    position: static;
    transform: none !important;
    height: auto;
    width: auto;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .mobile-backdrop {
    display: none !important;
  }
}

/* --- Mobile plus compact pour la grille --- */
@media (max-width: 599px) {
  .grid {
    grid-template-columns: 1fr
  }

  .card .thumb {
    height: clamp(140px, 42vw, 220px)
  }
}

/* ====== Page commentaires — responsive ====== */
.deck-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto 40px;
  padding: 0 16px;
}

.deck-left .panel,
.deck-right>.panel {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.deck-thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.deck-title {
  font-weight: 700;
  margin: 10px 0 6px
}

.deck-id {
  color: var(--muted);
  font-size: .9rem
}

.info-block {
  margin-top: 12px
}

.info-block .muted {
  color: var(--muted);
  margin-bottom: 4px
}

.comment input[type="text"],
.comment textarea {
  width: 100%
}

.counter {
  font-size: .85rem;
  color: var(--muted);
  margin: 6px 0 12px
}

.btn-primary {
  width: 100%;
  height: 40px;
  background: var(--brand);
  color: #081523;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer
}

.comments-panel .pager {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0 4px
}

.comments-panel .pager button {
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px
}

@media (max-width: 920px) {
  .deck-layout {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 0 12px
  }

  .deck-left .panel,
  .deck-right>.panel {
    padding: 14px
  }

  .btn-primary {
    width: 100%
  }
}

/* Liste des commentaires */
.list {
  display: block;
}

.comment-item {
  display: block;
  padding: 10px 0;
  border-top: 1px solid #223;
}

.comment-meta {
  font-size: 12px;
  color: #9aa4b2;
  margin-bottom: 4px;
}

.comment-body {
  color: #e5e7eb;
  white-space: normal;
}

.comment-item {
  background: #111826;
  border-radius: 6px;
  margin-bottom: 10px;
  padding: 10px 14px;
}

.comment-meta {
  font-size: 12px;
  color: #9aa4b2;
  margin-bottom: 4px;
}

.comment-body {
  color: #e5e7eb;
  white-space: normal;
  line-height: 1.4;
}