/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */

:root {
  /* Color Palettes - Dark Theme (Default) */
  --bg-main: hsl(224, 71%, 4%);
  --bg-grid: rgba(255, 255, 255, 0.015);
  --card-bg: rgba(10, 15, 30, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(59, 130, 246, 0.35);
  
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 65%);
  --text-muted: hsl(215, 16%, 47%);
  
  /* Theme Accents */
  --accent: hsl(217, 91%, 60%); /* Electric Blue */
  --accent-rgb: 59, 130, 246;
  --accent-glow: rgba(59, 130, 246, 0.15);
  
  --red: hsl(346, 84%, 61%);
  --red-bg: rgba(244, 63, 94, 0.1);
  --blue: hsl(217, 91%, 60%);
  --blue-bg: rgba(59, 130, 246, 0.1);
  --green: hsl(142, 71%, 45%);
  --green-bg: rgba(16, 185, 129, 0.1);
  --orange: hsl(24, 94%, 50%);
  --orange-bg: rgba(249, 115, 22, 0.1);
  --purple: hsl(262, 83%, 58%);
  --purple-bg: rgba(139, 92, 246, 0.1);
  --cyan: hsl(189, 94%, 43%);
  --cyan-bg: rgba(6, 182, 212, 0.1);
  
  /* Layout */
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 8px;
  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px -10px rgba(59, 130, 246, 0.25);
  
  /* Fonts */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

/* Light Theme Variables Toggle */
body.light-theme {
  --bg-main: hsl(220, 30%, 96%);
  --bg-grid: rgba(0, 0, 0, 0.02);
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(0, 0, 0, 0.06);
  --card-border-hover: rgba(59, 130, 246, 0.25);
  
  --text-primary: hsl(224, 71%, 4%);
  --text-secondary: hsl(220, 15%, 35%);
  --text-muted: hsl(220, 10%, 55%);
  
  --accent-glow: rgba(59, 130, 246, 0.08);
  --shadow-main: 0 10px 35px -12px rgba(9, 30, 66, 0.12);
  --shadow-glow: 0 0 30px -5px rgba(59, 130, 246, 0.12);
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}
body.light-theme code {
  background-color: rgba(0, 0, 0, 0.05);
}

.text-mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ==========================================================================
   BACKGROUND EFFECT SHAPES
   ========================================================================== */

.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: -2;
  opacity: 0.45;
  transition: opacity 0.5s ease;
}

body.light-theme .bg-glow {
  opacity: 0.2;
}

.bg-glow-1 {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35) 0%, rgba(139, 92, 246, 0.1) 70%);
  top: -200px;
  right: -100px;
  animation: float-slow 20s infinite alternate;
}

.bg-glow-2 {
  background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, rgba(16, 185, 129, 0.05) 70%);
  bottom: -200px;
  left: -100px;
  animation: float-slow 25s infinite alternate-reverse;
}

.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -1;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 40px) scale(1.1); }
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

.header {
  height: 80px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(var(--bg-main), 0.7);
  transition: border-color 0.4s ease;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo:hover .logo-icon {
  transform: rotate(360deg);
}

.logo-text {
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-accent {
  background: linear-gradient(135deg, var(--accent) 0%, hsl(190, 95%, 55%) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

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

/* Theme Toggle Button */
.btn-theme {
  background: transparent;
  border: 1px solid var(--card-border);
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-theme:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}
body.light-theme .btn-theme:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-theme i {
  width: 20px;
  height: 20px;
  transition: transform 0.5s ease;
}

.btn-theme:hover i {
  transform: rotate(20deg) scale(1.05);
}

/* Buttons */
.btn-primary-sm {
  background: linear-gradient(135deg, var(--accent) 0%, hsl(200, 95%, 50%) 100%);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary-sm:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary-sm i {
  width: 16px;
  height: 16px;
}

.btn-secondary-sm {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .btn-secondary-sm {
  background: rgba(0, 0, 0, 0.03);
}

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

body.light-theme .btn-secondary-sm:hover {
  background: rgba(0, 0, 0, 0.06);
}

.btn-secondary-sm i {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   GLASS CARDS ARCHITECTURE
   ========================================================================== */

.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-main);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s ease, 
              box-shadow 0.4s ease;
}

.glass-card:hover {
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-main), var(--shadow-glow);
}

/* ==========================================================================
   HERO / MAIN IP CARD
   ========================================================================== */

.hero-section {
  margin-top: 40px;
  margin-bottom: 30px;
}

.hero-card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.badge-pulse {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
  100% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.badge-blue {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.ip-display-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
}

.ip-address {
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 0%, hsl(215, 25%, 80%) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  word-break: normal;
  overflow-wrap: break-word;
  cursor: pointer;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ip-address:hover {
  opacity: 0.8;
}

.ip-address:active {
  transform: scale(0.98);
}

.ip-address.ipv6 {
  font-size: clamp(1.8rem, 5.2vw, 3.2rem);
}

.btn-copy {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  width: 64px;
  height: 64px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .btn-copy {
  background: rgba(0, 0, 0, 0.02);
}

.btn-copy:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: scale(1.05);
}

.btn-copy i {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

.btn-copy:active i {
  transform: scale(0.9);
}

.hero-quick-details {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.quick-item i {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.quick-item.border-left {
  padding-left: 20px;
  position: relative;
}

.quick-item.border-left::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background-color: var(--card-border);
}

/* Responsive quick details adjustment */
@media (max-width: 768px) {
  .hero-quick-details {
    flex-direction: column;
    gap: 12px;
  }
  .quick-item.border-left {
    padding-left: 0;
  }
  .quick-item.border-left::before {
    display: none;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 16px;
  }
  .hero-card {
    padding: 20px;
  }
  .ip-display-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    text-align: center;
  }
  .ip-address {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
    letter-spacing: -0.5px;
    text-align: center;
    line-height: 1.2;
  }
  .ip-address.ipv6 {
    font-size: clamp(1.2rem, 5.2vw, 1.8rem);
    letter-spacing: -0.3px;
  }
  .btn-copy {
    width: 100%;
    height: 54px;
    border-radius: var(--border-radius-sm);
  }
  .header {
    height: 64px;
  }
  .logo {
    font-size: 1.2rem;
    gap: 6px;
  }
  .logo-icon {
    width: 20px;
    height: 20px;
  }
  .logo-text {
    font-size: 1.2rem;
  }
  .logo-text .text-accent {
    display: none;
  }
  .header-actions {
    gap: 8px;
  }
  .btn-theme {
    width: 36px;
    height: 36px;
  }
  .btn-theme i {
    width: 16px;
    height: 16px;
  }
  .btn-primary-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  .secondary-ip-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .secondary-ip-value {
    font-size: 0.78rem;
    word-break: break-all;
  }
}

/* ==========================================================================
   DASHBOARD GRID & INFO CARDS
   ========================================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

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

.info-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon-container {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-icon-container i {
  width: 20px;
  height: 20px;
}

/* Icon Containers Palette colors */
.bg-red { background: var(--red-bg); }
.text-red { color: var(--red); }

.bg-blue { background: var(--blue-bg); }
.text-blue { color: var(--blue); }

.bg-green { background: var(--green-bg); }
.text-green { color: var(--green); }

.bg-orange { background: var(--orange-bg); }
.text-orange { color: var(--orange); }

.bg-purple { background: var(--purple-bg); }
.text-purple { color: var(--purple); }

.bg-cyan { background: var(--cyan-bg); }
.text-cyan { color: var(--cyan); }

.info-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.icon-help {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  cursor: help;
  transition: color 0.3s ease;
}

.icon-help:hover {
  color: var(--text-secondary);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
}

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

.info-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  word-break: normal;
  overflow-wrap: anywhere;
}

.value-highlight {
  color: var(--text-primary);
  font-size: 0.98rem;
}

.flag-icon {
  font-size: 1.1rem;
  vertical-align: middle;
  margin-right: 4px;
}

/* Connection type / status badges */
.connection-badge, .vpn-badge, .cdn-badge, .network-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.connection-badge {
  background: var(--blue-bg);
  color: var(--blue);
}

.network-badge {
  background: var(--purple-bg);
  color: var(--purple);
}

.vpn-badge.vpn-safe {
  background: var(--green-bg);
  color: var(--green);
}

.vpn-badge.vpn-alert {
  background: var(--red-bg);
  color: var(--red);
  animation: subtle-pulse 2s infinite alternate;
}

.cdn-badge {
  background: var(--orange-bg);
  color: var(--orange);
}

@keyframes subtle-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}

.timezone-clock-row {
  border-top: 1px dashed var(--card-border);
  padding-top: 12px;
  margin-top: 4px;
}

.clock-value {
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* User Agent field wrap */
.ua-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border-top: 1px dashed var(--card-border);
  padding-top: 12px;
}

.user-agent-text {
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  width: 100%;
  max-height: 70px;
  overflow-y: auto;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.light-theme .user-agent-text {
  background: rgba(0, 0, 0, 0.02);
}

.user-agent-text:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-muted);
}
body.light-theme .user-agent-text:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Loading placeholders animations */
.loading-placeholder {
  animation: pulse-bg 1.5s infinite alternate;
  color: transparent !important;
  background: linear-gradient(90deg, var(--card-border) 25%, var(--text-muted) 50%, var(--card-border) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
}

@keyframes pulse-bg {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   MAP VISUALIZATION
   ========================================================================== */

.map-section-container {
  margin-bottom: 24px;
}

.map-card {
  padding: 24px;
}

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

.map-lat-lon-badge {
  font-size: 0.8rem;
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.map-wrapper {
  position: relative;
  width: 100%;
  height: 400px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Map Cyberpunk Dark Mode Filter Magic */
.dark-theme #map .leaflet-tile-container {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.map-overlay-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 2;
}

/* Custom Marker Styling */
.radar-marker {
  position: relative;
}

.radar-ring {
  border: 3px solid var(--purple);
  -webkit-border-radius: 30px;
  height: 40px;
  width: 40px;
  position: absolute;
  left: -15px;
  top: -15px;
  animation: pulsate 1.8s ease-out;
  animation-iteration-count: infinite; 
  opacity: 0.0;
}

.radar-dot {
  width: 12px;
  height: 12px;
  background-color: var(--purple);
  border: 2px solid #ffffff;
  border-radius: 50%;
  position: absolute;
  left: -1px;
  top: -1px;
  box-shadow: 0 0 10px var(--purple);
}

@keyframes pulsate {
  0% { transform: scale(0.1, 0.1); opacity: 0.0; }
  50% { opacity: 1.0; }
  100% { transform: scale(1.2, 1.2); opacity: 0.0; }
}

/* ==========================================================================
   CLOUDFLARE TRACE DETAILS
   ========================================================================== */

.trace-section-container {
  margin-bottom: 24px;
}

.trace-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.trace-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
}

.trace-header-code {
  color: var(--orange);
  background: var(--orange-bg);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.trace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 10px 0;
}

@media (max-width: 768px) {
  .trace-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .border-left-desktop {
    border-left: none !important;
    padding-left: 0 !important;
  }
}

.border-left-desktop {
  border-left: 1px solid var(--card-border);
  padding-left: 24px;
}

.trace-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  padding: 8px 0;
}

.trace-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.trace-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.highlight-orange {
  color: var(--orange);
  font-weight: 700;
}

.trace-raw-container {
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.2);
  margin-top: 10px;
}

.trace-raw-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--card-border);
}

.trace-raw-content {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 180px;
  overflow-y: auto;
  line-height: 1.5;
}

.btn-icon-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-icon-copy:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn-icon-copy i {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   DEVELOPER API PLAYGROUND
   ========================================================================== */

.api-playground-section {
  margin-bottom: 40px;
}

.api-card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.api-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
}

.badge-cyan {
  background: var(--cyan-bg);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.api-description {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.api-playground-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 10px;
}

@media (max-width: 992px) {
  .api-playground-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.api-playground-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.api-sub-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.api-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* API Sub-Route Nesting Layout (Collapsible by default) */
.api-sub-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 20px;
  padding-left: 16px;
  border-left: 1px dashed var(--card-border);
  position: relative;
  
  /* Collapsed states */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
  pointer-events: none;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              margin 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.api-sub-presets.expanded {
  max-height: 200px;
  opacity: 1;
  pointer-events: all;
  margin-top: 4px;
  margin-bottom: 4px;
}

/* Chevron & Dropdown Indicator Styles */
.preset-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  margin-left: auto;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
}

.api-preset-btn:hover .preset-chevron {
  color: var(--text-secondary);
}

.api-preset-btn.active .preset-chevron {
  color: var(--accent);
}

.api-preset-btn.parent-expanded .preset-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.api-preset-btn.sub-route {
  padding: 10px 14px;
  font-size: 0.85rem;
}

.sub-route-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.3s ease, transform 0.3s ease;
}

.api-preset-btn.sub-route:hover .sub-route-icon {
  color: var(--accent);
  transform: translate(2px, 2px);
}

.api-preset-btn.sub-route.active .sub-route-icon {
  color: var(--accent);
}

.text-muted-path {
  color: var(--text-muted);
  opacity: 0.55;
  font-weight: 400;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.api-preset-btn:hover .text-muted-path,
.api-preset-btn.active .text-muted-path {
  opacity: 0.85;
}

.api-preset-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .api-preset-btn {
  background: rgba(0, 0, 0, 0.02);
}

.preset-method {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--green-bg);
  color: var(--green);
  padding: 2px 6px;
  border-radius: 4px;
}

.api-preset-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text-primary);
}

.api-preset-btn.active .preset-method {
  background: var(--accent);
  color: #ffffff;
}

.api-preset-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--text-muted);
}
body.light-theme .api-preset-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.04);
}

/* Filter Builder Query Input */
.api-filter-builder {
  background: rgba(0, 0, 0, 0.15);
  border: 1px dashed var(--card-border);
  padding: 14px;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-input-group {
  display: flex;
  gap: 8px;
}

.filter-input-group input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

body.light-theme .filter-input-group input {
  background: rgba(255, 255, 255, 0.8);
}

.filter-input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Curl example block */
.api-curl-example {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.curl-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.curl-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

#curl-code-text {
  font-size: 0.85rem;
  color: var(--accent);
  background: transparent;
  padding: 0;
  border-radius: 0;
  word-break: break-all;
}

/* CLI Terminal Simulator */
.api-terminal-emulator {
  background: hsl(220, 20%, 8%);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-main);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 380px;
}

body.light-theme .api-terminal-emulator {
  background: hsl(220, 30%, 12%); /* Keeps a dark developer theme even in light mode! */
}

.terminal-header {
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-title {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
}

.btn-terminal-run {
  background: var(--green);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-terminal-run:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-terminal-run i {
  width: 12px;
  height: 12px;
}

.terminal-body {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  color: #e2e8f0;
}

.terminal-line {
  word-break: break-all;
}

.terminal-prompt {
  color: var(--cyan);
  font-weight: 700;
}

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

.terminal-output.loading {
  color: var(--orange);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(249, 115, 22, 0.2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
}

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

.terminal-json-output {
  color: #a7f3d0;
  font-size: 0.8rem;
  background: transparent;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
  border-top: 1px solid var(--card-border);
  padding: 40px 0;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-link {
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-right {
  display: flex;
  gap: 16px;
}

.footer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
}

body.light-theme .footer-badge {
  background: rgba(0, 0, 0, 0.02);
}

.footer-badge i {
  width: 14px;
  height: 14px;
}

@media (max-width: 600px) {
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/* Custom Alert Bubble & Extra Helpers */
.hidden-by-default {
  display: none !important;
}

.momentary-alert-bubble {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 50px);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--accent);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(59, 130, 246, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .momentary-alert-bubble {
  background: rgba(255, 255, 255, 0.9);
  color: hsl(224, 71%, 4%);
  border-color: var(--accent);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 0 15px rgba(59, 130, 246, 0.15);
}

.momentary-alert-bubble.alert-show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* Clickable IP Address and Secondary IP Pill */
.ip-address {
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.ip-address:hover {
  color: var(--accent);
  transform: scale(1.005);
}

.secondary-ip-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 8px 16px;
  border-radius: 40px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fade-in-up 0.5s ease forwards;
}

body.light-theme .secondary-ip-container {
  background: rgba(0, 0, 0, 0.02);
}

.secondary-ip-container:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.secondary-ip-badge {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.secondary-ip-value {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s ease;
  word-break: normal;
  overflow-wrap: break-word;
}

.secondary-ip-container:hover .secondary-ip-value {
  color: var(--text-primary);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
