/* La Bande Son — admin */

.admin-body { background: var(--cream); min-height: 100vh; }

.admin-header {
  background: var(--ink);
  color: var(--cream);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-header .brand-mark { color: var(--gold); }
.admin-header .brand-line-1 { color: rgba(251,246,234,0.7); }
.admin-header .brand-line-2 { color: var(--cream); }
.admin-header-right { display: flex; align-items: center; gap: 18px; }
.admin-tag {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.admin-header .btn-ghost {
  color: var(--cream);
  border-color: rgba(251,246,234,0.3);
}
.admin-header .btn-ghost:hover {
  background: var(--cream);
  color: var(--ink);
}

[hidden] { display: none !important; }

/* Login */
.admin-login {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-box {
  max-width: 420px;
  width: 100%;
  background: var(--ivoire);
  padding: 40px 34px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(9,22,41,.10);
  box-shadow: var(--shadow);
}
.login-box h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  color: var(--ink);
  margin: 0 0 8px;
}
.login-box p { margin: 0 0 24px; color: var(--ink-soft); font-size: 15px; }
.login-box form { display: flex; flex-direction: column; gap: 16px; }
.login-back { margin: 20px 0 0; font-size: 13px; }
.login-back a { color: var(--ink-soft); }

.admin-main { padding: 40px 0 60px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}
.stat-card {
  background: var(--ivoire);
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(9,22,41,.08);
  position: relative;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 6px;
}
.stat-label {
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--brick);
  color: var(--cream);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .04em;
}

/* Pane head */
.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.pane-head h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 28px;
  margin: 0;
  color: var(--ink);
}
.pane-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.search-input,
.pane-actions select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 14px;
  border: 1px solid rgba(9,22,41,.18);
  border-radius: 999px;
  background: var(--ivoire);
  color: var(--ink);
  min-width: 200px;
}
.search-input:focus,
.pane-actions select:focus {
  outline: none;
  border-color: var(--brick);
}

/* Table */
.table-wrap {
  background: var(--ivoire);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(9,22,41,.08);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead {
  background: var(--ivoire-2);
}
.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.data-table td {
  padding: 14px 16px;
  border-top: 1px solid rgba(9,22,41,.06);
  vertical-align: top;
}
.data-table tr.clickable { cursor: pointer; transition: background .12s; }
.data-table tr.clickable:hover { background: rgba(184,151,96,0.10); }
.data-table .empty-row {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  padding: 40px;
}

/* Statut pills */
.statut-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}
.statut-pill.nouveau  { background: rgba(245,92,33,0.12); color: var(--brick); }
.statut-pill.contacte { background: rgba(184,151,96,0.18); color: #8a6d2f; }
.statut-pill.archive  { background: rgba(9,22,41,0.10); color: var(--ink-soft); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9,22,41,0.55);
}
.modal-panel {
  position: relative;
  background: var(--ivoire);
  padding: 40px;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1;
}
.modal-close:hover { color: var(--brick); }
.modal-panel h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  margin: 0 0 6px;
}
.meta-line {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 20px;
  font-style: italic;
}
.modal-panel dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 16px;
  margin: 0 0 20px;
  font-size: 14px;
}
.modal-panel dt { color: var(--ink-soft); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.modal-panel dd { margin: 0; }
.message-box {
  background: rgba(184,151,96,0.10);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
}
.statut-changer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid rgba(9,22,41,0.08);
}
.statut-changer-label {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  align-self: center;
  margin-right: 4px;
}
.chip-action {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(9,22,41,0.18);
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  transition: all .15s;
}
.chip-action:hover { border-color: var(--brick); }
.chip-action.is-active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.chip-action.chip-danger {
  margin-left: auto;
  color: var(--brick);
  border-color: rgba(245,92,33,0.25);
}
.chip-action.chip-danger:hover {
  background: var(--brick);
  color: var(--cream);
  border-color: var(--brick);
}

.form-feedback {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
.form-feedback.error {
  background: rgba(245,92,33,0.10);
  color: var(--brick);
  border: 1px solid rgba(245,92,33,0.25);
}

@media (max-width: 720px) {
  .modal-panel dl { grid-template-columns: 1fr; gap: 2px; }
  .modal-panel dt { margin-top: 10px; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; }
}

/* ─── Sélection multiple ─── */
.cell-check {
  width: 36px;
  text-align: center;
  padding: 8px 4px !important;
}
.cell-check input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--orange, #f55c21);
}

/* Bouton poubelle dans la toolbar */
.btn-icon-danger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(181, 64, 35, 0.3);
  color: #b54023;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-icon-danger:hover:not(:disabled) {
  background: #b54023;
  border-color: #b54023;
  color: #fbf6ea;
}
.btn-icon-danger:disabled {
  opacity: .35;
  cursor: not-allowed;
  border-color: rgba(9, 22, 41, 0.15);
  color: rgba(9, 22, 41, 0.4);
}
.btn-icon-count {
  font-size: 12px;
  font-weight: 700;
  background: #b54023;
  color: #fbf6ea;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.btn-icon-danger:disabled .btn-icon-count {
  background: rgba(9, 22, 41, 0.2);
  color: rgba(9, 22, 41, 0.5);
}

/* Hover de ligne tableau */
.data-table tbody tr:hover {
  background: rgba(245, 92, 33, 0.04);
}

/* Renforcer la priorité : la checkbox doit toujours être au-dessus et cliquable */
.data-table .cell-check {
  width: 44px;
  text-align: center;
  padding: 12px 6px !important;
  position: relative;
}
.data-table .cell-check input[type="checkbox"] {
  position: relative;
  z-index: 2;
  display: inline-block;
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  accent-color: #f55c21;
}

/* ─── Dashboard répartitions ─── */
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0 0 32px;
}
.dashboard-card {
  background: #fbf6ea;
  border: 1px solid rgba(9, 22, 41, 0.08);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 4px 14px -8px rgba(9, 22, 41, 0.12);
}
.dashboard-title {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft, #2a3a52);
  font-weight: 700;
}
.dashboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dashboard-item {
  display: grid;
  grid-template-columns: minmax(120px, 40%) 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink, #091629);
}
.dashboard-label {
  color: var(--ink, #091629);
  line-height: 1.3;
}
.dashboard-bar-wrap {
  height: 8px;
  background: rgba(9, 22, 41, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.dashboard-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f55c21 0%, #d84a15 100%);
  border-radius: 4px;
  transition: width .3s ease;
}
.dashboard-count {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink, #091629);
  min-width: 24px;
  text-align: right;
}
.dashboard-empty {
  font-style: italic;
  color: var(--ink-soft, #2a3a52);
  font-size: 13px;
  padding: 8px 0;
}

@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
}

/* ─── Formulaire d'édition dans le modal détail ─── */
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.edit-form {
  background: #fbf6ea;
  border: 1px solid rgba(9, 22, 41, 0.08);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.edit-field > span {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft, #2a3a52);
  font-weight: 600;
}
.edit-field input,
.edit-field textarea {
  padding: 9px 12px;
  border: 1px solid rgba(9, 22, 41, 0.15);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
}
.edit-field input:focus,
.edit-field textarea:focus {
  outline: none;
  border-color: #f55c21;
}
.edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.edit-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edit-group-label {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft, #2a3a52);
  font-weight: 600;
}
.edit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.edit-chip {
  cursor: pointer;
  user-select: none;
}
.edit-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.edit-chip span {
  display: inline-block;
  padding: 5px 12px;
  background: rgba(9, 22, 41, 0.05);
  color: var(--ink-soft, #2a3a52);
  border-radius: 14px;
  font-size: 12.5px;
  transition: background .15s ease, color .15s ease;
  border: 1px solid transparent;
}
.edit-chip input:checked + span {
  background: #f55c21;
  color: #fbf6ea;
  font-weight: 600;
}
.edit-chip:hover span {
  background: rgba(245, 92, 33, 0.15);
}
.edit-chip input:checked + span:hover {
  background: #d84a15;
}
.edit-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}
.btn-save {
  background: #f55c21;
  color: #fbf6ea;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-save:hover { background: #d84a15; }
.btn-cancel {
  background: transparent;
  color: var(--ink-soft, #2a3a52);
  border: 1px solid rgba(9, 22, 41, 0.15);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn-cancel:hover { background: rgba(9, 22, 41, 0.05); }

/* ─── Filtres par colonne ─── */
.data-table th.filterable {
  position: relative;
  cursor: pointer;
  user-select: none;
  padding-right: 26px !important;
}
.data-table th.filterable:hover { color: #f55c21; }
.data-table th.filterable.has-filter {
  color: #f55c21;
}
.col-filter-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  transition: transform .15s ease;
  opacity: 0.5;
}
.data-table th.filterable:hover .col-filter-icon,
.data-table th.filterable.has-filter .col-filter-icon {
  opacity: 1;
}
.data-table th.filterable.has-filter .col-filter-icon::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -6px;
  width: 6px;
  height: 6px;
  background: #f55c21;
  border-radius: 50%;
}

.col-filter-popover {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fbf6ea;
  border: 1px solid rgba(9, 22, 41, 0.15);
  border-radius: 8px;
  box-shadow: 0 10px 30px -10px rgba(9, 22, 41, 0.3);
  padding: 12px;
  min-width: 200px;
  max-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  text-transform: none;
  letter-spacing: normal;
  font-weight: normal;
  color: var(--ink, #091629);
  font-size: 13px;
}
.col-filter-popover .filter-title {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft, #2a3a52);
  font-weight: 700;
  margin-bottom: 8px;
}
.col-filter-popover ul {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.col-filter-popover li label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.col-filter-popover li label:hover { background: rgba(245, 92, 33, 0.08); }
.col-filter-popover input[type="checkbox"] {
  cursor: pointer;
  accent-color: #f55c21;
}
.col-filter-popover .filter-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(9, 22, 41, 0.08);
}
.col-filter-popover button {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid rgba(9, 22, 41, 0.15);
  background: transparent;
  border-radius: 5px;
  font-size: 11.5px;
  cursor: pointer;
}
.col-filter-popover button.primary {
  background: #f55c21;
  color: #fbf6ea;
  border-color: #f55c21;
  font-weight: 600;
}

/* Badge désinscrit dans le tableau */
.optout-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(181, 64, 35, 0.14);
  color: #b54023;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
  vertical-align: middle;
}

/* Ligne opt-out : opacité subtile (rappel visuel sans être intrusif) */
.data-table tbody tr.row-optout {
  opacity: 0.45;
}
.data-table tbody tr.row-optout:hover {
  opacity: 0.75;
}

/* Bouton envoi email dans la toolbar */
.btn-icon-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(9, 22, 41, 0.15);
  color: var(--ink, #091629);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-icon-primary:hover:not(:disabled) {
  background: #091629;
  border-color: #091629;
  color: #fbf6ea;
}
.btn-icon-primary:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.btn-icon-primary .btn-icon-count {
  font-size: 12px;
  font-weight: 700;
  background: #091629;
  color: #fbf6ea;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.btn-icon-primary:disabled .btn-icon-count {
  background: rgba(9, 22, 41, 0.2);
  color: rgba(9, 22, 41, 0.5);
}
.btn-icon-primary:hover:not(:disabled) .btn-icon-count {
  background: #fbf6ea;
  color: #091629;
}

/* Modal envoi groupé */
.modal-panel-large {
  max-width: 720px !important;
  width: calc(100% - 40px) !important;
}

.bulk-recipients-info {
  background: rgba(9, 22, 41, 0.04);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 10px 0 18px;
  font-size: 13.5px;
}
.recipients-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.recipients-active strong {
  color: #216a2f;
  font-size: 16px;
}
.recipients-excluded {
  color: #6b5525;
  font-size: 12.5px;
}
.recipients-empty {
  color: #b54023;
  margin-top: 8px;
  font-size: 13px;
}

.bulk-merge-tags {
  margin: 4px 0 10px;
  padding: 10px 14px;
  background: rgba(245, 92, 33, 0.05);
  border-radius: 6px;
  font-size: 12.5px;
  color: #4a4458;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.bulk-merge-tags strong {
  color: var(--ink, #091629);
  margin-right: 4px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tag-insert {
  background: white;
  border: 1px solid rgba(9, 22, 41, 0.15);
  padding: 3px 9px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
  color: var(--orange-dark, #b54023);
}
.tag-insert:hover {
  background: #f55c21;
  color: #fbf6ea;
  border-color: #f55c21;
}

.bulk-preview-toggle {
  margin: 8px 0;
}

.bulk-preview {
  background: white;
  border: 2px dashed rgba(9, 22, 41, 0.15);
  border-radius: 8px;
  padding: 18px 22px;
  margin: 6px 0 12px;
  font-family: Georgia, serif;
  line-height: 1.6;
}
.preview-header {
  font-size: 11.5px;
  color: #4a4458;
  letter-spacing: .04em;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(9, 22, 41, 0.08);
  margin-bottom: 12px;
  font-family: 'Instrument Sans', sans-serif;
}
.preview-subject {
  font-size: 15px;
  margin-bottom: 12px;
  color: #1c1a26;
}
.preview-body {
  font-size: 14px;
  color: #1c1a26;
  white-space: pre-line;
}
.preview-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(9, 22, 41, 0.08);
  font-size: 12px;
  color: #6b5525;
  font-style: italic;
}

#bulk-send-status {
  padding: 30px 20px;
  text-align: center;
  border-radius: 8px;
  background: rgba(46, 160, 67, 0.10);
  color: #216a2f;
  font-size: 15px;
}
.bulk-status-success {
  background: rgba(46, 160, 67, 0.10);
}

/* Ancien badge : rendre invisible s'il traîne quelque part */
.optout-badge { display: none; }

/* Nouveaux styles statut actif / inactif */
.statut-pill.statut-actif {
  background: rgba(46, 160, 67, 0.14);
  color: #216a2f;
}
.statut-pill.statut-inactif {
  background: rgba(9, 22, 41, 0.08);
  color: #4a5568;
}

/* Stat value avec accent vert pour les actifs */
.stat-value-actif { color: #216a2f !important; }

/* Zone danger dans le modal détail (à la place de statut-changer) */
.detail-danger-zone {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed rgba(9, 22, 41, 0.15);
  text-align: right;
}
