/* SEO-DASH Theme - Dark Premium Dashboard */

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0d1220;
  --bg-card: #111827;
  --bg-card-hover: #151d2e;
  --border-color: rgba(55, 65, 81, 0.4);
  --border-light: rgba(55, 65, 81, 0.2);
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-orange: #f97316;
  --gradient-cyan: linear-gradient(135deg, #06b6d4, #3b82f6);
  --gradient-green: linear-gradient(135deg, #10b981, #059669);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #6366f1);
  --gradient-orange: linear-gradient(135deg, #f97316, #f59e0b);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(55, 65, 81, 0.5) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(55, 65, 81, 0.5); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(75, 85, 101, 0.7); }

body { 
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* Dashboard Cards */
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.dash-card:hover {
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.05);
}

.dash-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-card-header h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.dash-card-body {
  padding: 20px;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card.cyan::before { background: var(--gradient-cyan); }
.stat-card.green::before { background: var(--gradient-green); }
.stat-card.purple::before { background: var(--gradient-purple); }
.stat-card.orange::before { background: var(--gradient-orange); }

.stat-card:hover {
  border-color: rgba(6, 182, 212, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin: 4px 0;
}

.stat-change {
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 6px;
}

.stat-change.positive {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.stat-change.negative {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.stat-change.neutral {
  color: var(--text-muted);
  background: rgba(107, 114, 128, 0.1);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-icon.cyan { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.stat-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--accent-purple); }
.stat-icon.orange { background: rgba(249, 115, 22, 0.12); color: var(--accent-orange); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.stat-icon.pink { background: rgba(236, 72, 153, 0.12); color: var(--accent-pink); }

/* Navigation */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.nav-link.active i {
  color: var(--accent-cyan);
}

/* Buttons */
.dash-btn {
  background: var(--gradient-cyan);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

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

.dash-btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

.dash-btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dash-btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Tables */
.dash-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.dash-table thead th {
  background: rgba(17, 24, 39, 0.8);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.dash-table thead th:hover {
  color: var(--accent-cyan);
}

.dash-table thead th.sorted-asc::after { content: ' ▲'; color: var(--accent-cyan); }
.dash-table thead th.sorted-desc::after { content: ' ▼'; color: var(--accent-cyan); }

.dash-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

.dash-table tbody tr {
  transition: background 0.15s ease;
}

.dash-table tbody tr:hover {
  background: rgba(6, 182, 212, 0.03);
}

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

/* Position badges */
.pos-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.pos-badge.top3 {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pos-badge.top10 {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.pos-badge.top20 {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.pos-badge.beyond20 {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.pos-badge.not-ranked {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

/* Change indicators */
.change-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

.change-indicator.up { color: var(--accent-green); }
.change-indicator.down { color: var(--accent-red); }
.change-indicator.same { color: var(--text-muted); }

/* Progress bars */
.progress-bar {
  height: 6px;
  background: rgba(55, 65, 81, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Input fields */
.dash-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  outline: none;
}

.dash-input:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

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

.dash-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(6, 182, 212, 0.2); }
  50% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.4); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.3s ease;
  min-width: 300px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(55, 65, 81, 0.2) 25%, rgba(55, 65, 81, 0.4) 50%, rgba(55, 65, 81, 0.2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

/* Chart Container */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

/* Responsive */
@media (max-width: 1024px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  main {
    margin-left: 0 !important;
  }
}

/* Tag badges */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag.running {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.tag.completed {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.tag.paused {
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
}

/* Metric bar */
.metric-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-bar .bar-track {
  flex: 1;
  height: 8px;
  background: rgba(55, 65, 81, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.metric-bar .bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.metric-bar .bar-fill.cyan { background: var(--gradient-cyan); }
.metric-bar .bar-fill.green { background: var(--gradient-green); }
.metric-bar .bar-fill.purple { background: var(--gradient-purple); }
.metric-bar .bar-fill.orange { background: var(--gradient-orange); }

/* ===== GSC TAB NAVIGATION ===== */
.gsc-tab {
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.gsc-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.gsc-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

/* ===== INSIGHT LABELS ===== */
.insight-label {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.insight-label.fast-top10 {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.insight-label.page2 {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.insight-label.low-ctr {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.insight-label.high-imp {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.insight-label.brand {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.insight-label.non-brand {
  background: rgba(236, 72, 153, 0.12);
  color: var(--accent-pink);
  border: 1px solid rgba(236, 72, 153, 0.25);
}

/* ===== KW SUBTAB ACTIVE ===== */
.kw-subtab.active,
.pg-subtab.active {
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
  background: rgba(6, 182, 212, 0.08) !important;
}

/* ===== LARGE CHART CONTAINER ===== */
.chart-container-lg {
  position: relative;
  width: 100%;
  height: 320px;
}

/* ===== SCATTER CHART TWEAKS ===== */
.scatter-legend {
  display: flex;
  gap: 16px;
  padding: 8px 0;
}

.scatter-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ===== PERIOD SELECTOR TWEAKS ===== */
.gsc-period {
  transition: all 0.15s ease;
}
.gsc-period:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

/* ===== INSIGHT CARDS HOVER ===== */
.dash-card .insight-row:hover {
  background: rgba(6, 182, 212, 0.03);
}

/* ===== RESPONSIVE TABS ===== */
@media (max-width: 768px) {
  .gsc-tab {
    font-size: 0.7rem;
    padding: 8px 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   KEYWORD TRACKER V2 STYLES
   ═══════════════════════════════════════════════════════════════ */

/* Main Tabs (Own / Competitor 1 / Competitor 2) */
.kw-main-tab {
  padding: 10px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.kw-main-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.kw-main-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

/* Keyword Tags (inline labels) */
.kw-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 600;
  border: 1px solid;
  letter-spacing: 0.02em;
}

.kw-tag-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  border: 1px solid;
  background: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kw-tag-btn:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

/* SERP Feature Badges (inline tiny) */
.serp-feat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 0.65rem;
  background: rgba(107, 114, 128, 0.12);
  border: 1px solid rgba(107, 114, 128, 0.2);
  cursor: default;
  transition: all 0.15s ease;
}

.serp-feat-badge:hover {
  transform: scale(1.15);
}

.serp-feat-badge.owned {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.15);
}

/* SERP Feature Badges (larger, in modals) */
.serp-feat-badge-lg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(107, 114, 128, 0.1);
  border: 1px solid rgba(107, 114, 128, 0.2);
  color: var(--text-secondary);
}

.serp-feat-badge-lg.owned {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

/* Alert severity colors */
.alert-critical { border-left: 3px solid var(--accent-red); }
.alert-warning { border-left: 3px solid var(--accent-yellow); }
.alert-success { border-left: 3px solid var(--accent-green); }
.alert-info { border-left: 3px solid var(--accent-cyan); }

/* Keyword Row Hover Enhancement */
.kw-row {
  transition: background 0.15s ease;
}
.kw-row:hover {
  background: rgba(6, 182, 212, 0.03);
}

/* Sparkline canvas container */
.kw-row canvas {
  display: block;
}

/* Competitor color dot */
.comp-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Wider modal for keyword history */
.modal-content.wide {
  max-width: 720px;
}

/* Note type icons */
.note-type-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
}

.note-type-icon.content_change { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.note-type-icon.technical { background: rgba(139, 92, 246, 0.12); color: var(--accent-purple); }
.note-type-icon.link_building { background: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.note-type-icon.algorithm_update { background: rgba(249, 115, 22, 0.12); color: var(--accent-orange); }
.note-type-icon.general { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); }

/* SoV progress within table */
.sov-bar {
  height: 6px;
  background: rgba(55, 65, 81, 0.3);
  border-radius: 3px;
  overflow: hidden;
  min-width: 40px;
}

.sov-bar .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ═══ Keyword Selection / Checkboxes ═══ */

.kw-row-selected {
  background: rgba(6, 182, 212, 0.06) !important;
  border-left: 2px solid var(--accent-cyan);
}

.kw-row-selected td:first-child {
  padding-left: 10px;
}

.kw-select-cb,
.kw-master-cb {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
  border-radius: 3px;
}

.kw-master-cb {
  width: 16px;
  height: 16px;
}

#kwSelectionBar {
  position: sticky;
  top: 0;
  z-index: 20;
}

/* ═══ Todo Cards ═══ */

.todo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.todo-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(55, 65, 81, 0.6);
}

.todo-card.todo-done {
  opacity: 0.55;
  background: rgba(17, 24, 39, 0.4);
}

.todo-card.todo-done:hover {
  opacity: 0.75;
}

.todo-card.todo-overdue {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.03);
}

.todo-card.todo-overdue:hover {
  border-color: rgba(239, 68, 68, 0.4);
}
