/* ==========================================================================
   CSS DESIGN SYSTEM: zoom-network-monitor
   Aesthetics: Premium Glassmorphism Dark Mode
   ========================================================================== */

:root {
  /* Color Palette (HSL Tailored Colors) */
  --bg-primary: #0a0b14;
  --bg-secondary: #121324;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --accent-blue: #3b82f6;
  --accent-blue-rgb: 59, 130, 246;
  --accent-purple: #8b5cf6;
  
  /* Status Colors */
  --status-good: #10b981; /* Emerald Green */
  --status-good-glow: rgba(16, 185, 129, 0.4);
  --status-warning: #f59e0b; /* Amber Yellow */
  --status-warning-glow: rgba(245, 158, 11, 0.4);
  --status-danger: #ef4444; /* Ruby Red */
  --status-danger-glow: rgba(239, 68, 68, 0.4);
  --status-offline: #64748b; /* Slate Grey */
  --status-offline-glow: rgba(100, 116, 139, 0.2);

  /* Glassmorphism settings */
  --glass-bg: rgba(20, 22, 45, 0.5);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-highlight: rgba(255, 255, 255, 0.03);
  --glass-shadow: 0 16px 36px 0 rgba(0, 0, 0, 0.5);
}

.hidden {
  display: none !important;
}

/* Reset & Base Setup */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 40px;
}

h1, h2, h3, .accent-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* Blurred background mesh shapes */
.bg-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(10, 11, 20, 1) 0%, rgba(18, 19, 36, 1) 100%);
}

/* Layout container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Glassmorphism generic container */
.glass-container {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-container:hover {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(24, 26, 55, 0.55);
}

/* Header styling */
.header {
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.logo-area h1 {
  font-size: 2.2rem;
  letter-spacing: -0.5px;
}

.accent-text {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* Active session banner */
.session-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.online {
  background-color: var(--status-good);
  box-shadow: 0 0 10px var(--status-good);
  animation: pulse-green 2s infinite;
}

.status-indicator.offline {
  background-color: var(--status-danger);
  box-shadow: 0 0 10px var(--status-danger);
}

/* Controls */
.start-session-form {
  display: flex;
  gap: 8px;
}

.start-session-form input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 10px 16px;
  border-radius: 8px;
  color: white;
  min-width: 250px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.start-session-form input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
  filter: brightness(1.1);
}

.btn-danger {
  background: var(--status-danger);
  color: white;
  box-shadow: 0 4px 12px var(--status-danger-glow);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
  background-color: #dc2626;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.btn-close {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-close:hover {
  color: white;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.2);
}

.active-session-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.active-name {
  font-weight: 600;
  color: white;
  font-size: 1.1rem;
}

/* Tabs layout */
.tab-navigation {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 24px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: white;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Clients Grid (6 Cards) */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Client Card styling */
.client-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.client-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--status-offline);
}

.client-card.card-good::before {
  background: var(--status-good);
}

.client-card.card-warning::before {
  background: var(--status-warning);
}

.client-card.card-danger::before {
  background: var(--status-danger);
}

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

.card-header h3 {
  font-size: 1.25rem;
  color: white;
}

/* Status LED */
.led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.3s ease;
}

.led-good {
  background-color: var(--status-good);
  box-shadow: 0 0 10px var(--status-good);
  animation: pulse-green 1.5s infinite;
}

.led-warning {
  background-color: var(--status-warning);
  box-shadow: 0 0 10px var(--status-warning);
  animation: pulse-yellow 1.5s infinite;
}

.led-danger {
  background-color: var(--status-danger);
  box-shadow: 0 0 10px var(--status-danger);
  animation: pulse-red 1.5s infinite;
}

.led-offline {
  background-color: var(--status-offline);
  box-shadow: 0 0 5px var(--status-offline);
}

/* Metrics breakdown */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 12px 8px;
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s ease;
}

.metric-box:hover {
  background: rgba(255, 255, 255, 0.05);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.metric-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.metric-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.card-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 12px;
}

.placeholder-text {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 0;
  font-style: italic;
}

/* Real-time chart box */
.chart-container {
  padding: 24px;
}

.chart-header {
  margin-bottom: 20px;
}

.chart-header h2 {
  font-size: 1.4rem;
  color: white;
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chart-wrapper {
  position: relative;
  height: 350px;
  width: 100%;
}

/* History Layout */
.history-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.history-list-container {
  padding: 24px;
}

.history-list-container h2 {
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.table-wrapper {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.history-table td {
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0 !important;
  font-style: italic;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-good);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.completed {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* History Details Area */
.history-details-container {
  padding: 24px;
}

.history-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.history-actions {
  display: flex;
  gap: 8px;
}

.history-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 16px;
  border-radius: 12px;
}

.summary-card h4 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.summary-row:last-child {
  margin-bottom: 0;
}

.summary-label {
  color: var(--text-muted);
}

.summary-value {
  font-weight: 500;
  color: white;
}

/* Alert Banner Styling */
.alert-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 90%;
  max-width: 500px;
  background: rgba(239, 68, 68, 0.15);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  border-radius: 12px;
  padding: 16px 20px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.alert-banner.hidden {
  top: -100px;
  opacity: 0;
  pointer-events: none;
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fca5a5;
  font-weight: 500;
  font-size: 0.95rem;
}

.alert-icon {
  font-size: 1.2rem;
  animation: shake 1s infinite;
}

/* Keyframe Animations */
@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-yellow {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* Session Status Row & Logout Button */
.session-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 16px;
}

.btn-logout {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  color: white;
}

/* Login Overlay and Card */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 50%, rgba(10, 11, 20, 0.85) 0%, rgba(18, 19, 36, 0.95) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: 90%;
  max-width: 420px;
  padding: 36px;
  border-radius: 20px;
  background: rgba(20, 22, 45, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: slide-up 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
  background: rgba(255, 255, 255, 0.09);
}

.login-error-msg {
  color: #f87171;
  font-size: 0.85rem;
  margin-bottom: 16px;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-error-msg.hidden {
  display: none;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

/* Download Section */
.download-section {
  padding: 32px;
  margin-top: 0;
}

.download-header {
  text-align: center;
  margin-bottom: 36px;
}

.download-header h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.download-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.step-card {
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.step-number {
  min-width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.step-content h3 {
  font-size: 1.1rem;
  color: white;
  margin-bottom: 8px;
}

.step-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.step-content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #93c5fd;
  font-family: 'Courier New', monospace;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.config-preview {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 16px;
  margin-top: 10px;
  overflow-x: auto;
}

.config-preview pre {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.8;
  white-space: pre;
}

.step-note {
  margin-top: 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #93c5fd;
}

/* Download status & progress */
.download-status-panel {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.dl-progress {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

.dl-loading {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.dl-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.debug-panel {
  padding: 16px;
  font-size: 0.82rem;
}

/* Responsive queries */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .session-control {
    width: 100%;
  }
  .start-session-form {
    width: 100%;
  }
  .start-session-form input {
    flex-grow: 1;
    min-width: unset;
  }
  .clients-grid {
    grid-template-columns: 1fr;
  }
}
