:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(24, 33, 53, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

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

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.glow-1 {
  top: -100px;
  right: -50px;
  background: radial-gradient(circle, #4338ca, transparent);
}
.glow-2 {
  bottom: -100px;
  left: -50px;
  background: radial-gradient(circle, #0e7490, transparent);
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(10, 14, 23, 0.8);
  border-bottom: 1px solid var(--border-subtle);
}
.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #c7d2fe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.badge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
}
.dot.pulse {
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--accent-emerald); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
  position: relative;
  z-index: 10;
}

/* Scanner Card */
.scanner-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm), var(--shadow-glow);
  margin-bottom: 32px;
  transition: border-color 0.2s ease;
}
.scanner-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}
.scanner-card-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.scanner-card-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.scan-form {
  margin-bottom: 20px;
}
.input-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  background: rgba(10, 14, 23, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  transition: all 0.2s ease;
}
.input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.search-icon {
  margin-left: 12px;
  color: var(--text-dim);
}
.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 1.05rem;
  font-family: inherit;
  padding: 12px 14px;
}
.input-wrapper input::placeholder {
  color: var(--text-dim);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Presets */
.preset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.preset-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 500;
}
.preset-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 4px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.preset-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-main);
  border-color: rgba(99, 102, 241, 0.4);
}
.preset-chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: white;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 60px 20px;
}
.radar-pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  border: 2px solid var(--accent-primary);
  margin: 0 auto 20px;
  animation: radar 1.5s infinite ease-out;
}
@keyframes radar {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.loading-subtext {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Target Banner */
.target-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.target-badge-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}
.target-heading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.current-target-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
}
.shared-infra-tag {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.target-banner-right {
  display: flex;
  align-items: center;
  gap: 24px;
}
.target-meta-item {
  display: flex;
  flex-direction: column;
}
.target-meta-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}
.target-meta-val {
  font-size: 0.88rem;
  font-family: 'JetBrains Mono', monospace;
  color: #cbd5e1;
}

/* Overview Grid */
.overview-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 992px) {
  .overview-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, border-color 0.2s;
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}
.score-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.card-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.score-display {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}
.gauge-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}
.gauge-fill {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 1s ease-in-out, stroke 0.5s;
}
.gauge-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.score-num {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.score-max {
  font-size: 0.65rem;
  color: var(--text-dim);
}
.grade-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.grade-badge {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  width: fit-content;
}
.posture-summary {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-ssl {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
}
.icon-waf {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
}
.icon-dmarc {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
}
.metric-info {
  display: flex;
  flex-direction: column;
}
.metric-val {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 2px;
}
.metric-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  padding: 12px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}
.tab-count {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}
.tab-pane.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.pane-header {
  margin-bottom: 20px;
}
.pane-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.pane-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Findings List */
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.finding-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
}
.finding-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}
.finding-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.finding-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.finding-title {
  font-size: 1rem;
  font-weight: 600;
}
.severity-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.sev-critical, .sev-high {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.sev-medium {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.sev-low {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.sev-informational {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(156, 163, 175, 0.3);
}
.finding-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.remedy-box {
  background: rgba(0, 0, 0, 0.4);
  border-left: 3px solid var(--accent-primary);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.remedy-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--accent-primary);
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}
.remedy-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #a5b4fc;
}

/* Headers Table */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.headers-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.headers-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
}
.headers-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  vertical-align: middle;
}
.headers-table tr:last-child td {
  border-bottom: none;
}
.header-key {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.86rem;
  font-weight: 500;
  color: #cbd5e1;
}

/* Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.status-pass {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.status-fail {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.25);
}
.status-warn {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.header-val-box {
  max-width: 600px;
  word-break: break-all;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* SSL Grid & Details */
.ssl-grid, .dns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .ssl-grid, .dns-grid {
    grid-template-columns: 1fr;
  }
}
.details-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
}
.details-card.full-width {
  grid-column: 1 / -1;
}
.details-card h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #e2e8f0;
}
.prop-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prop-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}
.prop-name {
  color: var(--text-dim);
  font-weight: 500;
}
.code-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 8px;
  border-radius: 4px;
  color: #93c5fd;
  word-break: break-all;
}
.badge-pill {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.8rem;
}
.days-pill {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent-amber);
}
.progress-bar-wrapper {
  margin-top: 24px;
}
.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-emerald));
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

/* DNS styles */
.code-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #a5b4fc;
  word-break: break-all;
  margin-bottom: 8px;
}
.dns-note {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.ip-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.ip-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ip-type {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ip-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 3px 8px;
  color: #e2e8f0;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  margin-top: 60px;
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* Additional Responsiveness Improvements */
@media (max-width: 480px) {
  /* Reduce padding on cards and containers */
  .scanner-card {
    padding: 20px;
  }
  .main-container {
    padding: 0 12px;
    margin: 20px auto;
  }
  .app-header .header-container {
    padding: 12px 16px;
  }
  /* Smaller font sizes */
  .brand-text h1 {
    font-size: 1.1rem;
  }
  .scanner-card-header h2 {
    font-size: 1.25rem;
  }
  .current-target-name {
    font-size: 1.2rem;
  }
  .metric-card {
    padding: 16px;
  }
  .score-display {
    gap: 12px;
  }
  .gauge-wrapper {
    width: 60px;
    height: 60px;
  }
  .score-num {
    font-size: 1.1rem;
  }
  .tab-btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  .finding-card {
    padding: 16px;
  }
  .details-card {
    padding: 18px;
  }
}