/* ==========================================================================
   BIDABOT — KEEPER-PROTECT MONOCHROME DESIGN SYSTEM
   Direction : Dark Sleek Monochrome, Crisp Typography, Minimalist Switches
   ========================================================================== */

:root {
  /* Fond & Surfaces (Dark Monochrome) */
  --bg: #090a0f;
  --bg-sidebar: #0e1017;
  --surface: #13151f;
  --surface-hover: #1a1e2b;
  --surface-active: #222738;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-focus: #ffffff;
  
  /* Typographie */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Accents Monochrome & Minimalistes */
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-gray: #334155;

  /* Polices */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Géométrie */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --max-w: 1320px;
}

/* ── Reset Global ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typographie ── */
h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.015em;
}

p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 120ms ease;
}

a:hover {
  color: #ffffff;
}

code, pre, .mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* ── App Layout Style Keeper (Sidebar + Contenu) ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 48px);
  width: 100%;
}

.app-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 16px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  padding: 0 4px;
}

.sidebar-server-selector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 150ms ease;
}

.sidebar-server-selector:hover {
  background: var(--surface-hover);
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 28px 6px 10px;
  font-size: 11.5px;
  color: var(--text-main);
  outline: none;
}

.sidebar-search input:focus {
  border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-search .shortcut {
  position: absolute;
  right: 8px;
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
}

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 6px 8px 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms ease;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.sidebar-item.active {
  background: var(--surface);
  color: #ffffff;
  font-weight: 500;
  border-left: 2px solid var(--accent-green);
}

.sidebar-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

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

.app-main-content {
  flex: 1;
  background: var(--bg);
  overflow-y: auto;
  padding: 24px 32px;
}

/* ── Keeper-Protect Layout à 2 Colonnes ── */
.protections-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.protections-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.protections-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  align-items: center;
}

.filter-pill {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms ease;
}

.filter-pill:hover, .filter-pill.active {
  background: var(--surface-hover);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.protections-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

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

.protections-list-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.protection-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.protection-group-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.protection-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 120ms ease;
  user-select: none;
}

.protection-item-row:last-child {
  border-bottom: none;
}

.protection-item-row:hover {
  background: var(--surface-hover);
}

.protection-item-row.selected {
  background: var(--surface-active);
  border-left: 3px solid var(--accent-green);
}

.protection-item-name {
  font-size: 13px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.protection-item-name .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}

.protection-item-row.active .protection-item-name .dot {
  background: var(--accent-green);
}

/* ── Colonne Détail de la Protection Sélectionnée ── */
.protection-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.detail-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.detail-recorded-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--accent-green);
  margin-top: 4px;
}

.detail-explanation-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.detail-explanation-box strong {
  color: #ffffff;
}

.detail-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 16px;
}

.detail-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.step-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
}

.step-subtitle {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-left: 4px;
}

/* ── Switch Minimaliste Style Keeper ── */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #242838;
  transition: .15s ease;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .15s ease;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-green);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* ── Boutons de Taux de Confiance ── */
.conf-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-conf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 120ms ease;
}

.btn-conf:hover {
  background: var(--surface-hover);
  color: #ffffff;
}

.btn-conf-100 {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}
.btn-conf-100:hover, .btn-conf-100.active {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.btn-conf-70 {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fde68a;
  background: rgba(245, 158, 11, 0.08);
}
.btn-conf-70:hover, .btn-conf-70.active {
  background: #f59e0b;
  color: #000000;
  border-color: #f59e0b;
}

.btn-conf-30 {
  border-color: rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.06);
}
.btn-conf-30:hover, .btn-conf-30.active {
  background: #475569;
  color: #ffffff;
  border-color: #475569;
}

.btn-conf-0 {
  border-color: rgba(16, 185, 129, 0.4);
  color: #86efac;
  background: rgba(16, 185, 129, 0.08);
}
.btn-conf-0:hover, .btn-conf-0.active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Boutons Universels ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-primary {
  background: #ffffff;
  color: #090a0f;
  font-weight: 600;
  border-color: #ffffff;
}

.btn-primary:hover {
  background: #e2e8f0;
  color: #090a0f;
}

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

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.btn-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.2);
  transform: translateY(-1px);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.5);
}

.btn-sm {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* ── Conteneur Principal ── */
.dash-main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ── Cartes Glassmorphism ── */
.card {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.card:hover {
  border-color: var(--border-subtle);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Grille & Stats KPI ── */
.grid {
  display: grid;
  gap: 14px;
}

.stat {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 180ms ease;
}

.stat:hover {
  border-color: var(--border-subtle);
  transform: translateY(-1px);
}

.stat .lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.stat .val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 6px;
}

.val.ok {
  color: var(--cyber-emerald);
}

.val.warn {
  color: var(--cyber-amber);
}

.val.bad {
  color: var(--cyber-crimson);
}

/* ── Badges de Statut (Pills) ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-protected {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* ── Navigation par Onglets ── */
.dash-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dash-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--cyber-cyan);
  border-bottom-color: var(--cyber-cyan);
  background: rgba(6, 182, 212, 0.04);
}

/* ── Section Graphiques Analytics ── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
  width: 100%;
}

/* ── Simulateur Red Team Pentest ── */
.redteam-panel {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(14, 18, 28, 0.85) 0%, rgba(18, 12, 28, 0.85) 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.redteam-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.redteam-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 180ms ease;
}

.redteam-btn:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

.redteam-btn-title {
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.redteam-btn-desc {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Tableaux de Données ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

/* ── Live SOC Matrix Terminal ── */
.soc-filter {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 4px 10px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 120ms ease;
}

.soc-filter.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
}

.soc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 11.5px;
  transition: background 120ms ease;
}

.soc-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ── Toasts de Notification Flottants ── */
.soc-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100% - 48px);
}

.soc-toast {
  pointer-events: auto;
  background: rgba(14, 18, 27, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slide-in-toast 250ms cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 200ms ease;
}

.soc-toast.critical {
  border-left: 3px solid var(--cyber-crimson);
}

.soc-toast.warning {
  border-left: 3px solid var(--cyber-amber);
}

.soc-toast.success {
  border-left: 3px solid var(--cyber-emerald);
}

.soc-toast.info {
  border-left: 3px solid var(--cyber-cyan);
}

/* ── Animations ── */
@keyframes pulse-emerald {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

@keyframes slide-in-toast {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Pied de Page ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  background: var(--bg);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

/* ── Responsive Mobile ── */
@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .navbar {
    padding: 12px 16px;
  }
  .dash-main {
    padding: 16px 12px 40px;
  }
  .grid {
    grid-template-columns: 1fr !important;
  }
}
