/* ═══════════════════════════════════════════════
   SEO Command Center — Custom Styles
   ═══════════════════════════════════════════════ */

/* ── Spinner ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(201, 168, 76, 0.15);
  border-top-color: #C9A84C;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Nav Items ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #94a3b8;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  text-align: left;
}
.nav-item:hover {
  color: #e2e8f0;
  background: rgba(45, 66, 120, 0.3);
}
.nav-item.active {
  color: #C9A84C;
  background: rgba(201, 168, 76, 0.1);
}
.nav-item.active svg {
  color: #C9A84C;
}

/* ── Cards ── */
.card {
  background: #162540;
  border: 1px solid rgba(45, 66, 120, 0.3);
  border-radius: 0.75rem;
  padding: 1.25rem;
}
.card-hover {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card-hover:hover {
  border-color: rgba(201, 168, 76, 0.25);
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.08);
}

/* ── Severity Badges ── */
.severity-critical {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.severity-warning {
  background: rgba(234, 179, 8, 0.12);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.2);
}
.severity-info {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ── Priority Dots ── */
.priority-high   { background: #ef4444; }
.priority-medium { background: #eab308; }
.priority-low    { background: #22c55e; }

/* ── Kanban Column ── */
.kanban-col {
  background: rgba(13, 27, 46, 0.5);
  border: 1px solid rgba(45, 66, 120, 0.2);
  border-radius: 0.75rem;
  min-height: 200px;
}
.kanban-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(45, 66, 120, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-header h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kanban-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Task Cards ── */
.task-card {
  background: #162540;
  border: 1px solid rgba(45, 66, 120, 0.3);
  border-radius: 0.5rem;
  padding: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.task-card:hover {
  border-color: rgba(201, 168, 76, 0.35);
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.08);
}

/* ── Task Tags ── */
.task-tag {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(45, 66, 120, 0.3);
  border: 1px solid rgba(45, 66, 120, 0.25);
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
  white-space: nowrap;
}

/* ── Task Modal ── */
.task-modal-box {
  background: #162540;
  border: 1px solid rgba(45, 66, 120, 0.4);
  border-radius: 1rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 168, 76, 0.05);
  animation: modalIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Filter Selects & Inputs ── */
.filter-select {
  background: #1B2A4A;
  border: 1px solid rgba(45, 66, 120, 0.4);
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: #e2e8f0;
  transition: border-color 0.15s ease;
}
.filter-select:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.1);
}

/* ── Settings ── */
.settings-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}
.settings-input {
  width: 100%;
  background: #0d1b2e;
  border: 1px solid rgba(45, 66, 120, 0.4);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: #e2e8f0;
  transition: border-color 0.15s ease;
}
.settings-input:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.1);
}
.settings-input::placeholder {
  color: #475569;
}

/* ── Buttons ── */
.btn-gold {
  background: #C9A84C;
  color: #0d1b2e;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  transition: background 0.15s ease;
}
.btn-gold:hover {
  background: #e2b86a;
}
.btn-outline {
  border: 1px solid rgba(45, 66, 120, 0.4);
  color: #94a3b8;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}
.btn-outline:hover {
  border-color: rgba(201, 168, 76, 0.4);
  color: #C9A84C;
}

/* ── Rankings Table ── */
.rankings-table {
  width: 100%;
  border-collapse: collapse;
}
.rankings-table thead {
  background: #0d1b2e;
}
.rankings-table th {
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  text-align: left;
  border-bottom: 1px solid rgba(45, 66, 120, 0.2);
}
.rankings-table td {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(45, 66, 120, 0.12);
}
.rankings-table tbody tr {
  transition: background 0.1s ease;
}
.rankings-table tbody tr:hover {
  background: rgba(45, 66, 120, 0.15);
}
.rankings-table .opportunity {
  background: rgba(201, 168, 76, 0.05);
}
.rankings-table .opportunity:hover {
  background: rgba(201, 168, 76, 0.1);
}

/* ── Rank Change ── */
.rank-up   { color: #22c55e; }
.rank-down { color: #ef4444; }
.rank-flat { color: #64748b; }

/* ── Stats Cards ── */
.stat-card {
  background: #162540;
  border: 1px solid rgba(45, 66, 120, 0.3);
  border-radius: 0.75rem;
  padding: 1rem;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1;
}
.stat-label {
  font-size: 0.6875rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

/* ── Health Issue Row ── */
.issue-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(45, 66, 120, 0.12);
  transition: background 0.1s ease;
}
.issue-row:hover {
  background: rgba(45, 66, 120, 0.1);
}
.issue-row:last-child {
  border-bottom: none;
}

/* ── Core Web Vitals Gauges ── */
.vitals-gauge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
}
.vitals-good    { background: conic-gradient(#22c55e var(--pct), rgba(34,197,94,0.12) 0); color: #22c55e; }
.vitals-needs   { background: conic-gradient(#eab308 var(--pct), rgba(234,179,8,0.12) 0); color: #eab308; }
.vitals-poor    { background: conic-gradient(#ef4444 var(--pct), rgba(239,68,68,0.12) 0); color: #ef4444; }

/* ── Report Card ── */
.report-card {
  background: #162540;
  border: 1px solid rgba(45, 66, 120, 0.3);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.15s ease;
  cursor: pointer;
}
.report-card:hover {
  border-color: rgba(201, 168, 76, 0.3);
}

/* ── Toast ── */
.toast-success {
  background: rgba(22, 101, 52, 0.9);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}
.toast-error {
  background: rgba(127, 29, 29, 0.9);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.toast-info {
  background: rgba(30, 58, 138, 0.9);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

/* ── Module Panel ── */
.module-panel {
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(45, 66, 120, 0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(45, 66, 120, 0.6); }

/* ── Responsive ── */
@media (max-width: 768px) {
  aside { display: none; }
}

/* ═══════════════════════════════════════════════
   REPORT LIBRARY
   ═══════════════════════════════════════════════ */

/* ── Library Section (collapsible group) ── */
.lib-section {
  background: #162540;
  border: 1px solid rgba(45, 66, 120, 0.25);
  border-radius: 0.75rem;
  overflow: hidden;
}
.lib-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}
.lib-section-header:hover {
  background: rgba(45, 66, 120, 0.15);
}
.lib-count {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  background: rgba(45, 66, 120, 0.4);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.lib-section-body {
  border-top: 1px solid rgba(45, 66, 120, 0.2);
}

/* ── Report card in list view ── */
.lib-report-card {
  width: 100%;
  background: rgba(13, 27, 46, 0.4);
  border: 1px solid rgba(45, 66, 120, 0.2);
  border-radius: 0.5rem;
  padding: 0.75rem;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.lib-report-card:hover {
  border-color: rgba(201, 168, 76, 0.35);
  background: rgba(201, 168, 76, 0.04);
}

/* ── QA report list item ── */
.lib-qa-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  transition: background 0.1s ease;
  text-align: left;
  cursor: pointer;
}
.lib-qa-item:hover {
  background: rgba(45, 66, 120, 0.2);
}

/* ── Brand badges ── */
.lib-brand-badge {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.lib-brand-el  {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}
.lib-brand-rpl {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ── line-clamp polyfill ── */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════
   MARKDOWN CONTENT RENDERER
   ═══════════════════════════════════════════════ */
.md-content {
  color: #cbd5e1;
  font-size: 0.9375rem;
  line-height: 1.75;
  max-width: none;
}

.md-content h1 {
  font-size: 1.625rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 2rem 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(45, 66, 120, 0.35);
  line-height: 1.3;
}
.md-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid rgba(45, 66, 120, 0.2);
  line-height: 1.35;
}
.md-content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #cbd5e1;
  margin: 1.5rem 0 0.625rem;
  line-height: 1.4;
}
.md-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #94a3b8;
  margin: 1.25rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.md-content h5, .md-content h6 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #94a3b8;
  margin: 1rem 0 0.5rem;
}
.md-content h1:first-child,
.md-content h2:first-child,
.md-content h3:first-child {
  margin-top: 0;
}

.md-content p {
  margin: 0 0 1rem;
}
.md-content p:last-child {
  margin-bottom: 0;
}

.md-content ul, .md-content ol {
  margin: 0.75rem 0 1rem;
  padding-left: 1.5rem;
}
.md-content li {
  margin-bottom: 0.35rem;
}
.md-content ul li { list-style-type: disc; }
.md-content ul ul li { list-style-type: circle; }
.md-content ol li { list-style-type: decimal; }
.md-content li > ul, .md-content li > ol {
  margin: 0.25rem 0;
}

.md-content strong, .md-content b {
  color: #f1f5f9;
  font-weight: 600;
}
.md-content em, .md-content i {
  color: #94a3b8;
  font-style: italic;
}

.md-content a {
  color: #C9A84C;
  text-decoration: underline;
  text-decoration-color: rgba(201, 168, 76, 0.4);
  transition: color 0.15s ease;
}
.md-content a:hover {
  color: #e2b86a;
}

.md-content hr {
  border: none;
  border-top: 1px solid rgba(45, 66, 120, 0.3);
  margin: 1.75rem 0;
}

.md-content blockquote {
  border-left: 3px solid #C9A84C;
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1rem 0;
  background: rgba(201, 168, 76, 0.04);
  border-radius: 0 0.375rem 0.375rem 0;
  color: #94a3b8;
  font-style: italic;
}

.md-content pre {
  background: #0d1b2e;
  border: 1px solid rgba(45, 66, 120, 0.3);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  font-family: 'Fira Mono', 'Cascadia Code', 'Consolas', monospace;
}
.md-content pre code {
  background: none;
  padding: 0;
  border: none;
  color: #7dd3fc;
  font-size: inherit;
}

.md-content code {
  background: rgba(13, 27, 46, 0.7);
  border: 1px solid rgba(45, 66, 120, 0.35);
  border-radius: 0.25rem;
  padding: 0.1em 0.4em;
  font-size: 0.8125rem;
  color: #7dd3fc;
  font-family: 'Fira Mono', 'Cascadia Code', 'Consolas', monospace;
}

.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.875rem;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid rgba(45, 66, 120, 0.25);
}
.md-content thead {
  background: #0d1b2e;
}
.md-content th {
  padding: 0.625rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  text-align: left;
  border-bottom: 1px solid rgba(45, 66, 120, 0.25);
}
.md-content td {
  padding: 0.5625rem 1rem;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(45, 66, 120, 0.12);
  vertical-align: top;
}
.md-content tbody tr:nth-child(even) {
  background: rgba(13, 27, 46, 0.3);
}
.md-content tbody tr:hover {
  background: rgba(45, 66, 120, 0.15);
}
.md-content tbody tr:last-child td {
  border-bottom: none;
}

/* Fallback pre (when marked not available) */
.md-fallback {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  font-size: 0.8125rem;
  color: #94a3b8;
}
