/* ═══════════════════════════════════════════════════
   PagePulse Pro — Dashboard Styles
   ═══════════════════════════════════════════════════ */

.dash-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  min-height: 60vh;
}

/* ─── Loading State ─── */
.dash-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 24px;
  gap: 16px;
  color: var(--text-muted);
}
.spinner-lg {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.spinner-sm {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

/* ─── Empty / Auth / Upgrade States ─── */
.dash-empty {
  text-align: center;
  padding: 100px 24px;
}
.dash-empty-icon {
  width: 80px; height: 80px;
  border-radius: 20px;
  background: #f3f4f6;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.dash-empty h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -.02em;
}
.dash-empty p {
  color: var(--text-secondary);
  font-size: .9375rem;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ─── Upgrade Screen ─── */
.upgrade-price {
  margin-bottom: 24px;
}
.upgrade-amount {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.upgrade-interval {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}
.upgrade-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
  margin: 0 auto 28px;
  text-align: left;
}
.upgrade-feat {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--text);
}
.upgrade-feat svg { flex-shrink: 0; }
.btn-lg {
  padding: 14px 32px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}
.upgrade-note {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ─── Success Banner ─── */
.dash-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  font-size: .875rem;
  font-weight: 500;
}
.dash-banner-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.dash-banner button {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  padding: 0 4px;
}

/* ─── Stats Row ─── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.dash-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.dash-stat-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.dash-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.dash-stat-limit {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.plan-badge-pro {
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  letter-spacing: .04em;
}

/* ─── Section Headers ─── */
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dash-section-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Add URL Form ─── */
.add-url-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.add-url-input-wrap {
  flex: 1;
  display: flex;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
}
.add-url-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,.1);
}
.add-url-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 14px;
  font: 400 .9rem var(--font);
  background: transparent;
  color: var(--text);
  min-width: 0;
}
.add-url-input-wrap input::placeholder { color: var(--text-muted); }
.add-url-input-wrap select {
  border: none;
  border-left: 1px solid var(--border);
  background: #fafbfc;
  padding: 0 12px;
  font: 500 .8rem var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
}
.add-url-form .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ─── URL List ─── */
.url-list {
  margin-top: 16px;
}
.url-list-empty, .alerts-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.url-list-empty svg, .alerts-empty svg {
  color: var(--border-hover);
  margin-bottom: 12px;
}
.url-list-empty p, .alerts-empty p {
  font-size: .875rem;
  margin: 0;
}

.url-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.url-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}
.url-card-main {
  display: flex;
  align-items: center;
  gap: 16px;
}
.url-card-info { flex: 1; min-width: 0; }
.url-card-domain {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.url-card-url {
  font: 400 .75rem var(--mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
  margin-bottom: 6px;
}
.url-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.url-card-freq, .url-card-time {
  font-size: .75rem;
  color: var(--text-muted);
}
.url-card-score {
  flex-shrink: 0;
}

/* Status badges */
.status-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.status-active { background: #f0fdf4; color: #15803d; }
.status-pending { background: #fefce8; color: #a16207; }
.status-error { background: #fef2f2; color: #dc2626; }

/* Score mini badge */
.score-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
}
.score-green { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.score-yellow { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }
.score-red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.score-none { background: #f3f4f6; color: var(--text-muted); border: 1px solid var(--border); }

/* URL card actions */
.url-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}
.btn-sm {
  padding: 5px 10px;
  font-size: .75rem;
  min-height: 30px;
}
.btn-danger { color: #dc2626; }
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; }

/* ─── Alerts List ─── */
.alerts-list { margin-top: 12px; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  font-size: .8125rem;
  line-height: 1.5;
}
.alert-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 700;
  margin-top: 1px;
}
.alert-icon-error { background: #fef2f2; color: #dc2626; }
.alert-icon-warn { background: #fefce8; color: #a16207; }
.alert-icon-info { background: #eff6ff; color: #3b82f6; }
.alert-body { flex: 1; min-width: 0; }
.alert-domain {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.alert-message {
  color: var(--text-secondary);
  white-space: pre-line;
}
.alert-time {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .add-url-form {
    flex-direction: column;
  }
  .url-card-url {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .dash-main {
    padding: 16px 16px 60px;
  }
  .dash-stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .dash-stat {
    padding: 12px 14px;
  }
  .dash-stat-value {
    font-size: 1.25rem;
  }
}
