/* ============================================================
   LAYOUT.CSS — Structural layout — Dark tactical theme
   ============================================================ */

/* ── HEADER ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(0,212,120,0.1), var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── BRAND ── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px var(--color-accent-glow));
}
.brand-icon svg { width: 100%; height: 100%; }

.brand-text { display: flex; flex-direction: column; line-height: 1; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── STATUS ── */
.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: background var(--transition-mid);
  flex-shrink: 0;
}
.status-dot.online {
  background: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-light), 0 0 8px var(--color-accent-glow);
  animation: radarPulse 2s infinite;
}
.status-dot.offline { background: var(--color-danger); }
.status-dot.loading { background: var(--color-warning); animation: pulse 1s infinite; }

@keyframes radarPulse {
  0%   { box-shadow: 0 0 0 0 var(--color-accent-glow); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.status-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.status-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-text-muted);
  padding: 2px 8px;
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

/* ── HEADER ACTIONS ── */
.header-actions { display: flex; align-items: center; gap: 6px; }

/* ── MAIN ── */
.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── STATS BAR ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ── FILTERS BAR ── */
.filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.filters-left {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
}

.filters-right {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── TABLE CONTAINER ── */
.table-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex: 1;
}

.table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.table-scroll {
  overflow-x: auto;
  max-height: calc(100vh - 340px);
  min-height: 300px;
}

/* ── DETAIL PANEL ── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-mid);
  backdrop-filter: blur(4px);
}
.detail-overlay.visible { opacity: 1; pointer-events: all; }

.detail-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  background: var(--color-surface);
  z-index: 201;
  box-shadow: var(--shadow-panel);
  border-left: 1px solid var(--color-border);
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel.open { transform: translateX(0); }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.detail-header h3 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.05em;
}

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

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-mid);
  backdrop-filter: blur(6px);
}
.modal-overlay.visible { opacity: 1; pointer-events: all; }

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,212,120,0.05);
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-mid);
}
.modal-overlay.visible .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  position: relative;
  overflow: hidden;
}
.modal-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
}
.modal-header h2 { font-size: 1.2rem; color: #FFFFFF; margin-bottom: 4px; }
.modal-header p { font-size: 0.78rem; color: var(--color-text-muted); }

.modal-body {
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 28px 22px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
