/* ==========================================================================
   WebDebug Pro — Native Apple macOS Sonoma Theme & UI Stylesheet
   ========================================================================== */

:root {
  /* Apple System Color Tokens */
  --mac-bg-dark: #12141a;
  --mac-window-bg: rgba(26, 29, 38, 0.78);
  --mac-card-bg: rgba(36, 40, 54, 0.65);
  --mac-card-hover: rgba(46, 52, 70, 0.85);
  --mac-border: rgba(255, 255, 255, 0.12);
  --mac-border-glow: rgba(0, 198, 255, 0.3);
  
  --apple-blue: #0a84ff;
  --apple-green: #30d158;
  --apple-yellow: #ffd60a;
  --apple-orange: #ff9f0a;
  --apple-red: #ff453a;
  --apple-purple: #bf5af2;
  --apple-cyan: #64d2ff;

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.72);
  --text-muted: rgba(255, 255, 255, 0.45);

  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Monaco', monospace;

  --shadow-window: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius-window: 18px;
  --radius-card: 14px;
  --radius-pill: 999px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--mac-bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* macOS Dynamic Wallpaper Background */
.mac-os-wallpaper {
  width: 100%;
  max-width: 1280px;
  min-height: 90vh;
  position: relative;
  border-radius: var(--radius-window);
  background: radial-gradient(circle at 15% 15%, rgba(10, 132, 255, 0.18), transparent 45%),
              radial-gradient(circle at 85% 85%, rgba(191, 90, 242, 0.18), transparent 45%),
              radial-gradient(circle at 50% 50%, rgba(48, 209, 88, 0.08), transparent 60%);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* macOS Window Frame */
.mac-window {
  width: 100%;
  background: var(--mac-window-bg);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  border: 1px solid var(--mac-border);
  border-radius: var(--radius-window);
  box-shadow: var(--shadow-window);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: windowFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Window Titlebar */
.mac-titlebar {
  height: 48px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--mac-border);
  display: grid;
  grid-template-columns: 80px 1fr 120px;
  align-items: center;
  padding: 0 16px;
  user-select: none;
}

.mac-traffic-lights {
  display: flex;
  gap: 8px;
}

.mac-traffic-lights .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.mac-traffic-lights .dot:hover {
  filter: brightness(1.2);
  transform: scale(1.1);
}

.mac-traffic-lights .close { background-color: #ff5f56; border: 1px solid #e0443e; }
.mac-traffic-lights .minimize { background-color: #ffbd2e; border: 1px solid #dea123; }
.mac-traffic-lights .zoom { background-color: #27c93f; border: 1px solid #1aab29; }

.mac-window-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mac-app-icon {
  width: 16px;
  height: 16px;
  color: var(--apple-blue);
}

.mac-window-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.pulse-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--apple-green);
  box-shadow: 0 0 8px var(--apple-green);
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Content Area */
.mac-content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero Search Card */
.hero-search-card {
  background: var(--mac-card-bg);
  border: 1px solid var(--mac-border);
  border-radius: var(--radius-card);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.hero-search-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(10, 132, 255, 0.15);
  border: 1px solid rgba(10, 132, 255, 0.3);
  color: var(--apple-cyan);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 14px;
}

.hero-search-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 24px;
}

/* URL Input Form */
.url-input-group {
  display: flex;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto 20px;
}

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

.url-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.input-wrapper input {
  width: 100%;
  height: 48px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 0 42px 0 46px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
}

.input-wrapper input:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
  background: rgba(0, 0, 0, 0.5);
}

.btn-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  display: none;
}

.btn-clear:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.btn-diagnose {
  height: 48px;
  padding: 0 24px;
  background: linear-gradient(135deg, var(--apple-blue) 0%, #0066cc 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(10, 132, 255, 0.4);
  transition: all 0.2s ease;
}

.btn-diagnose:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(10, 132, 255, 0.55);
}

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

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

/* Preset Chips */
.preset-scenarios {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.preset-label {
  font-size: 12px;
  color: var(--text-muted);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
  color: var(--text-primary);
}

.chip-danger:hover { border-color: var(--apple-red); color: var(--apple-red); }
.chip-warning:hover { border-color: var(--apple-orange); color: var(--apple-orange); }
.chip-caution:hover { border-color: var(--apple-yellow); color: var(--apple-yellow); }
.chip-purple:hover { border-color: var(--apple-purple); color: var(--apple-purple); }
.chip-success:hover { border-color: var(--apple-green); color: var(--apple-green); }

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Scanning Radar & Terminal Section */
.scanning-container {
  margin-top: 10px;
}

.scanning-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

/* Radar Card */
.radar-card {
  background: var(--mac-card-bg);
  border: 1px solid var(--mac-border);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.radar-circle-outer {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid rgba(100, 210, 255, 0.25);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(10, 132, 255, 0.05) 0%, transparent 70%);
}

.radar-circle-mid {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 1px dashed rgba(100, 210, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-circle-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid rgba(100, 210, 255, 0.3);
}

.radar-crosshair-v {
  position: absolute;
  width: 1px;
  height: 100%;
  background: rgba(100, 210, 255, 0.15);
}

.radar-crosshair-h {
  position: absolute;
  height: 1px;
  width: 100%;
  background: rgba(100, 210, 255, 0.15);
}

.radar-beam {
  position: absolute;
  width: 50%;
  height: 50%;
  top: 0; right: 0;
  transform-origin: bottom left;
  background: conic-gradient(from 0deg at 0% 100%, rgba(100, 210, 255, 0.6) 0deg, transparent 60deg);
  border-radius: 0 100% 0 0;
  animation: radarSweep 2s linear infinite;
}

@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-ping-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 10px var(--apple-green);
  animation: pingPulse 1.5s ease-out infinite;
}

.dot-1 { top: 30px; right: 40px; }
.dot-2 { bottom: 40px; left: 35px; animation-delay: 0.75s; }

@keyframes pingPulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.radar-status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.radar-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--apple-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* macOS Terminal Card */
.terminal-card {
  background: #0d0f14;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

.terminal-header {
  height: 34px;
  background: #181b24;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}
.terminal-dots span {
  width: 10px; height: 10px; border-radius: 50%;
}
.terminal-dots span:nth-child(1) { background: #ff5f56; }
.terminal-dots span:nth-child(2) { background: #ffbd2e; }
.terminal-dots span:nth-child(3) { background: #27c93f; }

.terminal-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.terminal-body {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #a9b7c6;
  height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-line { line-height: 1.6; }
.log-line.text-muted { color: #6272a4; }
.log-line.text-info { color: #8be9fd; }
.log-line.text-success { color: #50fa7b; }
.log-line.text-warning { color: #ffb86c; }
.log-line.text-error { color: #ff5555; }

/* Dashboard Results View */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.4s ease;
}

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

.overview-banner {
  background: var(--mac-card-bg);
  border: 1px solid var(--mac-border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.target-identity .target-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.target-identity h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 2px 0;
  color: var(--apple-cyan);
}

.target-ip {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.banner-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timestamp-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.btn-retest {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--mac-border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-retest:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Top Row Widgets Grid */
.widgets-grid-top {
  display: grid;
  grid-template-columns: 240px 280px 1fr;
  gap: 20px;
}

.widget-card {
  background: var(--mac-card-bg);
  border: 1px solid var(--mac-border);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.widget-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Widget 1: Health Score */
.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-container {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.score-ring-progress {
  fill: none;
  stroke: var(--apple-green);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-in-out, stroke 0.5s ease;
}

.score-number-wrapper {
  position: absolute;
  display: flex;
  align-items: baseline;
}

.score-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
}

.score-max {
  font-size: 12px;
  color: var(--text-muted);
}

.score-status-tag {
  margin-top: 14px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

/* Widget 2: Latency Speedometer */
.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-container {
  position: relative;
  width: 180px;
  height: 95px;
}

.speedometer {
  width: 100%;
  height: 100%;
}

.gauge-needle-group {
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 100px 100px;
}

.gauge-reading {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  text-align: center;
}

.gauge-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.gauge-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 2px;
}

.gauge-ticks {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 10px;
  margin-top: 10px;
  color: var(--text-muted);
}

/* Widget 3: Metrics List */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 13px;
}

.m-label { color: var(--text-secondary); }
.m-value { font-weight: 600; color: var(--text-primary); }

.badge-pill {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
}

/* Bottom Diagnosis & Tech Records Section */
.diagnosis-wrapper {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.main-diagnosis-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.diag-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.diag-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.diag-icon-box.status-critical { background: rgba(255, 69, 58, 0.2); color: var(--apple-red); }
.diag-icon-box.status-warning { background: rgba(255, 159, 10, 0.2); color: var(--apple-orange); }
.diag-icon-box.status-excellent { background: rgba(48, 209, 88, 0.2); color: var(--apple-green); }

.diag-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.diag-issue-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.diag-body-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.25);
  padding: 16px;
  border-radius: 10px;
  border-left: 3px solid var(--apple-blue);
}

/* Apple Segmented Control */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.seg-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Solutions List */
.solution-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.solution-list li {
  position: relative;
  padding: 12px 14px 12px 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.solution-list li::before {
  content: "💡";
  position: absolute;
  left: 14px;
  top: 12px;
  font-size: 14px;
}

/* Tech Records Card */
.tech-sub-section {
  margin-bottom: 20px;
}

.tech-sub-section h4 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.records-box {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #a9b7c6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
}

.latency-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.time-item.highlight {
  border-left: 3px solid var(--apple-yellow);
  background: rgba(255, 214, 10, 0.1);
  color: var(--text-primary);
}

/* Footer Statusbar */
.mac-statusbar {
  height: 32px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid var(--mac-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  font-size: 11px;
  color: var(--text-muted);
}

.footer-left {
  display: flex;
  gap: 8px;
}

/* Responsive Layout */
@media (max-width: 1024px) {
  .widgets-grid-top { grid-template-columns: 1fr; }
  .diagnosis-wrapper { grid-template-columns: 1fr; }
  .scanning-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { padding: 8px; }
  .mac-content { padding: 16px; }
  .hero-search-card { padding: 20px 14px; }
  .url-input-group { flex-direction: column; }
  .btn-diagnose { width: 100%; justify-content: center; }
}
