/*
 * speedtest.hosting.in.ua - Modern CSS Design System
 * Hosting.in.ua Speedtest Theme
 */

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

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Grotesk', monospace;

  /* Theme Palette - Dark (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(0, 242, 254, 0.3);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Brand Accents */
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7F00FF;
  --accent-magenta: #E100FF;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;

  /* Gauge Colors */
  --color-dl: #00f2fe;
  --color-ul: #10b981;
  --color-ping: #f59e0b;
  --color-jit: #ec4899;

  --shadow-glow-cyan: 0 0 25px rgba(0, 242, 254, 0.25);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --radius-full: 9999px;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 1);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(79, 172, 254, 0.4);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-glow-cyan: 0 0 20px rgba(0, 242, 254, 0.15);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
}

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

html {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  scroll-behavior: smooth;
  min-height: 100vh;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 0%, rgba(0, 242, 254, 0.05) 0%, transparent 60%),
              radial-gradient(circle at 80% 80%, rgba(127, 0, 255, 0.04) 0%, transparent 50%),
              var(--bg-primary);
  background-attachment: fixed;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Layout Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Header & Navbar */
.navbar {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.8);
}

[data-theme="light"] .navbar {
  background: rgba(248, 250, 252, 0.85);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow-cyan);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(135deg, #0f172a 30%, var(--accent-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Control Pills */
.pill-group {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-full);
}

[data-theme="light"] .pill-group {
  background: rgba(0, 0, 0, 0.04);
}

.lang-btn, .theme-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-btn:hover, .theme-btn:hover {
  color: var(--text-main);
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #0b0f19;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.3);
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle-btn:hover {
  border-color: var(--border-highlight);
  background: rgba(0, 242, 254, 0.1);
}

/* Hero & Main Action Area */
.hero-section {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.test-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: var(--transition-normal);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

.status-dot.pulse {
  animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 5px var(--accent-cyan); }
  100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 15px var(--accent-cyan); }
}

/* Start Button Hero */
.start-btn-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.start-btn {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(0, 242, 254, 0.4);
  background: radial-gradient(circle at 30% 30%, rgba(0, 242, 254, 0.25), rgba(17, 24, 39, 0.95));
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.2), inset 0 0 20px rgba(0, 242, 254, 0.15);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  outline: none;
}

.start-btn::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: var(--radius-full);
  border: 1px dashed rgba(0, 242, 254, 0.3);
  animation: rotateCircle 25s linear infinite;
  pointer-events: none;
}

@keyframes rotateCircle {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.start-btn:hover {
  transform: scale(1.06);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 50px rgba(0, 242, 254, 0.45), inset 0 0 25px rgba(0, 242, 254, 0.3);
}

.start-btn.running {
  background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, 0.3), rgba(17, 24, 39, 0.95));
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.3);
}

.start-btn.running:hover {
  border-color: var(--accent-rose);
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.5);
}

/* Metrics Dashboard Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: var(--transition-fast);
}

.metric-card[data-metric="dl"]::after { background: var(--color-dl); }
.metric-card[data-metric="ul"]::after { background: var(--color-ul); }
.metric-card[data-metric="ping"]::after { background: var(--color-ping); }
.metric-card[data-metric="jit"]::after { background: var(--color-jit); }

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
  width: 100%;
  justify-content: center;
}

.metric-icon {
  width: 20px;
  height: 20px;
}

.metric-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Gauge SVG Container */
.gauge-container {
  width: 160px;
  height: 120px;
  position: relative;
  margin-bottom: 0.5rem;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gauge-bg-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
  stroke-linecap: round;
}

[data-theme="light"] .gauge-bg-path {
  stroke: rgba(0, 0, 0, 0.08);
}

.gauge-progress-path {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 0.15s ease-out;
}

.gauge-progress-dl { stroke: url(#gradientDl); }
.gauge-progress-ul { stroke: url(#gradientUl); }
.gauge-progress-ping { stroke: url(#gradientPing); }
.gauge-progress-jit { stroke: url(#gradientJit); }

.metric-value-group {
  text-align: center;
  margin-top: -1.2rem;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.1;
}

.metric-unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Real-Time Chart & Info Section */
.grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

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

.card-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}

.panel-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

/* Network & IP Info Card */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-color);
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-key {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.info-val {
  font-family: var(--font-mono);
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
}

.server-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 4px 10px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

[data-theme="light"] .server-select {
  background: rgba(0, 0, 0, 0.04);
}

.server-select:hover, .server-select:focus {
  border-color: var(--border-highlight);
  background: rgba(0, 242, 254, 0.1);
}

.server-select option {
  background: var(--bg-secondary);
  color: var(--text-main);
}

/* Quality Rating Cards Grid */
.quality-section {
  margin-bottom: 2.5rem;
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .quality-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .quality-grid {
    grid-template-columns: 1fr;
  }
}

.quality-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition-fast);
}

.quality-card:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

.quality-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quality-card-icon {
  font-size: 1.5rem;
}

.quality-card-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.quality-badge {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-excellent { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-good { background: rgba(0, 242, 254, 0.2); color: #38bdf8; border: 1px solid rgba(0, 242, 254, 0.4); }
.badge-moderate { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-poor { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

/* Direct Download Section */
.files-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .files-grid {
    grid-template-columns: 1fr;
  }
}

.file-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.file-info {
  display: flex;
  flex-direction: column;
}

.file-title {
  font-size: 0.925rem;
  font-weight: 600;
}

.file-size {
  font-size: 0.775rem;
  color: var(--text-dim);
}

.file-actions {
  display: flex;
  gap: 6px;
}

.btn-action {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-fast);
}

.btn-action:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

/* History Drawer / Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
}

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

.history-table th {
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 12px 14px;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.table-controls {
  display: flex;
  gap: 10px;
}

/* Notification Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease;
}

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

/* Footer */
.footer {
  margin-top: auto;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.9);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Info Tooltips */
.info-tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-tooltip-btn {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  line-height: 1;
  text-decoration: none;
}

.info-tooltip-btn:hover {
  background: var(--accent-cyan);
  color: #0b0f19;
  border-color: var(--accent-cyan);
}

.info-tooltip-box {
  position: absolute;
  top: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  width: 220px;
  padding: 10px 14px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.4;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  text-align: left;
}

[data-theme="light"] .info-tooltip-box {
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
}

.info-tooltip-wrapper:hover .info-tooltip-box,
.info-tooltip-btn:focus + .info-tooltip-box {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Guide Cards Grid */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

.guide-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition-fast);
}

.guide-card:hover {
  border-color: var(--border-highlight);
  background: rgba(255, 255, 255, 0.05);
}

.guide-card-header {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
}

.guide-card-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Server Selector Styling */
.server-select {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
  max-width: 250px;
}

[data-theme="light"] .server-select {
  background: rgba(248, 250, 252, 0.9);
}

.server-select:hover, .server-select:focus {
  border-color: var(--color-dl);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}
