/* ==========================================================
   STYLE.CSS — Feuille de style unifiée

   Convention adoptée : on garde les DEUX familles de noms de
   boutons en alias l'une de l'autre (.btn-primary == .btn-blue,
   etc.) pour ne pas devoir toucher tous les templates en même
   temps. Idéalement, à terme, migrer tous les templates vers
   une seule convention (je recommande btn-primary/success/danger,
   plus parlant que blue/green/red) et supprimer les alias.
========================================================== */

/* ==========================================================
   VARIABLES
========================================================== */
:root {
  --bg-main: #0b1120;
  --bg-secondary: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #26364d;
  --bg-input: #0f172a;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #2563eb;

  --success: #10b981;
  --success-hover: #059669;

  --danger: #ef4444;
  --danger-hover: #dc2626;

  --warning: #f59e0b;

  --secondary: #475569;
  --secondary-hover: #334155;

  --border: #334155;

  --shadow: 0 12px 25px rgba(0, 0, 0, 0.35);

  --radius: 10px;
  --radius-sm: 4px;

  --transition: 0.2s ease;
}

/* ==========================================================
   RESET
========================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: #60a5fa;
}

h2 {
  font-size: 24px;
  font-weight: 700;
}

h3 {
  font-size: 20px;
  font-weight: 700;
}

p {
  color: var(--text-secondary);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 25px 0;
}

/* ==========================================================
   SCROLLBAR
========================================================== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ==========================================================
   LAYOUT
========================================================== */
.page {
  width: min(1400px, 95%);
  margin: auto;
  padding: 40px 0;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* ==========================================================
   HEADER (page header, ex: <header> dans layout.html)
========================================================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

header p {
  color: var(--text-muted);
  margin-top: 5px;
}

/* Header spécifique à la page mods (.header), distinct de <header> générique */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
}

.top-action {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 30px;
}

/* ==========================================================
   BUTTONS
   Deux familles de noms cohabitent (héritées des 2 projets).
   Elles sont strictement équivalentes visuellement.
========================================================== */
.btn {
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Bleu : .btn-primary */
.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* Vert : .btn-success */
.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: var(--success-hover);
}

/* Rouge : .btn-danger */
.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

/* Gris : .btn-secondary */
.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: white;
}

.btn-outline:hover {
  background: var(--bg-card-hover);
}

.btn-outline-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.disabled-action {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================
   CARDS — carte générique (maps/dashboard)
========================================================== */
.card {
  background: linear-gradient(180deg, #1e293b, #172334);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  transition: var(--transition);
  animation: fadeIn 0.35s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.card h2,
.card h3 {
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.stat-card {
  text-align: center;
}

.big-number {
  font-size: 42px;
  font-weight: bold;
  color: var(--success);
  margin-top: 10px;
}

/* ==========================================================
   MOD CARD — carte spécifique à la page mods
========================================================== */
.mod-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-left: 6px solid #64748b;
  transition: border-color 0.2s;
}

.mod-card.active {
  border-left-color: var(--success);
}

.mod-card.not-initialized {
  opacity: 0.6;
  border: 2px dashed var(--danger);
}

.mod-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.mod-info {
  flex: 1;
}

.mod-info h2 {
  margin: 0 0 6px 0;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mod-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.mod-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.mod-category-select {
  font-size: 12px;
  margin-left: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  width: auto;
}

.mod-command-wrapper {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mod-command-wrapper label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0;
}

.mod-command-field {
  width: 100%;
  max-width: 500px;
  padding: 6px 10px;
  font-family: monospace;
  font-size: 13px;
}

/* ==========================================================
   CONFIG PANEL / CVARS
========================================================== */
.config-panel {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.config-panel.hidden,
.hidden {
  display: none !important;
}

details {
  background: #131d31;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

summary {
  padding: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

summary::-webkit-details-marker {
  display: none;
}

.details-content {
  padding: 0 16px 16px 16px;
}

.file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.cvar-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 10px;
}

.cvar-group {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cvar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  align-items: baseline;
}

.cvar-name {
  font-family: monospace;
  font-weight: bold;
  color: var(--primary);
  font-size: 14px;
}

.cvar-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ==========================================================
   SWITCH (toggle "Force full deployment")
========================================================== */
.switch-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.switch-container:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.switch-wrapper {
  position: relative;
  width: 44px;
  height: 22px;
}

.switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 22px;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-input:checked + .switch-slider {
  background-color: var(--success);
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(22px);
}

.switch-input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
}

.switch-label {
  font-size: 14px;
  font-weight: 500;
}

/* ==========================================================
   FORM ELEMENTS
========================================================== */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  color: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  box-sizing: border-box;
  transition: var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input[type="file"] {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px dashed var(--border);
  color: white;
  cursor: pointer;
  transition: all 0.25s ease;
}

input[type="file"]:hover {
  border-color: var(--primary);
  background: #16213a;
}

input[type="radio"] {
  accent-color: var(--primary);
  transform: scale(1.1);
  margin-right: 8px;
}

.radio-group {
  display: flex;
  gap: 30px;
  margin: 20px 0;
}

.radio-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-main);
  transition: 0.2s;
}

.radio-group label:hover {
  color: white;
}

#existing-category,
#new-category {
  margin-top: 15px;
}

/* ==========================================================
   MAPS / OPTIONS / INSTALL (page upload)
========================================================== */
#maps-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.map-card {
  position: relative;
  overflow: hidden;
  transition: 0.25s;
  animation: fadeIn 0.3s ease;
}

.map-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.map-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--primary);
}

.map-card h4 {
  font-size: 20px;
  margin-bottom: 18px;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-card h4::before {
  content: "🗺️";
}

.map-card button {
  margin-right: 10px;
  margin-bottom: 15px;
}

.options-container {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-row {
  display: grid;
  grid-template-columns: 250px 1fr auto;
  gap: 12px;
  align-items: center;
  animation: fadeIn 0.25s ease;
}

.option-row:hover {
  transform: translateX(2px);
}

.option-row select,
.option-row input {
  width: 100%;
}

.btn-remove {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--danger);
  color: white;
  cursor: pointer;
  transition: 0.2s;
}

.btn-remove:hover {
  background: var(--danger-hover);
  transform: rotate(90deg);
}

#category-options {
  margin-top: 20px;
}

.map-options {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

#install-button {
  width: 100%;
  font-size: 18px;
  padding: 15px;
  transition: 0.25s;
}

#install-button:hover {
  animation: pulse 0.6s;
}

#install-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.install-result {
  animation: fadeIn 0.4s ease;
}

.install-summary {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 25px;
}

.install-success {
  border-left: 5px solid var(--success);
}

.install-error {
  border-left: 5px solid var(--danger);
}

.install-map {
  background: #111c31;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 15px;
  transition: 0.2s;
}

.install-map:hover {
  border-color: var(--success);
  transform: translateY(-2px);
}

.install-map h4 {
  color: var(--success);
  margin-bottom: 12px;
  font-size: 18px;
}

.install-map p {
  margin: 6px 0;
  color: var(--text-secondary);
}

.category-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
    padding: 12px 0;
}

.category-summary::-webkit-details-marker {
    display: none;
}

.section-divider {
    margin: 1.75rem 0;
    border-top: 1px solid var(--border);
    opacity: 0.6;
}

.search-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    flex: 1.6;
    max-width: 450px;
}

.filter-select {
    flex: 1;
    max-width: 240px;
}


.map-selector input {
    cursor: pointer;
}

#selected-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hidden-transition {
    transition:
        opacity .2s ease,
        transform .2s ease;
}

.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
}
.map-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.map-selector h3 {
    margin: 0;
}

.selected-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    cursor: pointer;
}

/* ==========================================================
   TOASTS
========================================================== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.toast {
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-card);
  color: white;
  padding: 15px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 14px;
  border-left: 5px solid var(--primary);
  transform: translateX(150%);
  opacity: 0;
  transition: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-left-color: var(--success);
}

/* alias : le code JS utilise tantôt "danger" tantôt "error" selon
   son origine (mods.js vs maps-upload.js) — on couvre les deux. */
.toast.danger,
.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.toast-message {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ==========================================================
   MISC COMPONENTS (badges, tags, status, progress, loader…)
========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: bold;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 30px;
  background: #24344d;
  color: #cbd5e1;
  font-size: 12px;
  margin: 2px;
}

.tag.primary {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.tag.success {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.tag.warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.tag.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status.online::before {
  background: var(--success);
}

.status.offline::before {
  background: var(--danger);
}

.status.warning::before {
  background: var(--warning);
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 60px;
  opacity: 0.35;
  margin-bottom: 15px;
}

.progress {
  width: 100%;
  height: 8px;
  background: #0f172a;
  border-radius: 50px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: 0.4s;
}

.loader {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

.loader-inline {
  width: 18px;
  height: 18px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9000;
  animation: fadeIn 0.25s;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(700px, 92%);
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 30px;
  animation: popup 0.25s ease;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.table th {
  background: #172334;
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table tbody tr {
  transition: 0.2s;
}

.table tbody tr:hover {
  background: #1d2b45;
}

.search {
  position: relative;
}

.search input {
  padding-left: 40px;
}

.search::before {
  content: "🔍";
  position: absolute;
  left: 14px;
  top: 6px;
  opacity: 0.6;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 110%;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeIn 0.15s;
}

.dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: white;
}

.dropdown-menu a:hover {
  background: #24344d;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 45px;
  text-align: center;
  cursor: pointer;
  transition: 0.25s;
  color: var(--text-muted);
  background: #111b2d;
}

.drop-zone:hover {
  border-color: var(--primary);
  background: #16233b;
}

.drop-zone.dragover {
  border-color: var(--success);
  background: #113327;
  transform: scale(1.02);
}

footer {
  margin-top: 50px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  opacity: 0.7;
}

/* ==========================================================================
   ZONE DE TÉLÉCHARGEMENT MODERNE (DROPZONE)
   ========================================================================== */
.dropzone {
    display: block;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

/* Effet au survol ou quand un fichier est traîné au-dessus */
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.04);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
    transition: var(--transition);
}

.dropzone:hover .dropzone-icon, .dropzone.dragover .dropzone-icon {
    transform: translateY(-4px);
}

.dropzone h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.dropzone p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.dropzone-link {
    color: var(--primary);
    font-weight: 600;
}

.dropzone-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 4px;
}

.dropzone.has-files {
    padding: 15px 10px;
    border-style: dashed;
    background: rgba(16, 185, 129, 0.03);
}

.dropzone-content-compact {
    animation: slideDown 0.2s ease-out;
}

/* ==========================================================
   UTILITIES
========================================================== */
.text-center {
  text-align: center;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-10 {
  gap: 10px;
}

.gap-20 {
  gap: 20px;
}

/* ==========================================================================
   NAVIGATION & HEADER STRUCTURE
   ========================================================================== */

.brand-link {
    color: var(--text-main) !important;
    text-decoration: none;
    transition: var(--transition);
}

.brand-link:hover {
    color: var(--primary) !important;
}

/* ==========================================================================
   COMPOSANT MODAL DE CONFIRMATION
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7); /* Slate 900 transparent */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
    animation: popup 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 15px 0 25px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================
   DASHBOARD MAPS — LOGIQUE DE GROUPEMENT PAR MAP
========================================================== */

/* Conteneur de la barre de recherche rapide */
.search-bar-container {
  margin-bottom: 20px;
  padding: 15px;
}

.search-bar-container .search {
  max-width: 400px;
}

/* Bloc d'entête d'une carte Map */
.map-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.map-block-title {
  margin: 0;
  color: var(--text-main);
  font-size: 1.3rem;
}

.map-category-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-category-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Menu déroulant de la catégorie locale */
.map-category-select {
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  font-weight: bold;
  cursor: pointer;
}

/* Grille des inputs de configuration d'une map */
.map-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  align-items: flex-end;
}

.map-config-field {
  display: flex;
  flex-direction: column;
}

.map-config-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.map-config-field select,
.map-config-field input {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease;
}

.map-config-field select:focus,
.map-config-field input:focus {
  border-color: var(--primary);
  outline: none;
}

.map-config-field.weight-field {
  max-width: 140px;
}

/* Zone et Boutons d'actions épurés */
.map-actions-wrapper {
  text-align: right;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

/* Bouton Retirer de la catégorie (Avertissement discret) */
.btn-map-action-remove {
  background: rgba(245, 158, 10, 0.08);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 10, 0.25);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn-map-action-remove:hover {
  background: rgba(245, 158, 10, 0.18);
  border-color: var(--warning);
}

/* Bouton Supprimer Partout (Danger destructif discret) */
.btn-map-action-delete-all {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn-map-action-delete-all:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

/* ==========================================================
   ANIMATIONS
========================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes popup {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================
   CATEGORY MANAGER PAGE
========================================================== */

/* Actions du header (Expand all / Collapse all / Save) */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Carte d'une catégorie (wrapper du <details> catégorie) */
.category-card {
  padding: 0 22px;
}

.category-card .category-details {
  border: none;
  background: transparent;
  margin-bottom: 0;
}

.category-card .category-details > summary {
  padding: 18px 0;
}

/* Compteur "X map(s)" à côté du nom de la catégorie */
.category-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 3px 10px;
  margin-left: 10px;
}

/* Zone d'options de la catégorie, à l'intérieur du <details> */
.category-options-container {
  padding-bottom: 10px;
}

.category-options-container .add-category-option {
  margin-bottom: 16px;
}

/* Titre cliquable d'une map (<summary> directement, pas de h4 ici
   contrairement à .map-card du formulaire d'upload) */
.map-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-title::before {
  content: "🗺️";
  font-size: 14px;
}

/* Cartes "map" imbriquées dans une catégorie : plus discrètes que
   .map-card de la page upload (pas de bordure latérale colorée). */
.category-card .map-card {
  background: #131d31;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  margin-top: 12px;
}

.category-card .map-card::before {
  content: none;
}

.category-card .map-card .add-map-option {
  margin-top: 12px;
  margin-bottom: 12px;
}

/* ==========================================================
   RESPONSIVE
========================================================== */
@media (max-width: 1100px) {
  .page {
    width: 96%;
  }
}

@media (max-width: 900px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .map-card button {
    width: 100%;
    margin-right: 0;
  }
}

@media (max-width: 650px) {
  .card {
    padding: 18px;
  }

  .btn {
    width: 100%;
  }

  .top-action {
    flex-direction: column;
    gap: 10px;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .toast {
    min-width: auto;
    width: 95vw;
  }
}