:root {
  --bg: #12141a;
  --bg-card: #1b1e27;
  --border: #2b2f3a;
  --text: #e6e8ee;
  --text-dim: #9aa0ac;
  --accent: #4f7cff;
  --green: #2ecc71;
  --red: #e74c3c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.navbar a {
  color: var(--text-dim);
  text-decoration: none;
  margin-right: 18px;
  font-size: 14px;
}

.navbar .brand {
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
}

.navbar a:hover { color: var(--accent); }

.username {
  color: var(--text-dim);
  margin-right: 12px;
  font-size: 14px;
}

h1 { font-size: 22px; margin-bottom: 4px; }
h2 { font-size: 17px; margin-top: 28px; color: var(--text-dim); }

.hint { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }

.flash-container { margin-bottom: 16px; }
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}
.flash-error { background: rgba(231, 76, 60, 0.15); color: #ff8579; border: 1px solid rgba(231,76,60,0.4); }
.flash-success { background: rgba(46, 204, 113, 0.15); color: #6ee7a0; border: 1px solid rgba(46,204,113,0.4); }

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 40px !important;
}

.toggle-password {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  margin: 0;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.navbar .nav-left a[target="_blank"] {
  color: #f7c948;
}
.navbar .nav-left a[target="_blank"]:hover { color: #ffd766; }

.auth-card, .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  max-width: 420px;
  margin: 40px auto;
}

.card { max-width: 100%; margin: 16px 0; }

form label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 14px 0 6px;
}

form input[type="text"],
form input[type="password"],
form input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  background: #0f1116;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

button, .btn-secondary {
  margin-top: 18px;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  margin-top: 0;
}

.auth-switch { margin-top: 18px; font-size: 13px; color: var(--text-dim); }
.auth-switch a { color: var(--accent); }

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

.calendar-table, .excel-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

.calendar-table th, .calendar-table td,
.excel-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: center;
  white-space: nowrap;
}

.calendar-table th { background: var(--bg-card); color: var(--text-dim); font-weight: 500; }
.weekend-label { text-align: left !important; color: var(--text-dim); }

.status-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  margin: 0;
  padding: 4px 10px;
}

.status-dispo { background: rgba(46, 204, 113, 0.08); }
.status-indispo { background: rgba(231, 76, 60, 0.08); }

.upload-form { margin-top: 20px; }

.fiche-list { margin-top: 12px; }
.fiche-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

/* ---------- Page d'accueil / hero ---------- */
html, body.home-body { height: 100%; }
body.home-body { margin: 0; }

.hero {
  position: relative;
  min-height: 100vh;
  background-image: url("images/hero.jpg");
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 8, 20, 0.55) 0%, rgba(10, 8, 20, 0.85) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 640px;
  padding: 32px 24px;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 13px;
  color: #f7c948;
  font-weight: 700;
  margin-bottom: 10px;
}

.hero h1 {
  font-size: 42px;
  line-height: 1.15;
  color: white;
  margin: 0 0 14px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.6);
}

.hero-sub {
  color: #dcdce6;
  font-size: 16px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-hero-primary, .btn-hero-secondary {
  padding: 12px 26px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}

.btn-hero-primary {
  background: var(--accent);
  color: white;
}

.btn-hero-secondary {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
}

.hero .flash-container { margin-bottom: 20px; }

/* ---------- Admin tag ---------- */
.admin-tag {
  background: rgba(247, 201, 72, 0.18);
  color: #f7c948;
  border: 1px solid rgba(247, 201, 72, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  vertical-align: middle;
}

/* ---------- Calendrier : week-ends JDR ---------- */
tr.row-eligible {
  outline: 1px solid rgba(247, 201, 72, 0.4);
}
tr.row-eligible .weekend-label { color: #f7c948; }

tr.row-jdr {
  background: rgba(247, 201, 72, 0.12) !important;
}
tr.row-jdr .weekend-label { color: #f7c948; font-weight: 600; }

.calendar-table td.weekend-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  white-space: normal;
}

.btn-agenda {
  text-decoration: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-agenda:hover { color: var(--text); border-color: var(--accent); }

.jdr-badge {
  display: inline-block;
  margin-left: 10px;
  background: #f7c948;
  color: #1b1400;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.btn-tiny {
  padding: 5px 10px;
  font-size: 12px;
  margin-top: 0;
  background: var(--accent);
  border-radius: 5px;
}
.btn-tiny-danger { background: var(--red); }

/* ---------- Discussion ---------- */
.message-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.message-author {
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}

.message-date {
  font-size: 12px;
  color: var(--text-dim);
}

.message-content {
  margin: 0 0 8px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-delete-form { margin: 0; }

/* ---------- Admin ---------- */
.admin-table td, .admin-table th { white-space: nowrap; }
.admin-table td:nth-child(1) { white-space: normal; }

/* ---------- Fiches / ARC ---------- */
.fiches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.fiche-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.fiche-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0f1116;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fiche-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fiche-photo-placeholder {
  font-size: 40px;
  color: var(--text-dim);
}

.fiche-body { padding: 16px; }
.fiche-body h2 { margin: 0 0 2px; font-size: 18px; color: var(--text); }
.fiche-owner { color: var(--text-dim); font-size: 12px; margin: 0 0 16px; }

.arc-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.arc-triangle {
  flex: 0 0 auto;
  width: 42px;
  height: 38px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 5px;
  color: white;
  font-weight: 800;
  font-size: 15px;
}

.arc-blue { background: #2b57e8; }
.arc-gold { background: #e8b122; }
.arc-red { background: #d6382f; }

.arc-content { flex: 1; min-width: 0; }

.arc-label {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.arc-label-blue { color: #6d8bff; }
.arc-label-gold { color: #f0c04a; }
.arc-label-red { color: #ef6259; }

.arc-line {
  height: 2px;
  width: 100%;
  margin-bottom: 6px;
}
.arc-line-blue { background: #2b57e8; }
.arc-line-gold { background: #e8b122; }
.arc-line-red { background: #d6382f; }

.arc-text {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.fiche-gsheet, .fiche-body > .btn-secondary {
  display: inline-block;
  margin-top: 6px;
  margin-right: 8px;
}

/* ---------- Formulaire édition de fiche ---------- */
.fiche-edit-card { max-width: 520px; }
.fiche-edit-card textarea {
  width: 100%;
  padding: 10px 12px;
  background: #0f1116;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.current-photo {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
