@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #090d16;
  --bg-secondary: #111726;
  --bg-card: #172033;
  --bg-card-hover: #1d283f;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-light: rgba(14, 165, 233, 0.15);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(14, 165, 233, 0.4);
  --font-family: 'Outfit', sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
  --border-radius: 12px;
}

body.theme-light {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-light: rgba(2, 132, 199, 0.1);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(2, 132, 199, 0.4);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

body.theme-light ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

body.theme-light ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(9, 13, 22, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-light .sidebar-backdrop {
  background-color: rgba(15, 23, 42, 0.4);
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
  position: relative;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Floating Toggle Button */
.sidebar-toggle-btn {
  position: absolute;
  right: -12px;
  top: 30px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 99;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
  border-color: var(--accent);
}

.sidebar-toggle-btn svg {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* Desktop Collapsed Sidebar Styles */
@media (min-width: 769px) {
  .sidebar.collapsed {
    width: 78px;
    padding: 24px 8px;
  }
  .sidebar.collapsed .brand-name {
    display: none;
  }
  .sidebar.collapsed .brand {
    justify-content: center;
    padding: 8px 0 28px;
  }
  .sidebar.collapsed .nav-link span {
    display: none;
  }
  .sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
  }
  .sidebar.collapsed .theme-switcher {
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    gap: 8px;
  }
  .sidebar.collapsed .theme-btn span {
    display: none;
  }
  .sidebar.collapsed .theme-btn {
    padding: 8px;
    width: 100%;
    justify-content: center;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--border-radius);
  transition: var(--transition);
  cursor: pointer;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active .nav-link {
  color: var(--text-primary);
  background-color: var(--accent-light);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.nav-item.active .nav-link svg {
  color: var(--accent);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(17, 23, 38, 0.3);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 9999px;
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
    box-shadow: 0 0 12px var(--success);
  }

  100% {
    transform: scale(0.95);
    opacity: 0.5;
  }
}

.content-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Tabs Panel display logic */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease-in-out;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Styled Cards & Containers */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Filters Card */
.filters-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  background-color: var(--bg-secondary);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 160px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-control {
  width: 100%;
  padding: 10px 14px;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.filter-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

select.filter-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.btn-container {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  outline: none;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-radius: var(--border-radius);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.primary {
  background-color: var(--accent-light);
  color: var(--accent);
}

.stat-icon.success {
  background-color: var(--success-light);
  color: var(--success);
}

.stat-icon.warning {
  background-color: var(--warning-light);
  color: var(--warning);
}

.stat-icon.danger {
  background-color: var(--danger-light);
  color: var(--danger);
}

.stat-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-info .value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat-info .label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Chart Container */
.chart-card {
  position: relative;
}

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

.chart-title {
  font-size: 18px;
  font-weight: 600;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 380px;
}

/* Dashboard Section Layout (2 columns for Ping / Targets) */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* Targets Card & List styling */
.targets-card {
  display: flex;
  flex-direction: column;
  max-height: 600px;
}

.targets-search-wrapper {
  margin-bottom: 16px;
}

.targets-list-container {
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.target-item {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.target-item:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

.target-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.target-item-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target-item-host {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.target-item-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background-color: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(14, 165, 233, 0.2);
}

/* Tables styling */
.table-card {
  overflow-x: auto;
}

.table-title-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td {
  background-color: rgba(255, 255, 255, 0.015);
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Traceroute styling */
.traceroute-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .traceroute-layout {
    grid-template-columns: 1fr;
  }
}

.route-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 550px;
  overflow-y: auto;
}

.route-history-item {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.route-history-item:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.route-history-item.active {
  border-color: var(--accent);
  background-color: var(--accent-light);
}

.route-history-time {
  font-size: 13px;
  font-weight: 600;
}

.route-history-summary {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.hops-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}

.hop-card {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.hop-card::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 40px;
  bottom: -24px;
  width: 2px;
  background-color: var(--border);
  z-index: 1;
}

.hop-card:last-child::before {
  display: none;
}

.hop-number {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  z-index: 2;
  box-shadow: 0 0 0 4px var(--bg-card);
  transition: var(--transition);
}

.hop-card.active .hop-number {
  border-color: var(--accent);
  color: var(--text-primary);
  background-color: var(--accent-light);
}

.hop-details {
  flex-grow: 1;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.hop-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hop-ip {
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
}

.hop-host {
  font-size: 11px;
  color: var(--text-secondary);
}

.hop-rtt {
  font-size: 14px;
  font-weight: 700;
  font-family: monospace;
}

.hop-rtt.loss {
  color: var(--danger);
}

/* Loading & Empty States */
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 16px;
  color: var(--text-secondary);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(14, 165, 233, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  gap: 12px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  stroke-width: 1.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: 13px;
  max-width: 320px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Theme Switcher Styles */
.theme-switcher {
  display: flex;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  margin-top: auto;
  gap: 4px;
}

body.theme-light .theme-switcher {
  background-color: rgba(0, 0, 0, 0.03);
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
}

.theme-btn svg {
  stroke: currentColor;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.theme-light .theme-btn.active {
  background-color: var(--bg-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Offline Badge Styling */
.system-status.offline {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.system-status.offline .status-dot {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pulse-offline 2s infinite;
}

@keyframes pulse-offline {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
    box-shadow: 0 0 12px var(--danger);
  }

  100% {
    transform: scale(0.95);
    opacity: 0.5;
  }
}

/* Diag Tab Layout & Components */
.diag-top-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .diag-top-layout {
    grid-template-columns: 1fr;
  }
}

.diag-form-card {
  display: flex;
  flex-direction: column;
}

.diag-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.diag-form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.diag-results-card {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  justify-content: center;
}

.diag-panel-state {
  display: none;
  width: 100%;
}

.diag-panel-state.active {
  display: block;
}

/* Banner Headers */
.diag-header-banner {
  padding: 16px 24px;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.diag-header-banner.requested {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.2);
}

.diag-header-banner.retest-requested {
  background: linear-gradient(135deg, #a855f7, #6b21a8);
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
}

.diag-header-banner.completed {
  background: linear-gradient(135deg, var(--success), #047857);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.diag-header-banner .banner-title {
  font-size: 20px;
  font-weight: 700;
}

.diag-header-banner .banner-subtext {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 4px;
}

.diag-header-banner .banner-right {
  display: flex;
  gap: 16px;
}

.meta-item, .meta-item-small {
  display: flex;
  flex-direction: column;
}

.meta-item .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.meta-item .value {
  font-size: 18px;
  font-weight: 700;
}

.meta-item-small .label {
  font-size: 10px;
  opacity: 0.75;
  text-transform: uppercase;
  text-align: right;
}

.meta-item-small .value {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

/* Processing */
.diag-processing-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 10px 0;
}

.diag-processing-meta {
  display: flex;
  justify-content: space-around;
  width: 100%;
  max-width: 500px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

/* Countdown Circle */
.countdown-container {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.countdown-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.countdown-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.countdown-bar {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke var(--transition);
}

.countdown-text {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: -10px;
  z-index: 2;
}

.countdown-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  z-index: 2;
}

.diag-wait-notice {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* Completed Results Layout */
.diag-completed-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.diag-results-flex {
  display: flex;
  gap: 24px;
}

@media (max-width: 768px) {
  .diag-results-flex {
    flex-direction: column;
  }
}

.diag-rank-section {
  flex: 1;
}

.diag-comparison-section {
  width: 280px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .diag-comparison-section {
    width: 100%;
  }
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* ISP Rank list items */
.isp-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.isp-rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.015);
  transition: var(--transition);
}

.isp-rank-item:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.isp-rank-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.isp-rank-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
}

.isp-rank-item.rank-1 .isp-rank-number {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.isp-rank-item.rank-2 .isp-rank-number {
  background-color: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.isp-rank-item.rank-3 .isp-rank-number {
  background-color: rgba(217, 119, 6, 0.15);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.isp-rank-name {
  font-weight: 600;
  font-size: 14px;
}

.isp-rank-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.isp-rank-ping {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.isp-rank-loss {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.isp-rank-loss.no-loss {
  background-color: var(--success-light);
  color: var(--success);
}

.isp-rank-loss.has-loss {
  background-color: var(--danger-light);
  color: var(--danger);
}

/* Comparison Box */
.comparison-card {
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comparison-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.comparison-row .label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.comparison-row .sub-label {
  color: var(--text-secondary);
}

.comparison-row .value {
  font-family: monospace;
  font-weight: 600;
  font-size: 14px;
}

.comparison-divider {
  height: 1px;
  background-color: var(--border);
}

.comparison-row.improvement .badge {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.comparison-row.improvement .badge.better {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.comparison-row.improvement .badge.worse {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.comparison-row.improvement .badge.neutral {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Recommendation Box */
.recommendation-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 8px;
}

.recommendation-banner.normal {
  background-color: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.recommendation-banner.warning {
  background-color: var(--warning-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.recommendation-banner.danger {
  background-color: var(--danger-light);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.recommendation-banner.unavailable {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.recommendation-banner .rec-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.recommendation-banner .rec-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recommendation-banner .rec-content .title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recommendation-banner .rec-content .desc {
  font-size: 16px;
  font-weight: 700;
}

/* Action buttons */
.diag-action-container {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Bottom Grid Layout */
.diag-bottom-grid {
  display: grid;
  grid-template-columns: 320px 1fr 1fr;
  gap: 24px;
  animation: fadeIn 0.3s ease-in-out;
}

@media (max-width: 1200px) {
  .diag-bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* Timeline */
.diag-history-card {
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

.diag-history-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding-left: 8px;
  flex-grow: 1;
}

.timeline-item {
  position: relative;
  padding-left: 28px;
  padding-bottom: 18px;
  cursor: pointer;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 2px solid var(--border);
  z-index: 2;
  transition: var(--transition);
}

.timeline-line {
  position: absolute;
  left: 6px;
  top: 18px;
  bottom: -4px;
  width: 2px;
  background-color: var(--border);
  z-index: 1;
}

.timeline-item:last-child .timeline-line {
  display: none;
}

.timeline-item.completed .timeline-marker {
  background-color: var(--success-light);
  border-color: var(--success);
}

.timeline-item.active .timeline-marker {
  background-color: var(--accent-light);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.timeline-item.active.round-2plus .timeline-marker {
  background-color: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  box-shadow: 0 0 8px #a855f7;
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  transition: var(--transition);
}

.timeline-item:hover .timeline-title {
  color: var(--accent);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.timeline-summary {
  font-size: 11px;
  color: var(--text-muted);
}

/* Sub-timeline for retest rounds */
.timeline-sub-rounds {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px dashed var(--border);
}

.timeline-sub-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  background-color: var(--bg-body);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.timeline-sub-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}

.timeline-sub-item.active {
  background-color: var(--accent-light);
  border-color: var(--accent);
}

.timeline-sub-item.active.round-2plus {
  background-color: rgba(168, 85, 247, 0.1);
  border-color: #a855f7;
}

.timeline-sub-item .sub-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.timeline-sub-item .sub-time {
  font-size: 9px;
  color: var(--text-secondary);
}

.timeline-sub-item .sub-summary {
  font-size: 10px;
  color: var(--text-muted);
}

/* Raw Cards */
.diag-raw-card {
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

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

.diag-raw-tabs {
  display: flex;
  gap: 4px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.raw-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-family);
}

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

.raw-tab-btn.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.terminal-view {
  background-color: #050811;
  color: #10b981;
  font-family: monospace;
  font-size: 12.5px;
  padding: 16px;
  border-radius: 8px;
  overflow-y: auto;
  flex-grow: 1;
  max-height: 380px;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.9);
}

.terminal-view pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* Light mode adjustments */
body.theme-light .countdown-bg {
  stroke: rgba(0, 0, 0, 0.05);
}

body.theme-light .comparison-card,
body.theme-light .diag-processing-meta {
  background-color: rgba(0, 0, 0, 0.03);
}

body.theme-light .isp-rank-item {
  background-color: rgba(0, 0, 0, 0.01);
}

body.theme-light .terminal-view {
  background-color: #070c18;
  color: #10b981;
}

body.theme-light .diag-raw-tabs {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Mobile Responsive and Hamburger menu adjustments */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  margin-right: 12px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mobile-menu-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

body.theme-light .mobile-menu-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.mobile-menu-btn svg {
  stroke: currentColor;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    width: 260px !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-toggle-btn {
    display: none !important;
  }

  .header {
    padding: 16px 20px;
  }

  .content-body {
    padding: 16px;
    gap: 16px;
  }

  .filters-card {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
  }

  .btn-container {
    width: 100%;
    margin-top: 12px;
  }

  .btn-container .btn {
    flex: 1;
  }
}