:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.12);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #6366f1;
  --accent-glow: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --welcome-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  --success-color: #10b981;
  --error-color: #ef4444;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
  position: relative;
  overflow-x: hidden;
}

/* Background Glowing Orbs */
.background-globes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.globe {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.globe-1 {
  width: 450px;
  height: 450px;
  background: #6366f1;
  top: -100px;
  left: -100px;
}

.globe-2 {
  width: 500px;
  height: 500px;
  background: #ec4899;
  bottom: -150px;
  right: -150px;
  animation-delay: -7s;
}

.globe-3 {
  width: 350px;
  height: 350px;
  background: #06b6d4;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 80px) scale(1.15); }
}

.app-container {
  width: 100%;
  max-width: 820px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* Hero Header */
.hero-header {
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-glow);
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.welcome-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  background: var(--welcome-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 40px rgba(129, 140, 248, 0.25);
  line-height: 1.1;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.card-header h2 i {
  color: var(--accent-glow);
}

.card-header p {
  color: var(--text-secondary);
  font-size: 0.92rem;
}

/* Presets Bar */
.presets-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.preset-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-right: 0.25rem;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-preset:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-glow);
  color: #fff;
  transform: translateY(-1px);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;

  margin-bottom: 1.25rem;
}

.form-row {
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group.full-width {
  grid-column: span 2;
}

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

label i {
  color: var(--accent-glow);
  font-size: 0.95rem;
}

input, select {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.25s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-glow);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
  background: rgba(15, 23, 42, 0.85);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 2.75rem;
}

.toggle-password {
  position: absolute;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.toggle-password:hover {
  color: var(--text-primary);
}

.form-options {
  margin-bottom: 1.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.6);
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-label input:checked + .custom-checkbox {
  background: var(--accent-primary);
  border-color: var(--accent-glow);
}

.checkbox-label input:checked + .custom-checkbox::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: white;
  font-size: 0.7rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Submit Button */
.btn-submit {
  width: 100%;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  color: white;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(99, 102, 241, 0.5);
}

.btn-submit:active {
  transform: translateY(0);
}

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

/* Result Container */
.result-container {
  margin-top: 2rem;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.result-container.success {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.result-container.error {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.success .result-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.error .result-icon {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error-color);
}

.result-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.result-title-group p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.latency-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-glow);
}

.result-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.detail-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.detail-card.metric-card {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.detail-card label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
}

.detail-card.metric-card label {
  color: var(--accent-glow);
  font-weight: 700;
}

.detail-card span {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-all;
}

.detail-card span.metric-value {
  color: #38bdf8;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: monospace;
}

.detail-card label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
}

.detail-card span {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-all;
}

.error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.app-footer strong {
  color: var(--accent-glow);
}

@media (max-width: 640px) {
  .welcome-heading {
    font-size: 2.5rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.full-width {
    grid-column: span 1;
  }
  .result-details-grid {
    grid-template-columns: 1fr;
  }
}
