@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-deep: #060913;
  --bg-dark: #0a0e1a;
  --bg-panel: rgba(16, 22, 40, 0.65);
  --bg-panel-hover: rgba(22, 30, 54, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  
  --accent-cyan: #00f2fe;
  --accent-teal: #4facfe;
  --accent-violet: #8b5cf6;
  --accent-violet-light: #a78bfa;
  
  --state-warn: #f59e0b;
  --state-danger: #ef4444;
  --state-success: #10b981;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  --font-primary: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius: 16px;
  --radius-sm: 8px;
  
  --shadow-glow: 0 8px 32px 0 rgba(0, 242, 254, 0.05);
  --shadow-violet-glow: 0 8px 32px 0 rgba(139, 92, 246, 0.08);
}

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

body {
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 0%, rgba(0, 242, 254, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  border: 2px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

.header-nav {
  height: 70px;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo-text {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: inherit;
  line-height: inherit;
}

.logo span {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tab-nav {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.tab-nav-btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-nav-btn.active {
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.status-dot.online {
  background: var(--state-success);
  box-shadow: 0 0 10px var(--state-success);
}

.status-dot.offline {
  background: var(--state-danger);
  box-shadow: 0 0 10px var(--state-danger);
}

/* ── PANELS (GLASSMORPHISM) ── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 30px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glass-hover), transparent);
}

.panel:hover {
  background: var(--bg-panel-hover);
  border-color: var(--border-glass-hover);
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title svg {
  color: var(--accent-cyan);
}

/* ── CONTAINER ── */
.main-content {
  flex: 1;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── RADIAL SIGNAL GAUGE ── */
.radial-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.radial-gauge {
  position: relative;
  width: 100px;
  height: 100px;
}

.radial-gauge svg {
  transform: rotate(-90deg);
  width: 100px;
  height: 100px;
}

.radial-gauge circle {
  fill: none;
  stroke-width: 7;
}

.radial-gauge .bg-circle {
  stroke: rgba(255, 255, 255, 0.05);
}

.radial-gauge .fill-circle {
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.4));
}

.radial-gauge .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.radial-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

/* ── AUDIT DASHBOARD ── */
.input-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.url-input-wrapper {
  flex: 1;
  position: relative;
}

.url-input-wrapper svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.input-field {
  width: 100%;
  height: 56px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 16px 12px 52px;
  font-size: 15px;
  font-family: var(--font-primary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.25s ease;
}

.input-field:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(0, 242, 254, 0.15);
}

.btn-primary {
  height: 56px;
  padding: 0 32px;
  font-size: 15px;
  font-weight: 700;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 25px rgba(0, 242, 254, 0.35);
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.gauges-panel {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding: 30px;
}

@media(max-width: 900px) {
  .gauges-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media(max-width: 600px) {
  .gauges-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── TABLES ── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.custom-table th {
  background: rgba(255, 255, 255, 0.02);
  padding: 14px 20px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-glass);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
}

.custom-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-primary);
  vertical-align: middle;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Number font styled with JetBrains Mono */
.num-data {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ── INTENT BADGES ── */
.intent-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.intent-informational {
  background: rgba(79, 172, 254, 0.08);
  color: var(--accent-teal);
  border-color: rgba(79, 172, 254, 0.2);
}

.intent-commercial {
  background: rgba(139, 92, 246, 0.08);
  color: var(--accent-violet-light);
  border-color: rgba(139, 92, 246, 0.2);
}

.intent-transactional {
  background: rgba(16, 225, 120, 0.08);
  color: var(--state-success);
  border-color: rgba(16, 225, 120, 0.2);
}

.intent-navigational {
  background: rgba(245, 158, 11, 0.08);
  color: var(--state-warn);
  border-color: rgba(245, 158, 11, 0.2);
}

/* ── HEADING HIERARCHY TREE ── */
.heading-tree-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.heading-tree-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
}

.heading-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--border-glass-hover);
  color: var(--text-primary);
}

.h-tree-h1 { border-left: 4px solid var(--accent-cyan); margin-left: 0; }
.h-tree-h2 { border-left: 4px solid var(--accent-teal); margin-left: 20px; }
.h-tree-h3 { border-left: 4px solid var(--accent-violet); margin-left: 40px; }
.h-tree-h4 { border-left: 4px solid var(--state-warn); margin-left: 60px; }
.h-tree-h5 { border-left: 4px solid var(--state-muted); margin-left: 80px; }
.h-tree-h6 { border-left: 4px solid var(--state-muted); margin-left: 100px; }

/* ── KEYWORD MAGIC TOOL ── */
.keyword-magic-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

@media(max-width: 1024px) {
  .keyword-magic-layout {
    grid-template-columns: 1fr;
  }
}

.filters-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.filter-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-chip-btn {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
}

.filter-chip-btn:hover {
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.filter-chip-btn.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-violet);
  color: var(--text-primary);
  box-shadow: var(--shadow-violet-glow);
}

.filter-chip-btn .badge-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-violet-light);
}

/* Difficulty progress bar */
.kd-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 130px;
}

.kd-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  overflow: hidden;
}

.kd-fill {
  height: 100%;
  border-radius: 99px;
}

/* Trend Sparkline */
.sparkline-svg {
  width: 70px;
  height: 20px;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── SEO WRITING ASSISTANT ── */
.writing-assistant-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
}

@media(max-width: 1100px) {
  .writing-assistant-layout {
    grid-template-columns: 1fr;
  }
}

.editor-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.editor-textarea {
  width: 100%;
  min-height: 480px;
  background: rgba(10, 14, 26, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 24px;
  font-size: 16px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: all 0.25s ease;
}

.editor-textarea:focus {
  border-color: var(--accent-cyan);
  background: rgba(10, 14, 26, 0.7);
}

.assistant-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 94px;
  height: fit-content;
}

.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.checklist-icon {
  display: flex;
  align-items: center;
}

.checklist-icon.pass { color: var(--state-success); }
.checklist-icon.fail { color: var(--state-danger); }

/* LSI keyword list styling */
.lsi-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lsi-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  cursor: default;
}

.lsi-tag.active {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--state-success);
  color: var(--text-primary);
}

.lsi-tag svg {
  width: 12px;
  height: 12px;
}

/* ── STATUS CHIPS / LABELS ── */
.status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-ok { background: rgba(16, 185, 129, 0.1); color: var(--state-success); }
.status-broken { background: rgba(239, 68, 68, 0.1); color: var(--state-danger); }

/* ── EXPORT BUTTON ── */
.btn-secondary {
  height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-glass-hover);
}

/* ── SHADOW DIVIDERS / SUB-TITLES ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.section-divider .line {
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

.section-divider .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

/* ── MAIN LOADER ── */
.big-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  gap: 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── PRINT MEDIA STYLING ── */
/* ── TAB VIEW SWITCHING ── */
.tab-view {
  display: none;
}

.tab-view.active-view {
  display: block;
  animation: fadeSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ── UTILITY CLASSES ── */
.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

.text-secondary {
  color: var(--text-secondary);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mb-16 {
  margin-bottom: 16px;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 24px !important;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .competitor-grid {
    grid-template-columns: 1fr !important;
  }
  .header-nav {
    padding: 0 20px;
    gap: 12px;
  }
  .tab-nav {
    flex-wrap: wrap;
  }
  .main-content {
    padding: 24px 16px;
  }
}

@media (max-width: 768px) {
  .header-nav {
    height: auto;
    flex-direction: column;
    padding: 12px 16px;
    gap: 8px;
  }
  .tab-nav-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .connection-status {
    display: none;
  }
  .input-row {
    flex-direction: column;
  }
  .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

/* ── PRINT MEDIA STYLING ── */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .header-nav, .tab-nav, .connection-status, .btn-primary, .btn-secondary, .url-input-wrapper, .input-row {
    display: none !important;
  }
  .panel {
    background: #fff !important;
    border: 1px solid #ddd !important;
    color: #000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
  .panel-title, .panel-title svg {
    color: #000 !important;
  }
  .radial-gauge circle.bg-circle {
    stroke: #eee !important;
  }
  .radial-gauge circle.fill-circle {
    filter: none !important;
  }
  .custom-table th {
    background: #f5f5f5 !important;
    color: #333 !important;
    border-bottom: 2px solid #ddd !important;
  }
  .custom-table td {
    border-bottom: 1px solid #ddd !important;
    color: #000 !important;
  }
}
