:root {
  --navy: #2e4052;
  --navy-dark: #202d3a;
  --yellow: #ffc857;
  --yellow-dark: #e6ac2e;
  --white: #ffffff;
  --surface: #ffffff;
  --grey-bg: #f4f6f8;
  --grey-border: #d9dfe4;
  --text: #2e4052;
  --muted-text: #5c6b7a;
  --error-bg: #ffeded;
  --error-text: #661d1d;
  --danger-solid: #b3261e;
  --success-bg: #e7faf0;
  --success-text: #1d6636;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Mode sombre automatique (préférence système), sauf si l'utilisateur a
   choisi explicitement via le bouton (data-theme="light"/"dark" sur <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #1c232c;
    --grey-bg: #10151b;
    --grey-border: #313d4a;
    --text: #e8ecf1;
    --muted-text: #9aa7b5;
    --error-bg: #3a1414;
    --error-text: #ff8a8a;
    --success-bg: #10321e;
    --success-text: #6fe3a0;
  }
}

:root[data-theme="dark"] {
  --surface: #1c232c;
  --grey-bg: #10151b;
  --grey-border: #313d4a;
  --text: #e8ecf1;
  --muted-text: #9aa7b5;
  --error-bg: #3a1414;
  --error-text: #ff8a8a;
  --success-bg: #10321e;
  --success-text: #6fe3a0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--grey-bg);
  line-height: 1.5;
  transition: background-color 0.15s ease, color 0.15s ease;
}

a {
  color: var(--text);
}

a:hover {
  opacity: 0.8;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

.dev-banner {
  background: var(--yellow);
  color: var(--navy);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
}

.site-header {
  background: var(--navy);
  color: var(--white);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.header-user-name {
  color: var(--white);
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.9;
}

.header-user-name:hover {
  opacity: 1;
  text-decoration: underline;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.theme-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

main.wrap {
  padding-top: 32px;
  padding-bottom: 48px;
  min-height: 60vh;
}

.card {
  background: var(--surface);
  border: 1px solid var(--grey-border);
  border-radius: 10px;
  padding: 28px 32px;
}

.card-narrow {
  max-width: 480px;
  margin: 0 auto;
}

h1 {
  margin-top: 0;
  color: var(--text);
}

h2 {
  color: var(--text);
  font-size: 1.15rem;
  border-bottom: 2px solid var(--yellow);
  padding-bottom: 6px;
}

.form-section {
  margin-top: 32px;
}

label {
  display: block;
  font-weight: 600;
  margin-top: 14px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grey-border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
  border-color: var(--yellow-dark);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: normal;
  margin-top: 12px;
}

.checkbox-row input[type="checkbox"] {
  margin-top: 4px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.stage-row {
  border: 1px solid var(--grey-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 14px;
}

.stage-interest {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--grey-border);
}

.stage-interest p.muted {
  margin-top: 6px;
}

.stage-reservation {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--grey-border);
}

.badge-full {
  display: inline-block;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

.muted {
  color: var(--muted-text);
  font-size: 0.92rem;
}

.dispo-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 10px;
}

.dispo-row label {
  margin-top: 0;
  flex: 1;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 6px;
  padding: 11px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--yellow);
  color: var(--navy-dark);
  margin-top: 24px;
}

.btn-primary:hover {
  background: var(--yellow-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--text);
  margin-top: 24px;
  margin-left: 10px;
}

.btn-secondary:first-child {
  margin-left: 0;
}

.btn-delete {
  background: var(--danger-solid);
  color: var(--white);
  margin-top: 24px;
}

.btn-delete:hover {
  opacity: 0.9;
}

.btn-remove-row {
  background: transparent;
  color: var(--error-text);
  border: 1px solid var(--grey-border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  height: fit-content;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.btn-danger {
  color: var(--error-text);
}

.inline-form {
  display: inline;
  margin-left: 10px;
}

.wizard-step .btn-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 1rem;
}

.notice {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 0;
}

.notice-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.notice-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--grey-border);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--grey-border);
  padding: 20px 0;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--text);
}

@media (max-width: 600px) {
  .card { padding: 20px; }
  .dispo-row { flex-direction: column; align-items: stretch; }
}

.toast-container {
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

.toast {
  background: var(--navy-dark);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.notif-wrap {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger-solid);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  width: 320px;
  max-width: 85vw;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--grey-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.notif-item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--grey-bg);
}

.notif-unread {
  background: var(--grey-bg);
}

.notif-message {
  display: block;
}

.notif-unread .notif-message {
  font-weight: 600;
}

.notif-time {
  display: block;
  color: var(--muted-text);
  font-size: 0.78rem;
  font-weight: normal;
  margin-top: 2px;
}

.notif-empty {
  padding: 16px;
  color: var(--muted-text);
  font-size: 0.9rem;
  margin: 0;
}

.feedback-wrap {
  position: relative;
}

.feedback-panel {
  position: absolute;
  top: 44px;
  right: 0;
  width: 340px;
  max-width: 85vw;
  background: var(--surface);
  border: 1px solid var(--grey-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  padding: 16px;
  /* Le panneau vit dans le header (texte clair sur fond bleu marine) :
     on force la couleur normale du texte pour rester lisible. */
  color: var(--text);
  text-align: left;
  font-weight: normal;
}

.feedback-panel h3 {
  color: var(--text);
}

.feedback-panel h3 {
  margin: 0 0 8px;
}

.feedback-panel textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 6px 0 12px;
}

.feedback-panel .checkbox-row {
  margin-top: 8px;
}

/* Pot de miel anti-robots : hors écran plutôt que display:none, que certains
   robots savent détecter. Jamais visible ni atteignable au clavier. */
.feedback-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
