/* ============================================================
   style.css — Notre Bocal
   ============================================================ */

/* ── Reset & base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #faf9f6;
  --bg2: #f2f0ea;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-md: rgba(0, 0, 0, 0.18);
  --text: #1a1a18;
  --text2: #6b6b62;
  --text3: #9e9e93;
  --accent: #7abcd0;
  --accent-dk: #4a9ab0;
  --teal: #1d9e75;
  --teal-bg: #e1f5ee;
  --teal-dk: #0f6e56;
  --amber: #ba7517;
  --amber-bg: #faeeda;
  --purple: #534ab7;
  --purple-bg: #eeedfe;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --radius: 10px;
  --radius-lg: 14px;
  font-size: 16px;
}

body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}
h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--text);
}
h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--text2);
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 54px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-weight: 600;
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-links a {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 0.875rem;
  color: var(--text2);
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
}
.btn-logout {
  color: var(--danger) !important;
  border: 0.5px solid var(--danger-bg) !important;
}

/* ── Layout pages ── */
.main-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem 4rem;
  gap: 1.2rem;
}

.admin-main,
.histo-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ── Bocal ── */
#bocal-wrap {
  width: 260px;
  height: 360px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

#bocal-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

#bouchon {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: 140px 60px;
}
#bouchon.open {
  transform: translateY(-60px) rotate(-12deg);
}

#papiers-group {
  transition: opacity 0.4s;
}

.papier {
  transform-box: fill-box;
  transform-origin: center;
}
.papier.mix {
  animation: tourbillon 0.25s ease-in-out infinite alternate;
}
.papier.mix:nth-child(2) {
  animation-delay: 0.05s;
  animation-direction: alternate-reverse;
}
.papier.mix:nth-child(3) {
  animation-delay: 0.1s;
}
.papier.mix:nth-child(4) {
  animation-delay: 0.15s;
  animation-direction: alternate-reverse;
}
.papier.mix:nth-child(5) {
  animation-delay: 0.08s;
}

@keyframes tourbillon {
  from {
    transform: rotate(-18deg) translateX(-8px);
  }
  to {
    transform: rotate(18deg) translateX(8px);
  }
}

#resultat-papier {
  transition: opacity 0.5s;
}

/* ── Hint ── */
#hint {
  font-size: 0.875rem;
  color: var(--text3);
  min-height: 1.4em;
}

/* ── Catégorie menu ── */
#categorie-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
#categorie-menu.hidden {
  display: none;
}

.cat-btn {
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: 99px;
  padding: 9px 24px;
  font-size: 0.9375rem;
  color: var(--text);
  cursor: pointer;
  min-width: 220px;
  text-align: center;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.cat-btn:hover {
  background: var(--bg2);
  border-color: var(--accent);
}

/* ── Résultat ── */
#result-box,
#empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 400px;
  text-align: center;
}
#result-box.hidden,
#empty-box.hidden {
  display: none;
}

#result-cat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
}

#result-text {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.55;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.result-actions button {
  background: var(--surface);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}
.result-actions button:hover {
  background: var(--bg2);
}

/* ── Admin ── */
.login-wrap {
  max-width: 340px;
  margin: 5rem auto;
  text-align: center;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 1.2rem;
}
.login-form input,
.login-form button {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 1rem;
}
.login-form input {
  border: 0.5px solid var(--border-md);
  background: var(--surface);
}
.login-form button {
  background: var(--teal);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.login-form button:hover {
  background: var(--teal-dk);
}

.admin-section {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.form-row label,
.add-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--text2);
  flex: 1;
  min-width: 160px;
}
.add-form textarea {
  resize: vertical;
  padding: 8px 10px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
}
.add-form select,
.add-form input[type="text"] {
  padding: 7px 10px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  background: var(--surface);
}
.add-form button[type="submit"] {
  align-self: flex-start;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  cursor: pointer;
  font-weight: 500;
}
.add-form button[type="submit"]:hover {
  background: var(--teal-dk);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.admin-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text3);
  border-bottom: 0.5px solid var(--border);
  font-weight: 500;
}
.admin-table td {
  padding: 8px 8px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.admin-table tr.row-picked td {
  color: var(--text3);
}
.admin-table tr:last-child td {
  border-bottom: none;
}

.td-center {
  text-align: center;
}
.td-actions {
  display: flex;
  gap: 4px;
}

.btn-sm {
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: background 0.15s;
}
.btn-sm:hover {
  background: var(--bg2);
}
.btn-delete {
  color: var(--danger);
  border-color: var(--danger-bg);
}
.btn-delete:hover {
  background: var(--danger-bg);
}
.btn-reset {
  color: var(--teal);
}

/* ── Historique ── */
.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.25rem;
  flex: 1;
  min-width: 120px;
}
.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text3);
  margin-bottom: 4px;
}
.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
}

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.filter-bar select {
  padding: 7px 12px;
  border: 0.5px solid var(--border-md);
  border-radius: 99px;
  font-size: 0.875rem;
  background: var(--surface);
  cursor: pointer;
}
.btn-clear {
  font-size: 0.8125rem;
  color: var(--text3);
  border: 0.5px solid var(--border);
  border-radius: 99px;
  padding: 5px 12px;
}
.btn-clear:hover {
  background: var(--bg2);
  text-decoration: none;
}

.tirage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tirage-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  transition: border-color 0.2s;
}
.tirage-card.statut-fait {
  border-left-color: var(--teal);
}
.tirage-card.statut-reporte {
  border-left-color: var(--amber);
}
.tirage-card.statut-a_faire {
  border-left-color: var(--border-md);
}

.tirage-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.tirage-date {
  font-size: 0.8rem;
  color: var(--text3);
  margin-left: auto;
}

.tirage-contenu {
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.5;
}

.tirage-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-statut {
  font-size: 0.8125rem;
  padding: 4px 12px;
  border: 0.5px solid var(--border-md);
  border-radius: 99px;
  background: var(--surface);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  color: var(--text2);
}
.btn-statut:hover {
  background: var(--bg2);
}
.btn-statut.active {
  background: var(--teal-bg);
  color: var(--teal-dk);
  border-color: var(--teal);
  font-weight: 500;
}

/* ── Badges ── */
.badge-type {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 99px;
  font-weight: 500;
}
.badge-type.question {
  background: var(--purple-bg);
  color: var(--purple);
}
.badge-type.activite {
  background: var(--teal-bg);
  color: var(--teal-dk);
}

.badge-cat {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--bg2);
  color: var(--text2);
}

/* ── Messages ── */
.msg-ok {
  background: var(--teal-bg);
  color: var(--teal-dk);
  padding: 8px 14px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.msg-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 8px 14px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.empty-msg {
  color: var(--text3);
  font-style: italic;
  text-align: center;
  padding: 2rem 0;
}

/* ── Utilitaire ── */
.hidden {
  display: none !important;
}

/* ── Timeline (adaptée au thème existant) ── */

.timeline {
  position: relative;
  margin-top: 1.5rem;
  padding-left: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-day {
  margin-bottom: 1.8rem;
}

.timeline-date {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 0.6rem;
  padding-left: 6px;
}

/* Item */
.timeline-item {
  position: relative;
  margin-bottom: 10px;
}

/* Point */
.timeline-dot {
  position: absolute;
  left: -1px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-md);
  border: 2px solid var(--bg);
  z-index: 2;
}

/* Couleurs statut (cohérent avec tes cards) */
.timeline-item.statut-fait .timeline-dot {
  background: var(--teal);
}
.timeline-item.statut-reporte .timeline-dot {
  background: var(--amber);
}
.timeline-item.statut-a_faire .timeline-dot {
  background: var(--border-md);
}

/* Contenu = tes cartes actuelles */
.timeline-content {
  margin-left: 14px;
}

/* On réutilise ton style existant */
.timeline-content .tirage-card {
  margin: 0;
}

/* ------------------------ */

.wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 2rem;
}

#wheel {
  width: 260px;
  height: 260px;
  transition: transform 3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wheel-pointer {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 16px solid var(--text);
  margin-bottom: -10px;
  z-index: 2;
}

#spin-btn {
  background: var(--teal);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  cursor: pointer;
}

#spin-btn:hover {
  background: var(--teal-dk);
}

#wheel-result {
  font-size: 0.9rem;
  color: var(--text2);
}

/* ── Burger ── */
.burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
}

.burger span {
  width: 20px;
  height: 2px;
  background: var(--text);
  display: block;
  transition: 0.3s;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .burger {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 54px;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    width: 200px;
    border-left: 0.5px solid var(--border);
    border-bottom: 0.5px solid var(--border);
    padding: 10px;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 10px;
    border-radius: var(--radius);
  }
}

.result-box {
  margin: 15px 0;
  padding: 15px;
  border-radius: var(--radius-lg);
  background: var(--teal-bg);
  color: var(--teal-dk);
  font-weight: 500;
  text-align: center;
}

.btn-primary {
  background: var(--purple);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 10px;
  font-weight: 500;
  transition:
    background 0.15s,
    transform 0.1s;
}

.btn-primary:hover {
  background: var(--teal-dk);
}

.btn-primary:active {
  transform: scale(0.97);
}
