:root {
  --bg: #080c14;
  --bg2: #0d1420;
  --bg3: #111827;
  --border: rgba(99, 179, 237, 0.12);
  --border-hover: rgba(99, 179, 237, 0.3);
  --accent: #3b82f6;
  --accent2: #06b6d4;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --text: #f0f6ff;
  --text-sub: #7a93b5;
  --text-muted: #4a6080;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --card-bg: rgba(13, 20, 32, 0.85);
  --radius: 16px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grid background */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
  pointer-events: none;
}

body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(8, 12, 20, 0.8);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e3a5f, #0d2137);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo-ai {
  color: #60a5fa;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-sub);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.badge-dot.ok { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse-dot 2s infinite; }
.badge-dot.error { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Main */
.main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 72px 0 48px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}

.gradient-text {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-sub);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto;
}

/* Upload Section */
.upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.upload-card {
  width: 100%;
  max-width: 680px;
  background: var(--card-bg);
  border: 2px dashed var(--border);
  border-radius: 24px;
  transition: all 0.3s ease;
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.upload-card:hover,
.upload-card.drag-over {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 40px var(--accent-glow), inset 0 0 40px rgba(59, 130, 246, 0.03);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 40px;
  cursor: pointer;
}

.upload-icon-wrap {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  margin-bottom: 8px;
}

.upload-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.upload-sub {
  font-size: 14px;
  color: var(--text-sub);
}

.upload-btn-link {
  background: none;
  border: none;
  color: #60a5fa;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload-formats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

.format-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
}

.upload-limit {
  font-size: 12px;
  color: var(--text-muted);
}

/* Preview */
.upload-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
}

.preview-img-wrap {
  width: 220px;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-pdf-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #60a5fa;
  padding: 16px;
  text-align: center;
}

.preview-pdf-icon span {
  font-size: 12px;
  color: var(--text-sub);
  word-break: break-all;
}

.preview-name {
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 500;
}

.preview-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-analyze {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
}

.btn-analyze:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.45);
}

.btn-analyze:active { transform: translateY(0); }

.btn-reset {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* Use cases */
.use-cases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 680px;
}

.use-case-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s;
}

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

.use-case-icon { font-size: 24px; margin-bottom: 8px; }
.use-case-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.use-case-card p { font-size: 12px; color: var(--text-sub); line-height: 1.5; }

/* Loading */
.loading-section {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.loading-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  backdrop-filter: blur(20px);
  min-width: 360px;
}

.loading-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-sub);
}

.loading-animation {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-ring {
  position: absolute;
  border: 1.5px solid rgba(59, 130, 246, 0.5);
  border-radius: 50%;
  animation: radar 2s ease-out infinite;
}

.radar-ring { width: 80px; height: 80px; }
.radar-ring.r2 { width: 80px; height: 80px; animation-delay: 0.6s; }
.radar-ring.r3 { width: 80px; height: 80px; animation-delay: 1.2s; }

@keyframes radar {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.radar-dot {
  width: 14px;
  height: 14px;
  background: #3b82f6;
  border-radius: 50%;
  box-shadow: 0 0 15px #3b82f6;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.3s;
}

.step.active { color: var(--text); }
.step.done { color: var(--success); }

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s;
  flex-shrink: 0;
}

.step.active .step-dot {
  background: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
  animation: pulse-dot 1s infinite;
}

.step.done .step-dot { background: var(--success); }

/* Results */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.results-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.results-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.results-title-row h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.confidence-badge {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.confidence-badge.haute {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.confidence-badge.moyenne {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.confidence-badge.faible {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.summary-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(10px);
  min-width: 120px;
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  color: #60a5fa;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 500;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border);
  width: fit-content;
}

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
}

/* Table */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.inv-table th {
  background: rgba(59, 130, 246, 0.06);
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.inv-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(99, 179, 237, 0.06);
  color: var(--text);
  vertical-align: middle;
}

.inv-table tr:last-child td { border-bottom: none; }

.inv-table tr:hover td { background: rgba(59, 130, 246, 0.04); }

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.type-switch { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.type-routeur { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.type-serveur { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.type-firewall { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.type-patch_panel { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.type-ups { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.type-autre { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }
.type-pdu { background: rgba(20, 184, 166, 0.15); color: #14b8a6; }
.type-ap_wifi { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.type-nas { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

.state-actif { color: var(--success); }
.state-inactif { color: var(--danger); }
.state-inconnu { color: var(--text-muted); }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #94a3b8; }

/* Topology */
.topology-view {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  min-height: 300px;
  backdrop-filter: blur(10px);
}

.topo-node {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 12px;
}

.topo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid var(--border);
}

.topo-label {
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
  max-width: 80px;
}

.topo-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.topo-group {
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topo-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.topo-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Recommendations */
.reco-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reco-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid #3b82f6;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.reco-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Export Bar */
.export-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
}

.export-label {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
  white-space: nowrap;
}

.export-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
}

.export-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: rgba(59, 130, 246, 0.08);
}

.export-btn-cisco {
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.2) !important;
}

.export-btn-cisco:hover {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

.btn-new-scan {
  margin-left: auto;
  background: linear-gradient(135deg, #1e3a5f, #0d2137);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #60a5fa;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-new-scan:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* Notes cell */
.notes-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-sub);
  font-size: 12px;
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

.footer strong { color: var(--text-sub); }

/* Empty state */
.empty-state {
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p { font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .use-cases { grid-template-columns: 1fr; }
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 15px; }
  .tabs { flex-wrap: wrap; }
  .tab { font-size: 12px; padding: 8px 12px; }
  .export-bar { flex-direction: column; align-items: flex-start; }
  .btn-new-scan { margin-left: 0; }
  .loading-card { min-width: unset; padding: 32px 24px; }
}

/* Transitions */
.results-section,
.loading-section,
.upload-section {
  transition: opacity 0.3s ease;
}
