/* ─── PAGE CARTE D'INFRASTRUCTURE ─── */

body.infra-map-page {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.infra-layout {
  display: flex;
  height: calc(100vh - 65px);
  margin-top: 65px;
  overflow: hidden;
}

/* ─── SIDEBAR ─── */
.im-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: 4px 0 20px rgba(0,0,0,0.4);
}

.im-sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.im-sidebar-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  background: linear-gradient(135deg, #4facfe 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.im-sidebar-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.25rem;
}

.im-sidebar-nav {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.im-sidebar-nav::-webkit-scrollbar { width: 4px; }
.im-sidebar-nav::-webkit-scrollbar-track { background: var(--bg); }
.im-sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.im-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.25rem 0.75rem 0.5rem;
}

.im-reset-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 0.75rem;
}
.im-reset-btn:hover { background: var(--surface-hover); color: var(--text); }
.im-reset-btn svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; }

.im-ai-btn {
  width: 100%;
  padding: 0.5rem 1rem;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #a5b4fc;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 1rem;
}
.im-ai-btn:hover { background: rgba(99,102,241,0.2); }

.im-vm-btn {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.im-vm-btn:hover { background: var(--surface-hover); border-color: var(--border); }

.im-vm-btn-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.im-vm-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text);
  transition: color 0.2s;
}
.im-vm-btn:hover .im-vm-name { color: var(--accent); }

.im-vm-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  background: var(--bg);
  color: var(--accent);
  border-radius: 4px;
}

.im-vm-meta {
  display: flex;
  justify-content: space-between;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--muted);
}

.im-sidebar-footer {
  padding: 0.75rem 1.5rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ─── ZONE DE CARTE ─── */
.im-main {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #090c14;
  background-image: radial-gradient(rgba(30,34,48,0.9) 1px, transparent 1px);
  background-size: 40px 40px;
}

.im-map-label {
  position: absolute;
  top: 1.5rem;
  left: 1.75rem;
  z-index: 10;
  pointer-events: none;
}
.im-map-label h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem;
  color: var(--text);
  font-weight: 400;
}
.im-map-label p {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}

#infra-svg {
  cursor: grab;
  user-select: none;
  width: 100%;
  height: 100%;
}
#infra-svg:active { cursor: grabbing; }

.node { transition: opacity 0.3s ease; cursor: pointer; }
.node:hover circle { filter: drop-shadow(0 0 12px rgba(59,130,246,0.5)); }

.connection-line {
  stroke: #1a1f2e;
  stroke-width: 1.5;
  stroke-dasharray: 4;
  animation: im-dash 30s linear infinite;
}
@keyframes im-dash { to { stroke-dashoffset: -1000; } }

/* ─── CONTRÔLES ZOOM ─── */
.im-zoom-controls {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 30;
}
.im-zoom-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.im-zoom-btn:hover { background: var(--surface-hover); color: var(--text); }
.im-zoom-btn svg { width: 18px; height: 18px; stroke: currentColor; }

/* ─── STATUS DOT ─── */
.status-dot { animation: im-pulse 2s infinite; }
@keyframes im-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ─── TOOLTIP ─── */
.im-tooltip {
  position: fixed;
  max-width: 270px;
  background: rgba(11,13,17,0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(71,85,105,0.35);
  border-radius: 14px;
  padding: 1.1rem;
  z-index: 200;
  box-shadow: 0 20px 50px rgba(0,0,0,0.7);
  pointer-events: auto;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(8px);
}
.im-tooltip.visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.tt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.tt-name {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}
.tt-os {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}
.tt-status-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16,185,129,0.6);
  margin-top: 4px;
}

.tt-ip-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.9rem;
}
.tt-ip-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.tt-ip {
  font-family: 'DM Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.tt-actions {
  display: flex;
  gap: 0.4rem;
}
.tt-btn-connect {
  flex: 1;
  padding: 0.55rem 0.85rem;
  background: var(--blue);
  border: none;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.tt-btn-connect:hover { background: #2563eb; }
.tt-btn-connect svg { width: 14px; height: 14px; stroke: currentColor; }

.tt-btn-ai {
  padding: 0.55rem 0.7rem;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  color: #a5b4fc;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}
.tt-btn-ai:hover { background: rgba(99,102,241,0.2); }

/* ─── PANNEAU IA ─── */
.im-ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 360px;
  background: rgba(15,32,64,0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  z-index: 150;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,0.6);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}
.im-ai-panel.open { transform: translateX(0); }

.im-ai-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.im-ai-panel-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.im-ai-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.im-ai-close:hover { color: var(--text); }

.im-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.im-ai-messages::-webkit-scrollbar { width: 4px; }
.im-ai-messages::-webkit-scrollbar-track { background: var(--bg); }
.im-ai-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.im-ai-msg {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
}
.im-ai-msg.user {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  margin-left: 1.5rem;
}
.im-ai-msg.ai {
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.15);
  margin-right: 1.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.77rem;
}
.im-ai-msg.loading p { animation: im-pulse 1.5s infinite; }

.im-ai-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.im-ai-input-wrap { position: relative; }
.im-ai-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 2.8rem 0.7rem 1rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.im-ai-input:focus { border-color: var(--accent); }
.im-ai-input::placeholder { color: var(--muted); }
.im-ai-send {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a5b4fc;
  cursor: pointer;
  padding: 0.2rem;
  transition: color 0.2s;
  display: flex;
}
.im-ai-send:hover { color: var(--accent); }
.im-ai-send svg { width: 20px; height: 20px; stroke: currentColor; }

/* ─── ZOOM INDICATOR ─── */
#im-zoom-indicator {
  font-family: 'DM Mono', monospace;
}
