/* ─── MailProbe Design System ──────────────────────────────── */
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a26;
  --surface-3: #222233;
  --border: #2a2a3a;
  --border-hover: #3a3a4a;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --text-muted: #555570;
  --accent: #22d67a;
  --accent-dim: #1a9e5a;
  --accent-bg: rgba(34, 214, 122, 0.08);
  --accent-border: rgba(34, 214, 122, 0.25);
  --red: #f04848;
  --red-dim: #c03030;
  --red-bg: rgba(240, 72, 72, 0.08);
  --red-border: rgba(240, 72, 72, 0.25);
  --blue: #4488ff;
  --blue-bg: rgba(68, 136, 255, 0.08);
  --yellow: #f0c040;
  --yellow-bg: rgba(240, 192, 64, 0.08);
  --yellow-border: rgba(240, 192, 64, 0.25);
  --purple: #9966ff;
}

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

body {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.mono { font-family: 'DM Mono', monospace; }

/* ─── Layout ───────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-nav-logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.app-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-nav-email {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.app-nav-link {
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

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

.app-content {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ─── Auth Pages ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  font-weight: 700;
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo a {
  color: var(--text);
  text-decoration: none;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 40px;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-family: 'DM Mono', monospace;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* ─── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
}

.alert.show { display: block; }

.alert-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
}

.alert-success {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

/* ─── Auth Footer ──────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-dim);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ─── Dashboard ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-desc {
  color: var(--text-dim);
  font-size: 15px;
  margin-top: 4px;
}

/* ─── Test Addresses Card ──────────────────────────────────── */
.addresses-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.addresses-title {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.address-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 6px;
  margin-bottom: 6px;
}

.address-row:last-child { margin-bottom: 0; }

.address-provider {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  width: 80px;
  text-transform: capitalize;
}

.address-value {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.address-copy {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.address-copy:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

/* ─── New Test Form ────────────────────────────────────────── */
.new-test-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.new-test-form {
  display: flex;
  gap: 12px;
}

.new-test-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.new-test-input:focus {
  border-color: var(--accent);
}

.new-test-input::placeholder {
  color: var(--text-muted);
}

/* ─── Tests List ───────────────────────────────────────────── */
.tests-section-title {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.test-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.test-item:hover {
  border-color: var(--accent-border);
  background: var(--surface-2);
}

.test-domain {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
}

.test-badges {
  display: flex;
  gap: 6px;
}

.test-badge {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 22px;
  text-align: center;
}

.badge-inbox { background: var(--accent-bg); color: var(--accent); }
.badge-spam { background: var(--red-bg); color: var(--red); }
.badge-promo { background: var(--yellow-bg); color: var(--yellow); }
.badge-analyzing { background: var(--blue-bg); color: var(--blue); }

.test-time {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.test-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* ─── Results Page ─────────────────────────────────────────── */
.results-header {
  margin-bottom: 32px;
}

.results-domain {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.results-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.analyzing {
  background: var(--blue);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.complete { background: var(--accent); }
.status-dot.failed { background: var(--red); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── Provider Results Cards ───────────────────────────────── */
.results-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  transition: border-color 0.2s;
}

.result-card:hover {
  border-color: var(--border-hover);
}

.result-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.result-provider {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  width: 100px;
}

.result-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
}

.result-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 0;
}

.result-bar.inbox { background: var(--accent); }
.result-bar.spam { background: var(--red); }
.result-bar.promo { background: var(--yellow); }

.result-placement {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 4px;
  min-width: 80px;
  text-align: center;
  font-weight: 500;
}

.placement-inbox { background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-border); }
.placement-spam { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.placement-promo { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }

.result-score {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  width: 45px;
  text-align: right;
}

/* Breakdown Details */
.result-details {
  display: none;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.result-card.expanded .result-details { display: block; }

.detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.detail-label {
  font-family: 'DM Mono', monospace;
  color: var(--text-dim);
  width: 60px;
  font-size: 12px;
}

.detail-bar-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
}

.detail-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.8s ease;
}

.detail-value {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  width: 50px;
  text-align: right;
}

.detail-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}

.detail-check.pass { color: var(--accent); }
.detail-check.fail { color: var(--red); }
.detail-check.warn { color: var(--yellow); }

/* Recommendations */
.recs-section {
  margin-top: 16px;
}

.recs-title {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.rec-item {
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 0;
  padding-left: 16px;
  position: relative;
}

.rec-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

/* ─── DNS Summary ──────────────────────────────────────────── */
.dns-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.dns-title {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.dns-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dns-item {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.dns-item-label {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.dns-item-status {
  font-weight: 600;
  font-size: 14px;
}

.dns-item-status.pass { color: var(--accent); }
.dns-item-status.fail { color: var(--red); }
.dns-item-status.warn { color: var(--yellow); }

/* ─── Spinner ──────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 24px;
  color: var(--text-dim);
}

/* ─── Back Link ────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.2s;
}

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

/* ─── Overall Score ────────────────────────────────────────── */
.overall-score {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
}

.score-circle.good { background: var(--accent-bg); color: var(--accent); border: 2px solid var(--accent-border); }
.score-circle.medium { background: var(--yellow-bg); color: var(--yellow); border: 2px solid var(--yellow-border); }
.score-circle.poor { background: var(--red-bg); color: var(--red); border: 2px solid var(--red-border); }

.score-text h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.score-text p {
  font-size: 14px;
  color: var(--text-dim);
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .dns-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .new-test-form {
    flex-direction: column;
  }

  .result-card-top {
    flex-wrap: wrap;
  }

  .result-provider {
    width: auto;
    min-width: 80px;
  }

  .overall-score {
    flex-direction: column;
    text-align: center;
  }

  .address-row {
    flex-wrap: wrap;
  }

  .test-item {
    flex-wrap: wrap;
  }

  .test-badges {
    order: 3;
    width: 100%;
  }
}

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

  .app-content {
    padding: 24px 16px;
  }
}
