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

:root {
  --bg-primary:   #0d1117;
  --bg-card:      #161b22;
  --bg-card-2:    #1c2128;
  --border:       #30363d;
  --border-light: #21262d;
  --text-primary: #e6edf3;
  --text-muted:   #7d8590;
  --text-dim:     #484f58;

  --green:        #22c55e;
  --yellow:       #eab308;
  --red:          #ef4444;
  --blue:         #3b82f6;
  --cyan:         #06b6d4;
  --purple:       #a855f7;
  --orange:       #f97316;

  --green-bg:     rgba(34,197,94,0.12);
  --yellow-bg:    rgba(234,179,8,0.12);
  --red-bg:       rgba(239,68,68,0.12);
  --blue-bg:      rgba(59,130,246,0.12);
  --cyan-bg:      rgba(6,182,212,0.12);
  --purple-bg:    rgba(168,85,247,0.12);

  --radius:    8px;
  --radius-sm: 4px;
  --mono:      'SF Mono', 'Fira Code', 'Fira Mono', 'Cascadia Code', 'Consolas', monospace;
}

html { font-size: 14px; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ── Header sticky ──────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.header-left h1 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.header-left .subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Stat badges (Total / Problèmes) ────────────────────────── */
.stat-badges {
  display: flex;
  gap: 8px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* Couleur badge selon max_severity : warn (amber), crit (rouge), ok (neutre) */
.stat-badge--warn { border-color: rgba(234,179,8,0.50); }
.stat-badge--warn .stat-num { color: var(--yellow); }

.stat-badge--crit { border-color: rgba(239,68,68,0.50); }
.stat-badge--crit .stat-num { color: var(--red); }

.stat-badge--ok { border-color: var(--border); }
.stat-badge--ok .stat-num { color: var(--text-muted); }

/* v1.7 — badge compteur global cliquable */
.stat-badge--clickable {
  cursor: pointer;
  background: none;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.stat-badge--clickable:hover {
  background: rgba(239,68,68,0.10);
  border-color: rgba(239,68,68,0.6);
}

.stat-num {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text-primary);
}

.stat-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
}

/* ── Timestamp ─────────────────────────────────────────────── */
.timestamp-block { text-align: right; }

.timestamp-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timestamp-value {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Refresh indicator ─────────────────────────────────────── */
.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.refresh-dot.pulsing {
  animation: pulse 2s ease-in-out infinite;
}

.refresh-dot.loading {
  background: var(--yellow);
  animation: pulse 0.6s ease-in-out infinite;
}

.refresh-dot.error {
  background: var(--red);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Bouton refresh ─────────────────────────────────────────── */
.btn-refresh {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-refresh:hover {
  border-color: #444c56;
  color: var(--text-primary);
}

/* ── Error banner ───────────────────────────────────────────── */
.error-banner {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--red);
  font-size: 0.85rem;
}

.error-banner.visible { display: flex; }

.error-icon {
  width: 18px;
  height: 18px;
  border: 2px solid var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  flex-shrink: 0;
}

.btn-retry {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.5);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.75rem;
  padding: 3px 10px;
  cursor: pointer;
}

.btn-retry:hover { background: var(--red-bg); }

/* ── Filtres rapides ────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: #444c56;
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--bg-card-2);
  border-color: #444c56;
  color: var(--text-primary);
}

.filter-btn--warn.active {
  background: var(--red-bg);
  border-color: rgba(239,68,68,0.4);
  color: var(--red);
}

/* ── Skeleton grid ──────────────────────────────────────────── */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 180px;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── Server grid ────────────────────────────────────────────── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* ── Host card ──────────────────────────────────────────────── */
.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
}

.server-card:hover { border-color: #444c56; }

/* Barre de statut verticale (4px gauche) */
.card-status-bar {
  width: 4px;
  background: var(--green);
  flex-shrink: 0;
  border-radius: 0;
}

.card-inner {
  display: flex;
  flex: 1;
}

.card-body {
  flex: 1;
  padding: 14px 14px 12px;
  min-width: 0;
}

/* Sévérité */
.server-card.sev-ok    .card-status-bar { background: var(--green); }
.server-card.sev-warn  .card-status-bar { background: var(--yellow); }
.server-card.sev-crit  .card-status-bar { background: var(--red); }

/* ── Card header ────────────────────────────────────────────── */
.server-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.server-title {
  min-width: 0;
}

.server-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-hostname {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Type badge ─────────────────────────────────────────────── */
.type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

.type-pve {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.3);
}

.type-linux {
  background: rgba(249,115,22,0.12);
  color: var(--orange);
  border: 1px solid rgba(249,115,22,0.3);
}

.type-windows {
  background: var(--cyan-bg);
  color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.3);
}

.type-switch {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid rgba(168,85,247,0.3);
}

.type-default {
  background: rgba(120,120,130,0.12);
  color: var(--text-muted);
  border: 1px solid rgba(120,120,130,0.25);
}

/* ── Card badges (type + agent-down groupés) ────────────────── */
.card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Badge Agent down ───────────────────────────────────────── */
.badge-agent-down {
  display: inline-flex;
  align-items: center;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 2px 6px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.45);
  cursor: default;
}

/* ── Metric row ─────────────────────────────────────────────── */
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.metric-label {
  font-size: 0.70rem;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-primary);
}

.metric-value.null  { color: var(--text-dim); }
.metric-value.green { color: var(--green); }
.metric-value.yellow { color: var(--yellow); }
.metric-value.red   { color: var(--red); }

/* ── Progress group ─────────────────────────────────────────── */
.progress-group {
  margin-bottom: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.progress-label {
  font-size: 0.70rem;
  color: var(--text-muted);
}

.progress-pct {
  font-family: var(--mono);
  font-size: 0.70rem;
}

.progress-pct.green  { color: var(--green); }
.progress-pct.yellow { color: var(--yellow); }
.progress-pct.red    { color: var(--red); }
.progress-pct.null   { color: var(--text-dim); }

.progress-track {
  height: 5px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-fill.green  { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red    { background: var(--red); }

/* ── Card footer ────────────────────────────────────────────── */
.card-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-uptime {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.problems-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.problems-pill:hover {
  background: rgba(239,68,68,0.22);
  border-color: rgba(239,68,68,0.55);
}

.problems-pill .pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

.problems-pill.warn {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: rgba(234,179,8,0.3);
}

.problems-pill.warn:hover {
  background: rgba(234,179,8,0.22);
  border-color: rgba(234,179,8,0.55);
}

.problems-pill.warn .pill-dot { background: var(--yellow); }

/* ── Modal overlay ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Modal panel ────────────────────────────────────────────── */
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.18s ease;
  overflow: hidden;
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

/* ── Modal header ───────────────────────────────────────────── */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.modal-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.modal-host-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.modal-close:hover {
  border-color: #444c56;
  color: var(--text-primary);
}

/* ── Modal liste problèmes ──────────────────────────────────── */
.modal-list {
  list-style: none;
  overflow-y: auto;
  padding: 10px 0;
}

.modal-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s;
}

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

.modal-item:hover { background: var(--bg-card-2); }

.modal-sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.60rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.modal-sev-badge.sev-2 {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid rgba(234,179,8,0.3);
}

.modal-sev-badge.sev-3 {
  background: rgba(249,115,22,0.12);
  color: var(--orange);
  border: 1px solid rgba(249,115,22,0.3);
}

.modal-sev-badge.sev-4 {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
}

.modal-sev-badge.sev-5 {
  background: rgba(239,68,68,0.25);
  color: #ff6b6b;
  border: 1px solid rgba(239,68,68,0.6);
}

.modal-item-body {
  flex: 1;
  min-width: 0;
}

.modal-item-name {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.modal-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.modal-item-age {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.modal-item-ack {
  font-size: 0.60rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* v1.7 — Modal globale (max-width élargi pour afficher hostname) */
#modal-global { max-width: 680px; }

.modal-item-host {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 0.9rem;
}

/* ── Sélecteur client ───────────────────────────────────────── */
.client-selector-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.client-selector-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.client-selector {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.73rem;
  font-family: inherit;
  padding: 4px 26px 4px 10px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  /* Chevron SVG inline */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237d8590' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
  max-width: 180px;
}

.client-selector:hover,
.client-selector:focus {
  border-color: #444c56;
}

.client-selector option {
  background: var(--bg-card-2);
  color: var(--text-primary);
}

/* ── Header user (badge + logout) ──────────────────────────── */
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  font-size: 0.73rem;
  max-width: 240px;
  overflow: hidden;
}

.user-badge__name {
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge__scopes {
  font-size: 0.62rem;
  color: var(--text-muted);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 1px solid var(--border);
  padding-left: 6px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn-logout:hover {
  border-color: rgba(239,68,68,0.5);
  color: var(--red);
  background: var(--red-bg);
}

/* ── Page login ─────────────────────────────────────────────── */

/* Corps plein écran */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Arrière-plan avec grille géométrique */
.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.7;
}

/* Points de lumière ambiante */
.login-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  pointer-events: none;
}

.login-bg-glow--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #22c55e, transparent 70%);
  top: -150px;
  right: -100px;
  animation: glow-drift 12s ease-in-out infinite alternate;
}

.login-bg-glow--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  bottom: -100px;
  left: -80px;
  animation: glow-drift 16s ease-in-out infinite alternate-reverse;
}

@keyframes glow-drift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(30px, 20px); }
}

/* Carte de connexion */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 0 28px;
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.06),
    0 8px 32px rgba(0,0,0,0.5),
    0 2px 8px rgba(0,0,0,0.3);
  margin: 16px;
  overflow: hidden;
  /* Animation d'entrée */
  animation: card-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Liseré gradient en haut de la carte — détail distinctif */
.login-card-accent {
  height: 3px;
  background: linear-gradient(90deg, #22c55e 0%, #3b82f6 50%, #22c55e 100%);
  background-size: 200% 100%;
  animation: accent-slide 4s linear infinite;
}

@keyframes accent-slide {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* Animation shake sur erreur */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.login-card.shake {
  animation: shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Header carte */
.login-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 28px 20px;
}

.login-logo {
  flex-shrink: 0;
  opacity: 0.9;
}

.login-header-text {
  min-width: 0;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login-title-accent {
  color: var(--green);
  font-family: 'IBM Plex Mono', var(--mono);
}

.login-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Formulaire */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 28px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.login-label {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: 'IBM Plex Mono', var(--mono);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.login-input::placeholder {
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', var(--mono);
}

/* Glow sur focus — détail distinctif */
.login-input:focus {
  border-color: rgba(34,197,94,0.6);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.08), 0 0 12px rgba(34,197,94,0.06);
}

.login-input:user-invalid {
  border-color: rgba(239,68,68,0.4);
}

/* Boîte d'erreur */
.login-error {
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.78rem;
  padding: 10px 12px;
  line-height: 1.45;
}

/* Bouton soumettre */
.login-submit {
  width: 100%;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: var(--radius);
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  margin-top: 4px;
}

.login-submit:hover:not(:disabled) {
  background: rgba(34,197,94,0.20);
  border-color: rgba(34,197,94,0.55);
  transform: translateY(-1px);
}

.login-submit:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Pied de page carte */
.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 28px 0;
  font-size: 0.65rem;
  color: var(--text-dim);
}

.login-version {
  font-family: var(--mono);
}

.login-footer-sep {
  opacity: 0.5;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .server-grid,
  .skeleton-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .server-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═══════════════════════════════════════════════════════════════
   AV — Page matériel par salle (Phase D v2.0)
   Police IBM Plex pour un look industriel / rack AV distinctif
   ═══════════════════════════════════════════════════════════════ */

body.av-page {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Header AV ──────────────────────────────────────────────── */
.av-header .header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.av-title {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.av-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.av-breadcrumb__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.av-breadcrumb__back:hover { color: var(--text-primary); }

.av-breadcrumb__sep {
  color: var(--text-dim);
  user-select: none;
}

.av-breadcrumb__client {
  color: var(--cyan);
  font-weight: 500;
}

.av-breadcrumb__room {
  font-family: 'IBM Plex Mono', var(--mono);
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Loading ────────────────────────────────────────────────── */
.av-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.av-loading__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: av-spin 0.7s linear infinite;
}

@keyframes av-spin {
  to { transform: rotate(360deg); }
}

/* ── Section header ─────────────────────────────────────────── */
.av-section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.av-section-title {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.av-section-count {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ── Grille des salles ──────────────────────────────────────── */
.av-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* ── Card salle ─────────────────────────────────────────────── */
.av-room-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  position: relative;
  overflow: hidden;
}

.av-room-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border);
  transition: background 0.15s;
}

.av-room-card:hover {
  border-color: var(--cyan);
  background: var(--bg-card-2);
  transform: translateY(-1px);
}

.av-room-card:hover::before { background: var(--cyan); }

.av-room-card--alarm { border-color: rgba(239,68,68,0.35); }
.av-room-card--alarm::before { background: var(--red); }

.av-room-card__num {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.av-room-card__name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.av-room-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.av-room-card__count {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.av-alarm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
}

/* ── Type section (dans vue devices) ───────────────────────── */
.av-type-section {
  margin-bottom: 28px;
}

.av-type-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.av-type-label {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.av-type-count {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
  font-family: 'IBM Plex Mono', var(--mono);
}

/* ── Grille devices ─────────────────────────────────────────── */
.av-devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

/* ── Card device ────────────────────────────────────────────── */
.av-device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s;
}

.av-device-card--down  { border-left: 3px solid var(--red); }
.av-device-card--up    { border-left: 3px solid transparent; }
.av-device-card--unknown { border-left: 3px solid var(--text-dim); }

.av-device-card:hover { border-color: #444c56; }

.av-device-card__top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.av-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.av-status--up      { background: var(--green); }
.av-status--down    { background: var(--red); animation: pulse 2s ease-in-out infinite; }
.av-status--unknown { background: var(--text-dim); }

.av-device-card__names {
  flex: 1;
  min-width: 0;
}

.av-device-card__hostname {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.av-device-card__display {
  font-size: 0.70rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.av-device-card__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.av-device-card__ip {
  font-family: 'IBM Plex Mono', var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}

.av-vendor-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: var(--bg-card-2);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
}

.av-problem-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ── Lien salle depuis index.html (app.js) ──────────────────── */
.av-room-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--cyan);
  text-decoration: none;
  padding: 2px 6px;
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: var(--radius-sm);
  transition: background 0.12s, border-color 0.12s;
}

.av-room-link:hover {
  background: var(--cyan-bg);
  border-color: var(--cyan);
}

/* ── Responsive AV ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .av-rooms-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .av-devices-grid {
    grid-template-columns: 1fr;
  }
}

