/**
 * OPFIELD v3 — CSS Back-office Admin
 * =====================================
 * Styles spécifiques à l'interface administrateur
 * Dépend de common.css
 */

/* ================================================================
   LAYOUT GÉNÉRAL ADMIN
   ================================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--border-default);
  height: var(--header-height);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--accent-green-d);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.857rem;
  color: #fff;
  letter-spacing: -0.05em;
}

.sidebar-logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-green);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-logo-text { opacity: 0; }

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-sm) 0;
}

.sidebar-section-label {
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  font-size: 0.643rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-section-label { opacity: 0; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0;
  transition: var(--transition);
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-active);
  color: var(--accent-green);
  border-left-color: var(--accent-green);
}

.sidebar-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.sidebar-item-label {
  font-size: 0.857rem;
  font-weight: 500;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-item-label { opacity: 0; }

.sidebar-item-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.643rem;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-item-badge { opacity: 0; }

/* Pied de sidebar */
.sidebar-footer {
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

/* Toggle collapse */
.sidebar-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ================================================================
   CONTENU PRINCIPAL
   ================================================================ */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-main.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ================================================================
   HEADER ADMIN
   ================================================================ */
.admin-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.admin-header-title {
  font-family: var(--font-mono);
  font-size: 0.857rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Badge plan */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.643rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-badge-free {
  background: rgba(139,148,158,0.15);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.plan-badge-premium {
  background: rgba(210,153,34,0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(210,153,34,0.4);
}

/* Avatar utilisateur */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent-green-d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.857rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.user-avatar:hover { opacity: 0.8; }

/* Statut op dans le header */
.op-status-pill {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.786rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  cursor: pointer;
  transition: var(--transition);
}

.op-status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.op-status-planned   { color: var(--status-planned);   border-color: var(--border-default);        background: rgba(139,148,158,0.1); }
.op-status-briefing  { color: var(--status-briefing);  border-color: rgba(63,185,80,0.4);          background: rgba(63,185,80,0.1); }
.op-status-combat    { color: var(--status-combat);    border-color: rgba(248,81,73,0.4);          background: rgba(248,81,73,0.1); }
.op-status-suspended { color: var(--status-suspended); border-color: rgba(210,153,34,0.4);         background: rgba(210,153,34,0.1); }
.op-status-closed    { color: var(--status-closed);    border-color: var(--border-muted);          background: var(--bg-card); }

.op-status-briefing .dot  { background: var(--status-briefing);  animation: pulse-green 2s infinite; }
.op-status-combat .dot    { background: var(--status-combat);    animation: pulse-red 1.5s infinite; }
.op-status-suspended .dot { background: var(--status-suspended); animation: pulse-orange 2s infinite; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(63,185,80,0); }
}

@keyframes pulse-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210,153,34,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(210,153,34,0); }
}

/* ================================================================
   CONTENU DE PAGE
   ================================================================ */
.admin-content {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
}

/* En-tête de page */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  gap: var(--space-md);
}

.page-header-info { flex: 1; }

.page-title {
  font-family: var(--font-mono);
  font-size: 1.14rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-xs);
}

.page-subtitle {
  font-size: 0.857rem;
  color: var(--text-secondary);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ================================================================
   LISTE DES OPÉRATIONS
   ================================================================ */
.ops-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.op-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.op-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent-green);
}

.op-item.active-op {
  border-color: var(--accent-green);
  background: var(--bg-active);
}

.op-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.op-item-info { flex: 1; min-width: 0; }

.op-item-title {
  font-weight: 600;
  font-size: 0.929rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-item-meta {
  font-size: 0.786rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.op-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ================================================================
   FORMULAIRE CRÉATION OP
   ================================================================ */
.op-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.op-form-full { grid-column: 1 / -1; }

/* ================================================================
   ACCORDÉON ÉQUIPES / GROUPES
   ================================================================ */
.team-accordion {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.team-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.team-header:hover { background: var(--bg-hover); }

.team-color-strip {
  width: 4px;
  height: 100%;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  align-self: stretch;
}

.team-header-info { flex: 1; min-width: 0; }

.team-name {
  font-weight: 600;
  font-size: 0.929rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.team-meta {
  font-size: 0.786rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.team-body {
  border-top: 1px solid var(--border-muted);
  background: var(--bg-secondary);
  display: none;
}

.team-body.open { display: block; }

/* Fréquence commandement inline */
.team-freq-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-tertiary);
}

.team-freq-label {
  font-size: 0.786rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.team-freq-value {
  font-family: var(--font-mono);
  font-size: 0.857rem;
  color: var(--accent-green);
  flex: 1;
}

/* Liste des groupes */
.groups-list {
  padding: var(--space-sm) var(--space-md);
}

.group-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

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

.group-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-status-dot.occupied { background: var(--accent-green); }
.group-status-dot.empty    { background: var(--border-default); }

.group-item-info { flex: 1; min-width: 0; }

.group-name {
  font-weight: 600;
  font-size: 0.857rem;
  font-family: var(--font-mono);
}

.group-pseudo {
  font-size: 0.786rem;
  color: var(--text-secondary);
}

.group-freq {
  font-family: var(--font-mono);
  font-size: 0.714rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.group-freq.conflict {
  color: var(--accent-red);
}

.group-item-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.group-item:hover .group-item-actions { opacity: 1; }

/* Boutons génération équipe/groupe */
.team-actions-bar {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-muted);
  background: var(--bg-tertiary);
}

/* ================================================================
   ÉDITEUR D'OBJECTIFS
   ================================================================ */
.objectives-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.objectives-filters {
  display: flex;
  gap: var(--space-sm);
  flex: 1;
}

.objectives-filters select {
  width: auto;
  min-width: 120px;
}

/* Vue liste / arborescente toggle */
.view-toggle {
  display: flex;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle-btn {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.857rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: var(--transition);
  border: none;
}

.view-toggle-btn.active {
  background: var(--accent-green-d);
  color: #fff;
}

/* Cards objectifs */
.objectives-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.objective-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.objective-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--status-color, var(--border-default));
  transition: background 0.3s ease;
}

.objective-card:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.objective-card.locked {
  opacity: 0.5;
}

.objective-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.objective-card-drag {
  color: var(--text-muted);
  cursor: grab;
  padding: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}

.objective-card-drag:active { cursor: grabbing; }

.objective-card-info { flex: 1; min-width: 0; }

.objective-card-title {
  font-weight: 600;
  font-size: 0.929rem;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.objective-card-title .lock-icon {
  font-size: 0.786rem;
  color: var(--text-muted);
}

.objective-type-icons {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.type-icon {
  font-size: 0.857rem;
  opacity: 0.7;
}

.objective-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.objective-card-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.objective-card:hover .objective-card-actions { opacity: 1; }

/* Groupes assignés sur la card */
.assigned-groups {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}

.assigned-group-chip {
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.643rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: var(--transition);
}

/* Qui a validé + quand */
.objective-card-validation {
  font-size: 0.714rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Compte à rebours sur la card */
.objective-timer {
  font-family: var(--font-mono);
  font-size: 0.857rem;
  font-weight: 700;
}

.objective-timer.normal  { color: var(--text-primary); }
.objective-timer.warning { color: var(--accent-orange); }
.objective-timer.danger  { color: var(--accent-red); animation: pulse-red 1s infinite; }

/* Arborescence parent-enfant */
.objective-tree {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.objective-tree-item {
  position: relative;
}

.objective-tree-children {
  padding-left: var(--space-xl);
  position: relative;
}

.objective-tree-children::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-default);
}

.objective-tree-connector {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 1px;
  background: var(--border-default);
  transform: translateY(-50%);
}

/* ================================================================
   DRAWER OBJECTIF — SECTIONS DYNAMIQUES
   ================================================================ */
.objective-types-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.objective-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.786rem;
  color: var(--text-secondary);
  text-align: center;
}

.objective-type-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.objective-type-btn.selected {
  background: var(--bg-active);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.objective-type-btn-icon { font-size: 1.4rem; }

/* Sections dynamiques dans le drawer */
.type-section {
  display: none;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-muted);
  animation: slideUp 0.2s ease;
}

.type-section.visible { display: block; }

/* Éditeur de statuts */
.statuses-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
}

.status-item-drag {
  color: var(--text-muted);
  cursor: grab;
}

.status-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid var(--border-default);
  transition: var(--transition);
}

.status-color-dot:hover { transform: scale(1.2); }

.status-item input[type="text"] {
  flex: 1;
  padding: 4px var(--space-sm);
  font-size: 0.857rem;
}

.status-item-flags {
  display: flex;
  gap: var(--space-xs);
}

.status-flag-btn {
  padding: 2px var(--space-xs);
  border-radius: 3px;
  font-size: 0.643rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid;
  transition: var(--transition);
  white-space: nowrap;
}

.flag-initial { border-color: var(--accent-blue);   color: var(--accent-blue); }
.flag-success { border-color: var(--accent-green);  color: var(--accent-green); }
.flag-fail    { border-color: var(--accent-red);    color: var(--accent-red); }

.flag-initial.active { background: var(--accent-blue);  color: #fff; }
.flag-success.active { background: var(--accent-green); color: #fff; }
.flag-fail.active    { background: var(--accent-red);   color: #fff; }

/* Palette de couleurs pour les statuts */
.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent-green); }

/* Checklist éditeur */
.checklist-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-muted);
}

.checklist-item-drag { color: var(--text-muted); cursor: grab; flex-shrink: 0; }
.checklist-item input { flex: 1; }

/* QR Code preview */
.qr-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.qr-preview img {
  width: 160px;
  height: 160px;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
}

/* ================================================================
   ÉDITEUR DE CARTE
   ================================================================ */
.map-editor-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.map-editor-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  flex-shrink: 0;
  z-index: 10;
}

.map-editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.map-editor-sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.map-editor-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.map-editor-tab {
  flex: 1;
  padding: var(--space-sm);
  text-align: center;
  font-size: 0.786rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.map-editor-tab.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
}

.map-editor-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.map-canvas {
  flex: 1;
  position: relative;
}

/* Barre d'outils carte */
.map-toolbar {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.map-tool-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}

.map-tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.map-tool-btn.active {
  background: var(--accent-green-d);
  color: #fff;
  border-color: var(--accent-green-d);
}

/* Coordonnées curseur */
.map-coords {
  position: absolute;
  bottom: var(--space-sm);
  left: var(--space-md);
  z-index: 5;
  background: rgba(13,17,23,0.85);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 3px var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.714rem;
  color: var(--accent-green);
  backdrop-filter: blur(4px);
}

/* Liste zones dans la sidebar carte */
.zone-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.zone-list-item:hover {
  background: var(--bg-hover);
}

.zone-list-item.highlighted {
  background: var(--bg-active);
  border-color: var(--accent-green);
}

.zone-color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ================================================================
   DASHBOARD SUPERVISION
   ================================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto 1fr;
  gap: var(--space-md);
  height: calc(100vh - var(--header-height) - 2 * var(--space-xl));
}

/* Thème briefing/combat */
body.theme-briefing {
  --accent-main: var(--accent-green);
  --bg-accent: rgba(63,185,80,0.05);
}

body.theme-combat {
  --accent-main: var(--accent-red);
  --bg-accent: rgba(248,81,73,0.05);
}

.dashboard-map-container {
  grid-row: 1 / 3;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-default);
}

.dashboard-map-container.fullscreen {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  border-radius: 0;
}

/* Panneau droit dashboard */
.dashboard-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height) - 2 * var(--space-xl));
}

/* Chrono + heure */
.dashboard-chrono {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
}

.chrono-elapsed {
  font-size: 1.14rem;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 0.1em;
}

.chrono-time {
  font-size: 0.857rem;
  color: var(--text-secondary);
}

/* Météo */
.weather-widget {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.857rem;
}

.weather-icon { font-size: 1.4rem; }
.weather-temp { font-weight: 700; font-size: 1rem; }
.weather-desc { color: var(--text-secondary); font-size: 0.786rem; }

/* Scores équipes (panneau dépliable) */
.scores-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.scores-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  font-size: 0.857rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-muted);
}

.score-team-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
}

.score-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.score-value {
  font-family: var(--font-mono);
  font-size: 0.857rem;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

/* Tableau joueurs connectés */
.players-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

.players-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-muted);
}

/* Panneau messages bidirectionnel */
.messages-panel {
  position: fixed;
  right: 0;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-default);
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.messages-panel.open { transform: translateX(0); }

.messages-panel-header {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.messages-convs {
  flex: 1;
  overflow-y: auto;
}

.message-conv-item {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-muted);
  cursor: pointer;
  transition: var(--transition);
}

.message-conv-item:hover { background: var(--bg-hover); }
.message-conv-item.active { background: var(--bg-active); }

.message-conv-unread {
  width: 8px;
  height: 8px;
  background: var(--accent-blue);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Messages individuels */
.message-bubble {
  max-width: 85%;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  font-size: 0.857rem;
  margin-bottom: var(--space-xs);
}

.message-bubble.from-admin {
  background: var(--accent-green-d);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-bubble.from-player {
  background: var(--bg-hover);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Prochain événement scénarisé */
.next-event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.857rem;
}

/* Alertes SOS / périmètre */
.alert-bar {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  z-index: 35;
  padding: var(--space-sm) var(--space-lg);
  background: rgba(248,81,73,0.95);
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.857rem;
  letter-spacing: 0.05em;
  transform: translateY(-100%);
  transition: transform 0.2s ease;
  cursor: pointer;
}

.alert-bar.active { transform: translateY(0); }

/* ================================================================
   PAGE PROFIL / PARAMÈTRES
   ================================================================ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  max-width: 860px;
}

.plan-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.plan-card {
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: var(--transition);
}

.plan-card.premium-card {
  border-color: var(--accent-orange);
  background: linear-gradient(135deg, var(--bg-card), rgba(210,153,34,0.05));
}

.plan-price {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  margin: var(--space-sm) 0;
}

.plan-price-period {
  font-size: 0.857rem;
  color: var(--text-secondary);
}

.plan-feature-list {
  list-style: none;
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.plan-feature-list li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.857rem;
  color: var(--text-secondary);
}

.plan-feature-list li.available { color: var(--text-primary); }
.plan-feature-list li::before  { content: '✓'; color: var(--accent-green); font-weight: 700; }
.plan-feature-list li.unavailable::before { content: '✗'; color: var(--text-muted); }

/* ================================================================
   PAGE DE CONNEXION ADMIN
   ================================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Grille tactique en arrière-plan */
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(63,185,80,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63,185,80,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-logo-title {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.auth-logo-sub {
  font-family: var(--font-mono);
  font-size: 0.714rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.786rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

/* ================================================================
   SUPER ADMIN
   ================================================================ */
.superadmin-banner {
  background: linear-gradient(90deg, rgba(137,87,229,0.15), rgba(137,87,229,0.05));
  border: 1px solid rgba(137,87,229,0.3);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.857rem;
  color: var(--accent-purple);
  font-family: var(--font-mono);
  margin-bottom: var(--space-md);
}

/* Tableau comptes utilisateurs */
.users-table .user-row-inactive td {
  opacity: 0.5;
}

.users-table .user-row-inactive .inactive-warning {
  color: var(--accent-orange);
  font-size: 0.786rem;
}

/* ================================================================
   RESPONSIVE ADMIN
   ================================================================ */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-map-container {
    grid-row: auto;
    height: 400px;
  }

  .op-form-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid,
  .plan-comparison-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-content {
    padding: var(--space-md);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .messages-panel {
    width: 100%;
  }
}

/* ================================================================
   DRAWERS
   ================================================================ */
.drawer {
  position: fixed;
  top: 0;
  right: -520px;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-default);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.drawer.open {
  right: 0;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  display: none;
}

.drawer-overlay.open {
  display: block;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.drawer-title {
  font-family: var(--font-mono);
  font-size: 0.857rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-green);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

/* ================================================================
   MODALES
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 0.857rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

/* ================================================================
   MAP EDITOR
   ================================================================ */
.map-editor-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 300;
  display: flex;
  flex-direction: column;
}

.map-editor-modal.hidden { display: none; }

.map-editor-header {
  height: 48px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.map-editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.map-editor-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-editor-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.map-editor-tab {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  font-size: 0.786rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.map-editor-tab.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
}

.map-editor-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.map-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.map-toolbar {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-md);
}

.map-tool-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.857rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  transition: var(--transition);
}

.map-tool-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.map-tool-btn.active { background: var(--bg-active); color: var(--accent-green); }

.map-coords {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.714rem;
  color: var(--text-secondary);
  background: rgba(13,17,23,0.8);
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
}

/* ================================================================
   MESSAGES PANEL
   ================================================================ */
.messages-panel {
  position: fixed;
  right: 0;
  top: var(--header-height, 56px);
  height: calc(100vh - var(--header-height, 56px));
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-default);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}

.messages-panel.open { transform: translateX(0); }

.messages-panel-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.messages-convs {
  flex: 1;
  overflow-y: auto;
}

.messages-conv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-muted);
  cursor: pointer;
  transition: var(--transition);
}

.messages-conv-item:hover { background: var(--bg-hover); }

/* ================================================================
   ALERT BAR
   ================================================================ */
.alert-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(248, 81, 73, 0.15);
  border-bottom: 1px solid rgba(248, 81, 73, 0.4);
  color: var(--accent-red);
  font-size: 0.857rem;
  flex-shrink: 0;
  cursor: pointer;
}

.alert-bar.hidden { display: none; }
