/* ═══════════════════════════════════════════
   SEO Hub v2 — Global Stylesheet
   ═══════════════════════════════════════════ */

/* Custom Properties */
:root {
  --bg-deep:     #070d1a;
  --bg-card:     #0d1526;
  --bg-elevated: #111d35;
  --border:      #1e3a5f;
  --border-glow: #2563eb;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #334155;
  --accent:      #3b82f6;
  --accent-glow: rgba(59,130,246,0.15);
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --purple:      #8b5cf6;
  --cyan:        #06b6d4;

  --nav-height:   60px;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --radius-xl:    20px;
  --shadow:       0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg:    0 10px 40px rgba(0,0,0,0.5);
  --transition:   0.2s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
pre { font-family: 'Courier New', monospace; }

/* Typography */
h1 { font-size: 2rem;    font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
h2 { font-size: 1.5rem;  font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h3 { font-size: 1.125rem; font-weight: 600; color: var(--text); }
h4 { font-size: 0.9375rem; font-weight: 600; color: var(--text); }

/* Layout */
.container     { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 1.5rem; }

/* Spacing utilities */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-3 { margin-bottom: 0.75rem; }

/* ── TOP NAV ── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  min-height: var(--nav-height);
  height: var(--nav-height);
  background: rgba(7,13,26,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 2rem;
  gap: 1.25rem;
  z-index: 1000;
  box-shadow: 0 1px 16px 0 rgba(0,0,0,0.4), 0 1px 0 0 rgba(59,130,246,0.12);
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }

.nav-center { flex: 1; display: flex; justify-content: center; min-width: 0; }

.nav-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}

.version-badge {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.site-breadcrumb a { color: var(--text-muted); }
.site-breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { opacity: 0.4; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5625rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  box-shadow: 0 4px 16px rgba(59,130,246,0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-glow);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
  background: #059669;
  transform: translateY(-1px);
}

.btn-sm  { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-xs  { padding: 0.25rem 0.5rem;   font-size: 0.75rem; border-radius: var(--radius-sm); }
.btn-lg  { padding: 0.75rem 1.5rem;   font-size: 1rem; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: rgba(59,130,246,0.25); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
}
.card-header h3 { margin: 0; }
.card-subtitle { font-size: 0.8125rem; color: var(--text-muted); font-weight: 400; }

/* ── FORMS ── */
.form-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-dim); }

.form-select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.select-sm { width: auto; padding: 0.4rem 2rem 0.4rem 0.75rem; font-size: 0.8125rem; }

/* ── BADGES / PILLS ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-critical    { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-warning     { background: rgba(245,158,11,0.15);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-passed      { background: rgba(16,185,129,0.15);  color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-neutral     { background: var(--bg-elevated);     color: var(--text-muted); border: 1px solid var(--border); }
.badge-info        { background: rgba(6,182,212,0.15);   color: #22d3ee; border: 1px solid rgba(6,182,212,0.3); }

/* ── ALERTS ── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid;
}
.alert-success { background: rgba(16,185,129,0.1);  color: #6ee7b7; border-color: rgba(16,185,129,0.3); }
.alert-danger  { background: rgba(239,68,68,0.1);   color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.alert-warning { background: rgba(245,158,11,0.1);  color: #fde68a; border-color: rgba(245,158,11,0.3); }
.alert-info    { background: rgba(6,182,212,0.1);   color: #a5f3fc; border-color: rgba(6,182,212,0.3); }

/* ── TABLES ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid rgba(30,58,95,0.5);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(59,130,246,0.04); }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text); }
.sortable::after { content: ' ↕'; opacity: 0.4; font-size: 0.75em; }
.sortable.sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--accent); }
.sortable.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--accent); }

.url-cell {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.url-cell:hover { color: var(--text); }

/* ── SCORE ELEMENTS ── */
.score-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.8125rem;
}

/* ── CONNECTION STATUS DOTS ── */
.conn-dot {
  font-size: 0.8125rem;
  font-weight: 500;
}
.conn-active  { color: var(--success); }
.conn-inactive { color: var(--text-dim); }

/* ── STATUS DOTS ── */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.active  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.idle    { background: var(--text-dim); }
.status-dot.running { background: var(--warning); box-shadow: 0 0 6px var(--warning); animation: pulse 1s ease-in-out infinite; }
.status-dot.error   { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── LOADING SPINNER ── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid rgba(59,130,246,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-sm {
  width: 16px; height: 16px;
  border-width: 2px;
}

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

/* ── TOASTS ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
  max-width: 380px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast.dismissing { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateY(10px) } to { opacity:1; transform:translateY(0) } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) } to { opacity:0; transform:translateY(10px) } }

/* ── MODALS ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn { from { opacity:0; transform:scale(0.95) } to { opacity:1; transform:scale(1) } }

.modal-icon  { font-size: 2.5rem; margin-bottom: 0.75rem; }
.modal-title { margin-bottom: 0.5rem; }
.modal-text  { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* ── PROGRESS BARS ── */
.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Crawl progress */
.crawl-progress-bar {
  height: 3px;
  background: var(--border);
  overflow: hidden;
}
.crawl-progress-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  width: 0%;
  transition: width 0.5s ease;
  animation: crawlShimmer 2s linear infinite;
}
@keyframes crawlShimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.crawl-progress-text {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-muted); max-width: 400px; margin: 0 auto; }

.empty-state-sm {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

/* ── TEXT COLOURS ── */
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-accent  { color: var(--accent); }

/* ── CHECKBOX LABEL ── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}
.checkbox-label input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── CONNECT PROMPT ── */
.connect-prompt {
  max-width: 560px;
  margin: 3rem auto;
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.connect-prompt-icon { font-size: 3rem; margin-bottom: 1rem; }
.connect-prompt h3   { font-size: 1.5rem; margin-bottom: 0.5rem; }
.connect-prompt p    { color: var(--text-muted); margin-bottom: 1.5rem; }
.connect-benefits {
  list-style: none;
  text-align: left;
  margin: 0 auto 1.5rem;
  max-width: 360px;
}
.connect-benefits li {
  padding: 0.4rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.connect-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 1rem !important;
}

/* ── SEARCH INPUT ── */
.search-input { max-width: 300px; }
.search-input-sm { max-width: 200px; padding: 0.4rem 0.75rem; font-size: 0.8125rem; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nav-center { display: none; }
  h1 { font-size: 1.5rem; }
  .btn-lg { padding: 0.625rem 1.25rem; font-size: 0.9375rem; }
}
@media (max-width: 480px) {
  .top-nav { padding: 0 1rem; }
  .container { padding: 0 1rem; }
}

/* ── HUB FOOTER ── */
.hub-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 38px;
  background: rgba(7,13,26,0.97);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  z-index: 999;
  letter-spacing: 0.02em;
}
.hub-footer strong { color: var(--text-dim); font-weight: 600; }
.hub-footer-sep { opacity: 0.3; }
/* Push main content above fixed footer */
.dashboard-main { padding-bottom: calc(38px + 2rem) !important; }
.site-main      { padding-bottom: calc(38px + 2rem) !important; }

/* ── CRAWL PROGRESS OVERLAY ── */
#crawl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,13,26,0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
#crawl-overlay.crawl-overlay-show {
  opacity: 1;
  pointer-events: all;
}
.crawl-overlay-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 0 60px rgba(59,130,246,0.15), 0 24px 48px rgba(0,0,0,0.5);
}
.crawl-spinner-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 1.25rem;
}
.crawl-spinner {
  width: 100px;
  height: 100px;
  transform: rotate(-90deg);
}
.crawl-spinner-track {
  stroke: var(--border);
}
.crawl-spinner-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 0 4px rgba(59,130,246,0.6));
}
.crawl-pct-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}
.crawl-status-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}
.crawl-bar-wrap { margin-bottom: 0.75rem; }
.crawl-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.crawl-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 3px;
  transition: width 0.6s ease;
  box-shadow: 0 0 8px rgba(59,130,246,0.5);
}
.crawl-pages-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
