/* RankForce by SWW Digital Solutions */
/* Aesthetic: Dark command center — near-black navy + electric teal + gold accents */

:root {
  --bg-base:       #0a0d12;
  --bg-surface:    #0f1318;
  --bg-elevated:   #151b24;
  --bg-card:       #1a2130;
  --bg-input:      #111620;

  --teal:          #00d4aa;
  --teal-dim:      #00a882;
  --teal-glow:     rgba(0, 212, 170, 0.15);
  --teal-subtle:   rgba(0, 212, 170, 0.08);

  --gold:          #f5a623;
  --gold-dim:      #c4841a;
  --gold-subtle:   rgba(245, 166, 35, 0.1);

  --red:           #ff4d4d;
  --red-subtle:    rgba(255, 77, 77, 0.1);
  --green:         #2ecc71;
  --green-subtle:  rgba(46, 204, 113, 0.1);
  --amber:         #f5a623;
  --amber-subtle:  rgba(245, 166, 35, 0.1);

  --text-primary:  #e8edf5;
  --text-secondary:#8a96a8;
  --text-muted:    #4a5568;
  --text-teal:     #00d4aa;
  --text-gold:     #f5a623;

  --border:        rgba(255,255,255,0.06);
  --border-teal:   rgba(0, 212, 170, 0.25);
  --border-gold:   rgba(245, 166, 35, 0.25);

  --font-display:  'Syne', sans-serif;
  --font-body:     'Outfit', sans-serif;
  --font-mono:     'DM Mono', monospace;

  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     22px;

  --sidebar-w:     240px;
  --transition:    0.18s ease;
}

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

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── APP SHELL ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dim));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--bg-base);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--text-primary); }
.logo-by { font-size: 10px; color: var(--text-muted); letter-spacing: 0.05em; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all var(--transition);
}

.nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav-item:hover {
  background: var(--teal-subtle);
  color: var(--teal);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: var(--teal-subtle);
  color: var(--teal);
  font-weight: 500;
  border: 1px solid var(--border-teal);
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal-glow);
  border: 1px solid var(--border-teal);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  color: var(--teal);
}

.user-info { display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.logout-link {
  font-size: 12px; color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.logout-link:hover { color: var(--red); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 32px 36px;
  max-width: 1300px;
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-title-group {}
.page-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── STAT CARDS ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-teal); }

.stat-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.teal { color: var(--teal); }
.stat-value.gold { color: var(--gold); }

.stat-delta {
  font-size: 11px;
  color: var(--green);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: var(--bg-base);
}
.btn-primary:hover { background: var(--teal-dim); }

.btn-gold {
  background: var(--gold);
  color: var(--bg-base);
}
.btn-gold:hover { background: var(--gold-dim); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--border-teal);
  color: var(--teal);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

textarea { resize: vertical; min-height: 120px; }

select option { background: var(--bg-elevated); }

/* ── TABLES ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--teal-subtle); color: var(--text-primary); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.badge-teal { background: var(--teal-subtle); color: var(--teal); border: 1px solid var(--border-teal); }
.badge-gold { background: var(--gold-subtle); color: var(--gold); border: 1px solid var(--border-gold); }
.badge-red { background: var(--red-subtle); color: var(--red); }
.badge-green { background: var(--green-subtle); color: var(--green); }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* ── SCORE METER ── */
.score-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.score-circle {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  border: 3px solid;
}

.score-circle.high { color: var(--green); border-color: var(--green); }
.score-circle.mid  { color: var(--gold); border-color: var(--gold); }
.score-circle.low  { color: var(--red); border-color: var(--red); }

/* ── AUDIT RESULT SECTIONS ── */
.audit-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
}

.audit-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background var(--transition);
}

.audit-section-header:hover { background: var(--teal-subtle); }
.audit-section-header.open { border-bottom-color: var(--border); }

.audit-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.audit-section-body {
  padding: 18px;
  display: none;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.audit-section-body.visible { display: block; }

/* Code blocks */
.code-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--teal);
  overflow-x: auto;
  margin-top: 10px;
  position: relative;
}

.copy-code-btn {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
}
.copy-code-btn:hover { color: var(--teal); border-color: var(--border-teal); }

/* ── KEYWORD TIERS ── */
.kw-tier { margin-bottom: 20px; }
.kw-tier-label {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.kw-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.kw-pill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
}

.kw-pill.t1 { background: var(--red-subtle); color: #ff7070; border: 1px solid rgba(255,77,77,0.2); }
.kw-pill.t2 { background: var(--gold-subtle); color: var(--gold); border: 1px solid var(--border-gold); }
.kw-pill.t3 { background: var(--green-subtle); color: var(--green); border: 1px solid rgba(46,204,113,0.2); }
.kw-pill:hover { transform: translateY(-1px); opacity: 0.8; }

/* ── ALERT / CALLOUT ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-critical { background: var(--red-subtle); border: 1px solid rgba(255,77,77,0.2); color: #ff7070; }
.alert-success  { background: var(--green-subtle); border: 1px solid rgba(46,204,113,0.2); color: var(--green); }
.alert-info     { background: var(--teal-subtle); border: 1px solid var(--border-teal); color: var(--teal); }
.alert-warning  { background: var(--gold-subtle); border: 1px solid var(--border-gold); color: var(--gold); }

/* ── LOADING SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.loading-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* ── TWO-COL GRID ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--teal-glow) 0%, transparent 70%);
  top: -200px; left: -200px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245,166,35,0.08) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  pointer-events: none;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.login-logo-mark {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dim));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--bg-base);
}

.login-logo-text .logo-name { font-size: 22px; font-weight: 700; }
.login-logo-text .logo-agency { font-size: 12px; color: var(--text-muted); }

.login-headline {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.error-msg {
  background: var(--red-subtle);
  border: 1px solid rgba(255,77,77,0.2);
  color: #ff7070;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 18px;
}

/* ── GBP POST CARD ── */
.gbp-post-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
}

.gbp-post-type {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.gbp-post-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.gbp-post-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── PROGRESS BAR ── */
.progress-bar-wrap {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

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

.progress-bar-fill.high { background: var(--green); }
.progress-bar-fill.mid  { background: var(--gold); }
.progress-bar-fill.low  { background: var(--red); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
  .main-content { padding: 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-teal); }

/* ── TABS ── */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state-sub { font-size: 13px; }
