/* ===========================
   Variables
   =========================== */
:root {
  --bg-page: #fdf6ee;
  --bg-surface: #ffffff;
  --bg-zebra: #fff7ed;
  --border: #e7e5e4;
  --border-light: #f5f5f4;
  --text-primary: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #a8a29e;
  --text-nav: #78716c;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --logo-color: #92400e;
  --danger: #dc2626;
  --danger-border: #fca5a5;
  --text-label: #57534e;
  --border-hover: #c7c3c0;
  --bg-danger: #fef2f2;
  --nav-height: 52px;
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
}

h1, h2, h3 { line-height: 1.2; }

/* ===========================
   Navigation
   =========================== */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-nav {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: stretch;
  height: var(--nav-height);
}

.site-nav .logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--logo-color);
  text-decoration: none;
  margin-right: 2rem;
  flex-shrink: 0;
}

.site-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-size: 13.5px;
  color: var(--text-nav);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

.site-nav .nav-link:hover { color: var(--text-primary); }

.site-nav .nav-link[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ===========================
   Layout
   =========================== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.form-container { max-width: 560px; }

/* ===========================
   Page Header
   =========================== */
.page-back {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 0.4rem;
}

.page-back:hover { color: var(--text-secondary); }

.form-page-header {
  margin-bottom: 1.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.page-header .actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.concert-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-nav);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text-secondary); }

.btn-danger {
  background: none;
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover { background: var(--bg-danger); }

.btn-primary.btn-submit {
  border-radius: 6px;
}

/* ===========================
   Tables
   =========================== */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

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

.table-card thead tr { background: var(--bg-page); }

.table-card th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table-card th.col-right { text-align: right; }

.table-card td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13.5px;
}

.table-card tbody tr:last-child td { border-bottom: none; }
.table-card tbody tr:nth-child(even) { background: var(--bg-zebra); }

.table-card td.col-right {
  text-align: right;
  white-space: nowrap;
}

.table-card a.row-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.table-card a.row-link:hover { text-decoration: underline; }

.table-card select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
}

.address-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-cell {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
  text-align: right;
}

.section-understaffed-icon {
  margin-left: 0.35rem;
  font-size: 0.95rem;
  color: #ca8a04;
  cursor: help;
  vertical-align: middle;
}

/* ===========================
   Section cards (concert show)
   =========================== */
.section-card table {
  width: 100%;
  border-collapse: collapse;
}

.section-card td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13.5px;
}

.section-card tbody tr:last-child td { border-bottom: none; }
.section-card tbody tr:nth-child(even) { background: var(--bg-zebra); }

.concert-section-row {
  cursor: pointer;
}

.concert-section-row:hover { background: var(--border-light); }

.concert-section-row:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.section-card td.col-right {
  text-align: right;
  white-space: nowrap;
}

.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.section-card-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.section-card-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.section-card-header .hint {
  margin: 0.2rem 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.section-card .hint {
  padding: 1rem;
  margin: 0;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .two-col-grid { grid-template-columns: 1fr; }
}

/* ===========================
   Forms
   =========================== */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-label);
  cursor: pointer;
}

.form-group > label input,
.form-group > label textarea,
.form-group > label select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  outline: none;
  transition: border-color 0.15s;
}

.form-group > label input:focus,
.form-group > label textarea:focus,
.form-group > label select:focus {
  border-color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ===========================
   Error box
   =========================== */
.error-box {
  background: var(--bg-danger);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 13.5px;
}

/* ===========================
   Misc
   =========================== */
.hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0;
}

.form-inline {
  display: inline;
}

.attendance-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ===========================
   Modal (détail section concert)
   =========================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(85vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
}

.modal-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--border-light);
}

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.section-song-block + .section-song-block {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

.section-song-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-player-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-player-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  margin-bottom: 4px;
  border-radius: 6px;
  border-left: 3px solid var(--border);
}

.section-player-line:last-child { margin-bottom: 0; }

.section-player-line--present {
  background: #ecfdf5;
  border-left-color: #10b981;
}

.section-player-line--absent {
  background: var(--bg-danger);
  border-left-color: var(--danger);
}

.section-player-name { font-weight: 500; }

.section-player-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.section-player-line--present .section-player-status { color: #047857; }

.section-player-line--absent .section-player-status { color: var(--danger); }

.modal-body-placeholder {
  color: var(--text-muted);
  margin: 0;
}

/* ===========================
   Admin mode
   =========================== */
.admin-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.admin-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.admin-toggle--active {
  color: var(--accent);
  border-color: var(--accent);
}

#admin-dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 340px;
  width: 100%;
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

#admin-dialog::backdrop {
  background: rgba(28, 25, 23, 0.35);
}

#admin-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--text-primary);
}

#admin-dialog input[type="password"] {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  outline: none;
  transition: border-color 0.15s;
}

#admin-dialog input[type="password"]:focus {
  border-color: var(--accent);
}

.dialog-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0.4rem 0 0.5rem;
  display: none;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.attendance-checkbox--readonly {
  pointer-events: none;
  cursor: default;
}
