/* ============================================
   RankPulse — Shared Design System
   ============================================ */

/* === Colors (CSS Custom Properties) === */
:root {
    --rp-primary: #1a73e8;
    --rp-primary-dark: #0d47a1;
    --rp-success: #1e8e3e;
    --rp-success-light: #4caf50;
    --rp-warning: #ff9800;
    --rp-warning-dark: #e8710a;
    --rp-danger: #f44336;
    --rp-danger-dark: #d93025;
    --rp-purple: #8430ce;
    --rp-teal: #00838f;
    --rp-info-blue: #4285f4;
    --rp-text: #1a1a2e;
    --rp-text-secondary: #666;
    --rp-text-muted: #888;
    --rp-border: #e8ecf1;
    --rp-border-light: #f0f0f0;
    --rp-bg-light: #f8f9fa;
    --rp-radius: 10px;
    --rp-radius-sm: 6px;
    --rp-radius-lg: 12px;
    --rp-shadow: 0 1px 4px rgba(0,0,0,.06);
    --rp-shadow-hover: 0 4px 20px rgba(0,0,0,.06);
}

/* === KPI Cards === */
.kpi-card {
    background: #fff;
    border-radius: var(--rp-radius);
    padding: 20px;
    border: 1px solid var(--rp-border);
    transition: box-shadow .2s, transform .15s;
    cursor: default;
    height: 100%;
}
.kpi-card:hover {
    box-shadow: var(--rp-shadow-hover);
    transform: translateY(-2px);
}
.kpi-icon {
    width: 44px; height: 44px; border-radius: var(--rp-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 14px;
}
.kpi-icon.blue   { background: #e8f0fe; color: var(--rp-primary); }
.kpi-icon.green  { background: #e6f4ea; color: var(--rp-success); }
.kpi-icon.orange { background: #fef3e0; color: var(--rp-warning-dark); }
.kpi-icon.purple { background: #f3e8fd; color: var(--rp-purple); }
.kpi-icon.teal   { background: #e0f7fa; color: var(--rp-teal); }
.kpi-icon.red    { background: #fce8e6; color: var(--rp-danger-dark); }
.kpi-value {
    font-size: 28px; font-weight: 700; color: var(--rp-text); line-height: 1.1;
}
.kpi-label {
    font-size: 12px; color: var(--rp-text-muted);
    text-transform: uppercase; letter-spacing: .5px;
    margin-top: 4px; font-weight: 600;
}

/* === Panel Cards === */
.panel-card {
    background: #fff;
    border-radius: var(--rp-radius);
    border: 1px solid var(--rp-border);
    overflow: hidden;
    height: 100%;
}
.panel-card .panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--rp-border-light);
    display: flex; align-items: center; justify-content: space-between;
}
.panel-card .panel-header h6 {
    font-size: 14px; font-weight: 700; color: #333; margin: 0;
}
.panel-card .panel-body { padding: 16px 20px; }

/* === Metrics Row (SEMrush-style) === */
.metrics-row {
    display: flex; gap: 0;
    border: 1px solid #e0e0e0; border-radius: 8px;
    overflow: hidden; background: #fff; margin-bottom: 20px;
}
.metric-box {
    flex: 1; padding: 20px 24px;
    border-right: 1px solid #e0e0e0;
    min-height: 140px;
}
.metric-box:last-child { border-right: none; }
.metric-box-title {
    font-size: 11px; color: var(--rp-text-muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 8px;
}
.metric-box-value {
    font-size: 28px; font-weight: 700; color: #111; line-height: 1.1;
}
.metric-box-value.small-val { font-size: 18px; }
.metric-box-sub {
    font-size: 12px; color: #999; margin-top: 4px;
}

/* === Search Bar === */
.search-bar-wrap {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.search-bar-wrap .form-control {
    border-radius: var(--rp-radius-sm); height: 42px;
}
.search-bar-wrap .btn-primary {
    height: 42px; border-radius: var(--rp-radius-sm); font-weight: 600;
}

/* === Section Headers === */
.section-title {
    font-size: 15px; font-weight: 700; color: var(--rp-text);
    margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.section-title i { font-size: 16px; color: var(--rp-text-muted); }

/* === Quick Action Cards === */
.qa-card {
    background: #fff; border-radius: var(--rp-radius); padding: 18px 16px;
    border: 1px solid var(--rp-border); text-align: center;
    transition: all .2s; text-decoration: none; display: block; height: 100%;
}
.qa-card:hover {
    border-color: var(--rp-primary);
    box-shadow: 0 4px 16px rgba(26,115,232,.12);
    text-decoration: none; transform: translateY(-2px);
}
.qa-card i { font-size: 28px; display: block; margin-bottom: 8px; }
.qa-card .qa-title { font-size: 13px; font-weight: 600; color: #333; }
.qa-card .qa-desc { font-size: 11px; color: #999; margin-top: 2px; }

/* === Activity Items === */
.activity-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.activity-dot.heatmap { background: var(--rp-primary); }
.activity-dot.seo { background: var(--rp-success); }
.activity-dot.gsc { background: var(--rp-info-blue); }
.activity-text { flex: 1; min-width: 0; }
.activity-text .act-title {
    font-size: 13px; color: #333; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-text .act-meta { font-size: 11px; color: #aaa; }

/* === SEO Score Mini === */
.seo-mini-score {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; border: 3px solid; flex-shrink: 0;
}
.seo-mini-score.good { border-color: var(--rp-success); color: var(--rp-success); }
.seo-mini-score.ok   { border-color: var(--rp-warning-dark); color: var(--rp-warning-dark); }
.seo-mini-score.bad  { border-color: var(--rp-danger-dark); color: var(--rp-danger-dark); }

/* === Score Circle (large) === */
.score-circle-wrap { text-align: center; }
.score-circle {
    width: 120px; height: 120px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; font-weight: 700;
    border: 6px solid #e0e0e0;
    margin: 0 auto 10px; position: relative;
}
.score-good { border-color: var(--rp-success-light); color: var(--rp-success-light); }
.score-ok   { border-color: var(--rp-warning); color: var(--rp-warning); }
.score-bad  { border-color: var(--rp-danger); color: var(--rp-danger); }
.score-label {
    font-size: 13px; color: #777; font-weight: 600; text-transform: uppercase;
}

/* === Status Badges === */
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; margin-right: 6px;
}
.status-dot.connected { background: var(--rp-success); }
.status-dot.disconnected { background: var(--rp-danger-dark); }

/* === Severity Badges === */
.severity-critical { color: #c62828; font-weight: 600; }
.severity-warning  { color: #e65100; font-weight: 600; }
.severity-info     { color: #1565c0; font-weight: 600; }
.severity-badge {
    display: inline-block; padding: 4px 12px; border-radius: 6px;
    font-size: 13px; font-weight: 600;
}
.severity-badge.critical { background: #fce8e6; color: var(--rp-danger-dark); }
.severity-badge.warning  { background: #fef3e0; color: var(--rp-warning-dark); }
.severity-badge.info     { background: #e8f0fe; color: var(--rp-primary); }

/* === Competition / Score Badges === */
.comp-badge, .score-badge {
    display: inline-block; padding: 4px 12px; border-radius: 4px;
    font-size: 13px; font-weight: 600;
}
.comp-low, .score-low     { background: #e8f5e9; color: #2e7d32; }
.comp-medium, .score-medium { background: #fff3e0; color: #e65100; }
.comp-high, .score-high   { background: #fce4ec; color: #c62828; }
.opp-badge { font-size: 12px; padding: 2px 8px; border-radius: 3px; font-weight: 600; }
.opp-low    { background: #e8f5e9; color: #2e7d32; }
.opp-medium { background: #fff3e0; color: #e65100; }
.opp-high   { background: #fce4ec; color: #c62828; }

/* === Data Source Tags === */
.source-tag {
    display: inline-block; font-size: 10px; padding: 2px 6px;
    border-radius: 3px; font-weight: 600;
    vertical-align: middle; margin-left: 6px;
}
.source-real { background: #e8f5e9; color: #2e7d32; }
.source-est  { background: #fff8e1; color: #f57f17; }

/* === Difficulty Gauge === */
.difficulty-gauge {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; margin: 8px 0;
    border: 4px solid #e0e0e0;
}
.difficulty-easy   { border-color: var(--rp-success-light); color: var(--rp-success-light); }
.difficulty-medium { border-color: var(--rp-warning); color: var(--rp-warning); }
.difficulty-hard   { border-color: var(--rp-danger); color: var(--rp-danger); }
.difficulty-label  { font-size: 12px; font-weight: 600; text-transform: uppercase; margin-top: 4px; }

/* === Issue Rows === */
.issue-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--rp-border-light);
}
.issue-row:last-child { border-bottom: none; }
.issue-icon { width: 22px; text-align: center; flex-shrink: 0; margin-top: 2px; }
.issue-msg { font-size: 14px; color: #333; }

/* === Check Rows (pass/fail) === */
.check-pass { color: var(--rp-success-light); }
.check-fail { color: var(--rp-danger); }
.check-warn { color: var(--rp-warning); }
.check-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
    border-bottom: 1px solid var(--rp-border-light); font-size: 14px;
}
.check-row:last-child { border-bottom: none; }

/* === Country Bars === */
.country-row {
    display: flex; align-items: center; margin-bottom: 8px; font-size: 13px;
}
.country-flag { width: 20px; text-align: center; margin-right: 4px; font-size: 14px; }
.country-code { width: 28px; font-weight: 600; color: #555; font-size: 12px; }
.country-bar-wrap {
    flex: 1; height: 14px; background: #f0f0f0;
    border-radius: 2px; margin: 0 10px; overflow: hidden;
}
.country-bar {
    height: 100%; border-radius: 2px; transition: width 0.6s ease;
}
.country-bar.bar-eg { background: #2196F3; }
.country-bar.bar-us { background: #1565C0; }
.country-bar.bar-gb { background: #0D47A1; }
.country-volume {
    font-weight: 600; color: #333; min-width: 55px;
    text-align: right; font-size: 13px;
}

/* === Recommendation Items === */
.reco-item {
    border-left: 4px solid #2196F3; background: var(--rp-bg-light);
    padding: 12px 16px; margin-bottom: 10px;
    border-radius: 0 var(--rp-radius-sm) var(--rp-radius-sm) 0;
}
.reco-item.priority-high   { border-left-color: var(--rp-danger); }
.reco-item.priority-medium { border-left-color: var(--rp-warning); }
.reco-item.source-gsc      { background: #f1f8ff; border-left-color: var(--rp-info-blue); }
.reco-item.source-gsc.priority-high { border-left-color: #ea4335; }
.reco-title { font-weight: 600; font-size: 14px; color: #111; }
.reco-desc  { font-size: 13px; color: #555; margin-top: 4px; }
.reco-badge-gsc {
    display: inline-block; background: var(--rp-info-blue); color: #fff;
    font-size: 10px; padding: 1px 6px; border-radius: 3px;
    margin-left: 6px; vertical-align: middle; font-weight: 500; letter-spacing: .3px;
}

/* === Heatmap Card === */
.heatmap-card {
    background: #fff; border-radius: var(--rp-radius-lg);
    box-shadow: var(--rp-shadow); border: 1px solid #e8eaed; overflow: hidden;
}
.heatmap-card .card-header-custom {
    padding: 16px 20px; border-bottom: 1px solid var(--rp-border-light);
    display: flex; align-items: center; gap: 10px;
}
.heatmap-card .card-header-custom h6 {
    margin: 0; font-weight: 700; font-size: 15px; color: var(--rp-text);
}
.heatmap-card .card-header-custom i { font-size: 18px; }
.heatmap-card .card-body { padding: 20px; }

/* === Loading Overlay === */
.rp-loading {
    text-align: center; padding: 40px; color: var(--rp-text-muted);
}
.rp-loading i { font-size: 24px; }
.rp-loading .spinner-border { width: 48px; height: 48px; }

/* === Chart Container === */
.chart-container { height: 180px; position: relative; }

/* === Heading Tags (SEO Analyzer) === */
.heading-tag {
    display: inline-block; background: #e3f2fd; color: #1565c0;
    padding: 2px 8px; border-radius: 3px; font-family: monospace;
    font-size: 12px; font-weight: 600; margin-right: 6px;
}
.heading-text { font-size: 13px; color: #333; }
.heading-row { padding: 6px 0; border-bottom: 1px solid #f5f5f5; }

/* === Keyword Chips === */
.kw-chip {
    display: inline-block; background: #f0f0f0; padding: 4px 12px;
    margin: 3px; border-radius: 4px; font-size: 13px;
}
.kw-count { color: var(--rp-text-muted); font-size: 11px; margin-left: 4px; }

/* === Opportunity Table === */
.opp-table { width: 100%; }
.opp-table th {
    font-size: 11px; text-transform: uppercase; color: var(--rp-text-muted);
    font-weight: 600; padding: 10px 12px; border-bottom: 2px solid #e0e0e0;
}
.opp-table td { padding: 10px 12px; border-bottom: 1px solid var(--rp-border-light); font-size: 14px; }
.opp-table tr:hover { background: var(--rp-bg-light); }

/* === Keyword Ideas Table === */
.kw-ideas-table { width: 100%; }
.kw-ideas-table th {
    font-size: 11px; text-transform: uppercase; color: var(--rp-text-muted);
    font-weight: 600; padding: 10px 12px; border-bottom: 2px solid #e0e0e0;
}
.kw-ideas-table td { padding: 10px 12px; border-bottom: 1px solid var(--rp-border-light); font-size: 14px; }
.kw-ideas-table tr:hover { background: var(--rp-bg-light); }
.kw-link {
    color: #1a0dab; cursor: pointer; text-decoration: none; font-weight: 500;
}
.kw-link:hover { text-decoration: underline; }

/* === Country Pills === */
.country-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f5f5f5; border-radius: 20px; padding: 6px 14px;
    font-size: 13px; font-weight: 600; margin-right: 6px; margin-bottom: 6px;
}
.confidence-bar {
    height: 4px; border-radius: 2px; background: #e0e0e0;
    width: 60px; display: inline-block; overflow: hidden;
}
.confidence-fill { height: 100%; border-radius: 2px; background: #2196F3; }

/* === Domain Header (SEO Analyzer) === */
.domain-header {
    display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.domain-header h4 { font-size: 20px; font-weight: 700; color: #111; margin: 0; }
.badge-https {
    padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge-secure   { background: #e8f5e9; color: #2e7d32; }
.badge-insecure { background: #fce4ec; color: #c62828; }

/* === GSC Styles === */
.gsc-connect-card {
    background: #fff; border: 2px dashed #d0d0d0; border-radius: 12px;
    padding: 60px 40px; text-align: center; margin-top: 30px;
}
.gsc-connect-card i { font-size: 64px; color: var(--rp-info-blue); margin-bottom: 20px; }
.gsc-connect-card h3 { color: #333; font-weight: 600; margin-bottom: 10px; }
.gsc-connect-card p {
    color: #777; margin-bottom: 24px; max-width: 480px;
    margin-left: auto; margin-right: auto;
}
.btn-google {
    background: var(--rp-info-blue); color: #fff; border: none;
    padding: 12px 32px; border-radius: 6px; font-weight: 600;
    font-size: 15px; display: inline-flex; align-items: center; gap: 10px;
}
.btn-google:hover { background: #3367d6; color: #fff; }
.btn-google img { width: 20px; height: 20px; }

.gsc-top-bar {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 16px 24px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.gsc-top-bar label { font-weight: 600; color: #555; margin-bottom: 0; white-space: nowrap; }
.gsc-top-bar select, .gsc-top-bar input { border-radius: 6px; height: 38px; }

.gsc-metrics {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 16px; margin-bottom: 24px;
}
.gsc-metric-card {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 20px; text-align: center; cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.gsc-metric-card:hover, .gsc-metric-card.active { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.gsc-metric-card.active-clicks     { border-color: var(--rp-info-blue); }
.gsc-metric-card.active-impressions { border-color: #34a853; }
.gsc-metric-card.active-ctr        { border-color: #fbbc04; }
.gsc-metric-card.active-position   { border-color: #ea4335; }
.gsc-metric-card .metric-value { font-size: 28px; font-weight: 700; }
.gsc-metric-card .metric-label {
    font-size: 12px; color: #777; text-transform: uppercase;
    font-weight: 600; letter-spacing: 0.5px;
}
.metric-clicks .metric-value      { color: var(--rp-info-blue); }
.metric-impressions .metric-value  { color: #34a853; }
.metric-ctr .metric-value          { color: #fbbc04; }
.metric-position .metric-value     { color: #ea4335; }

.gsc-chart-card {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 24px; margin-bottom: 24px;
}
.gsc-table-card {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    margin-bottom: 24px; overflow: hidden;
}
.gsc-table-card .card-header-custom {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e0e0e0;
}
.gsc-table-card .card-header-custom h6 { margin: 0; font-weight: 700; color: #333; }
.gsc-table-card table { margin-bottom: 0; }
.gsc-table-card th {
    background: var(--rp-bg-light); font-weight: 600; font-size: 12px;
    text-transform: uppercase; color: #777; letter-spacing: 0.5px; border-top: none;
}
.gsc-table-card td { vertical-align: middle; font-size: 14px; }
.gsc-table-card .query-text { font-weight: 500; color: #333; max-width: 300px; word-break: break-all; }
.gsc-table-card .page-url { font-weight: 500; color: var(--rp-info-blue); max-width: 350px; word-break: break-all; font-size: 13px; }
.gsc-tabs .nav-link {
    font-weight: 600; color: #555; border: none;
    border-bottom: 3px solid transparent; padding: 10px 20px;
}
.gsc-tabs .nav-link.active {
    color: var(--rp-info-blue); border-bottom-color: var(--rp-info-blue); background: transparent;
}
.gsc-account-info {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; background: #e8f5e9; border-radius: 8px; margin-bottom: 20px;
}
.gsc-account-info i { color: var(--rp-success-light); font-size: 20px; }
.gsc-account-info .account-email { font-weight: 600; color: #333; }
.device-icon { font-size: 18px; margin-right: 8px; }

/* === Position Tracking (SEMrush-style) === */
.pos-tracking {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden;
}
.pos-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid #eee; flex-wrap: wrap; gap: 8px;
}
.pos-header h6 { margin: 0; font-weight: 700; font-size: 15px; color: #333; }
.pos-header-right {
    display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap;
}
.pos-range-select {
    border: 1px solid #ddd; border-radius: 4px; font-size: 12px;
    padding: 3px 8px; color: #1a73e8; font-weight: 600; cursor: pointer;
    background: #fff; outline: none;
}
.pos-range-select:focus { border-color: #1a73e8; }
.pos-snap-btn {
    width: 30px; height: 30px; border-radius: 50%; border: 1px solid #ddd;
    background: #fff; color: #555; font-size: 13px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.pos-snap-btn:hover { background: #f5f5f5; color: #333; }
.pos-state-msg {
    text-align: center; padding: 48px 20px; color: #999;
}
.pos-state-msg i { font-size: 44px; display: block; margin-bottom: 12px; color: #ddd; }
.pos-state-msg p { margin: 8px 0 0; font-size: 14px; }
.pos-state-msg span { font-size: 12px; color: #bbb; }

/* Grid layout */
.pos-grid {
    display: grid; grid-template-columns: 1fr 1.5fr 1.5fr;
    min-height: 260px;
}
.pos-col { padding: 20px; }
.pos-col + .pos-col { border-left: 1px solid #eee; }
.pos-col-label {
    font-size: 13px; font-weight: 600; color: #888; margin-bottom: 10px;
}

/* Visibility column */
.pos-col-vis { display: flex; flex-direction: column; }
.pos-vis-value { font-size: 30px; font-weight: 700; color: #1a73e8; line-height: 1.1; }
.pos-vis-change { font-size: 14px; font-weight: 600; margin-top: 2px; }
.pos-vis-change.positive { color: #1e8e3e; }
.pos-vis-change.negative { color: #d93025; }
.pos-vis-chart { flex: 1; min-height: 80px; margin-top: 12px; position: relative; }
.pos-vis-chart canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* Distribution brackets (2×2 grid) */
.pos-brackets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.pos-bracket { text-align: center; }
.brk-label { font-size: 12px; color: #999; font-weight: 500; display: block; margin-bottom: 6px; }
.brk-ring-wrap {
    position: relative; width: 56px; height: 56px; margin: 0 auto 4px;
}
.brk-ring { width: 56px; height: 56px; transform: rotate(-90deg); }
.brk-ring-bg { fill: none; stroke: #eee; stroke-width: 2.5; }
.brk-ring-fill {
    fill: none; stroke: #b0b0b0; stroke-width: 2.5;
    stroke-dasharray: 0 100; stroke-linecap: round;
    transition: stroke-dasharray .5s ease, stroke .3s ease;
}
.brk-count {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 16px; font-weight: 700; color: #333;
}
.brk-meta { font-size: 11px; color: #999; line-height: 1.6; }
.brk-meta b { font-weight: 700; color: #555; }
.brk-meta b.has-lost { color: #d93025; }
.brk-spark { height: 32px; margin-top: 4px; position: relative; }
.brk-spark canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* Top Keywords table */
.pos-kw-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.pos-kw-table th {
    font-size: 11px; font-weight: 600; color: #999; text-transform: uppercase;
    letter-spacing: .4px; padding: 6px 8px; border-bottom: 1px solid #eee;
}
.pos-kw-table td { padding: 7px 8px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.pos-kw-table .kw-name {
    color: #1a73e8; font-weight: 500; max-width: 180px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pos-chg-badge { display: inline-block; font-size: 11px; font-weight: 700; margin-left: 4px; }
.pos-chg-badge.up   { color: #1e8e3e; }
.pos-chg-badge.down  { color: #d93025; }

/* Responsive */
@media (max-width: 992px) {
    .pos-grid { grid-template-columns: 1fr; }
    .pos-col + .pos-col { border-left: none; border-top: 1px solid #eee; }
}

/* === Heatmap Form === */
.hm-form .form-group { margin-bottom: 16px; }
.hm-form label {
    font-weight: 600; font-size: 13px; color: #555;
    margin-bottom: 6px; display: block;
}
.hm-form .form-control {
    border-radius: 8px; border: 1px solid #dde1e6;
    padding: 10px 14px; font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
}
.hm-form .form-control:focus {
    border-color: var(--rp-primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}
.hm-row-inline { display: flex; gap: 12px; }
.hm-row-inline .form-group { flex: 1; }
.btn-heatmap {
    background: linear-gradient(135deg, var(--rp-primary), var(--rp-primary-dark));
    color: #fff; border: none; border-radius: 8px;
    padding: 12px 28px; font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all .2s; width: 100%;
}
.btn-heatmap:hover {
    background: linear-gradient(135deg, #1557b0, #0a3a8a);
    box-shadow: 0 4px 12px rgba(26,115,232,.3); color: #fff;
}
.btn-heatmap:disabled { opacity: .6; cursor: not-allowed; }
.map-panel {
    background: #fff; border-radius: var(--rp-radius-lg);
    box-shadow: var(--rp-shadow); border: 1px solid #e8eaed;
    overflow: hidden; min-height: 500px;
    display: flex; flex-direction: column;
}

/* === Position Tracking (GSC Dashboard) === */
.position-card { background: #fff; border-radius: var(--rp-radius); border: 1px solid var(--rp-border); overflow: hidden; }
.position-row {
    display: flex; align-items: center; padding: 10px 16px; gap: 12px;
    border-bottom: 1px solid var(--rp-border-light); font-size: 13px;
}
.position-row:last-child { border-bottom: none; }
.position-row:hover { background: var(--rp-bg-light); }
.position-rank {
    width: 32px; height: 32px; border-radius: 6px; display: flex;
    align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.position-rank.top3   { background: #e8f5e9; color: #2e7d32; }
.position-rank.top10  { background: #e8f0fe; color: var(--rp-primary); }
.position-rank.top20  { background: #fff3e0; color: #e65100; }
.position-rank.below  { background: #f5f5f5; color: #999; }
.position-change {
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.position-change.up   { color: var(--rp-success); }
.position-change.down { color: var(--rp-danger); }
.position-change.same { color: #999; }
.position-keyword { flex: 1; font-weight: 500; color: #333; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.position-clicks { font-weight: 600; color: var(--rp-info-blue); min-width: 50px; text-align: right; }
.position-impressions { color: #666; min-width: 70px; text-align: right; }

/* === Responsive === */
@media (max-width: 768px) {
    .kpi-value { font-size: 22px; }
    .qa-card i { font-size: 22px; }
    .metrics-row { flex-direction: column; }
    .metric-box { border-right: none; border-bottom: 1px solid #e0e0e0; }
    .metric-box:last-child { border-bottom: none; }
    .gsc-metrics { grid-template-columns: repeat(2, 1fr); }
    .gsc-top-bar { flex-direction: column; align-items: stretch; }
}

/* ============================================
   Layout — Spacing Fix
   ============================================ */
:root {
    --rp-navbar-h: 54px;
    --rp-sidebar-w: 240px;
    --rp-chrome-bg: #0f172a;
}

/* Push ALL page content below the fixed navbar */
body { padding-top: var(--rp-navbar-h) !important; }

/* Sidebar scroll area starts exactly below navbar */
.sidebar:not(.sidebar-component) .sidebar-content {
    top: var(--rp-navbar-h) !important;
}

/* Keep sidebar width in sync */
.sidebar-main { width: var(--rp-sidebar-w) !important; }
.sidebar-main .sidebar-content { width: var(--rp-sidebar-w) !important; }

/* ── Hamburger toggle fix ──────────────────────────────────────
   app.js toggles `sidebar-xs` (icon-only mode) on the body.
   We don't want icon-only — we want the sidebar to fully disappear.
   display:none on the parent cascades to all children (incl. fixed).
   ──────────────────────────────────────────────────────────── */
.sidebar-xs .sidebar.rp-sidebar {
    display: none !important;
}
/* Content wrapper fills full width when sidebar is hidden */
.sidebar-xs .content-wrapper {
    margin-left: 0 !important;
}
/* Prevent any sidebar-xs flyout submenus from appearing */
.sidebar-xs .rp-sidebar .nav-group-sub {
    display: none !important;
}

/* ============================================
   Navbar
   ============================================ */
.navbar.rp-navbar {
    height: var(--rp-navbar-h);
    background: var(--rp-chrome-bg) !important;
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 1px 0 rgba(255,255,255,.03), 0 4px 20px rgba(0,0,0,.35);
    padding: 0 16px 0 16px;
    z-index: 1031;
}

/* ── Brand area ─────────────────────────── */
.rp-nav-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
    margin-right: 8px;
    flex-shrink: 0;
}
.rp-brand-mark {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 900; color: #fff;
    letter-spacing: -1px; flex-shrink: 0;
}
.rp-brand-wordmark {
    font-size: 15px; font-weight: 700; color: #fff;
    letter-spacing: -0.4px; line-height: 1;
}
.rp-brand-wordmark em { font-style: normal; color: rgba(255,255,255,.4); font-weight: 400; }

/* ── Sidebar toggle (desktop) ───────────── */
.rp-nav-toggle {
    width: 34px; height: 34px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.45) !important;
    text-decoration: none !important;
    transition: background .14s, color .14s;
    margin-right: 6px;
    flex-shrink: 0;
}
.rp-nav-toggle:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85) !important; }
.rp-nav-toggle i { font-size: 15px; }

/* ── Right nav cluster ──────────────────── */
.rp-nav-right { display: flex; align-items: center; gap: 8px; }

/* Credits pill */
.rp-credits-pill {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(251,191,36,.1);
    border: 1px solid rgba(251,191,36,.22);
    border-radius: 20px;
    padding: 5px 12px 5px 8px;
    font-size: 12.5px; font-weight: 600;
    color: #fbbf24 !important;
    text-decoration: none !important;
    transition: background .14s, border-color .14s;
    cursor: pointer; white-space: nowrap;
}
.rp-credits-pill:hover {
    background: rgba(251,191,36,.18);
    border-color: rgba(251,191,36,.38);
    color: #fbbf24 !important;
}
.rp-credits-pill i { font-size: 13px; color: #fbbf24; }
.rp-credits-pill #nav-credits-count { font-weight: 700; }
.rp-credits-pill .rp-credits-label { color: rgba(251,191,36,.65); font-weight: 400; }

/* User button */
.rp-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 5px !important;
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1) !important;
    text-decoration: none !important;
    transition: background .14s;
    color: #fff !important;
}
.rp-user-btn:hover, .show > .rp-user-btn {
    background: rgba(255,255,255,.12) !important;
    color: #fff !important;
    text-decoration: none !important;
}
.rp-user-btn::after { display: none !important; }  /* hide Bootstrap caret */
.rp-user-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.rp-user-btn-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1; }
.rp-user-caret { font-size: 9px; color: rgba(255,255,255,.4); margin-left: 2px; }

/* User dropdown */
.rp-user-drop {
    min-width: 230px;
    border-radius: 14px !important;
    border: 1px solid rgba(0,0,0,.07) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.06) !important;
    padding: 0 !important;
    overflow: hidden;
    margin-top: 10px !important;
}
.rp-drop-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 14px 12px;
    background: #f8f9fb;
    border-bottom: 1px solid #f0f2f5;
}
.rp-drop-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.rp-drop-name  { font-size: 14px; font-weight: 700; color: #1a1a2e; line-height: 1.3; }
.rp-drop-email { font-size: 11.5px; color: #999; margin-top: 1px; }

.rp-drop-section { padding: 5px 6px; }
.rp-drop-section + .rp-drop-section { border-top: 1px solid #f0f2f5; }
.rp-drop-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px; font-weight: 500;
    color: #333 !important;
    text-decoration: none !important;
    transition: background .1s;
}
.rp-drop-item:hover { background: #f0f4ff; color: #333 !important; }
.rp-drop-item i { font-size: 13px; color: #bbb; width: 15px; text-align: center; }
.rp-drop-item.danger { color: #d93025 !important; }
.rp-drop-item.danger i { color: #d93025 !important; }
.rp-drop-item.danger:hover { background: #fff4f3; }

/* ============================================
   Sidebar
   ============================================ */
.sidebar.rp-sidebar {
    width: var(--rp-sidebar-w) !important;
    background: var(--rp-chrome-bg) !important;
}
.rp-sidebar .sidebar-content {
    background: var(--rp-chrome-bg) !important;
    border-right: 1px solid rgba(255,255,255,.05) !important;
}

/* User profile strip */
.rp-sb-profile {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 12px 12px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.rp-sb-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.rp-sb-info { flex: 1; min-width: 0; }
.rp-sb-name {
    font-size: 13px; font-weight: 600; color: #e2e8f0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3;
}
.rp-sb-credits { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 1px; }
.rp-sb-credits i { color: #fbbf24; font-size: 10px; }
.rp-sb-buy {
    width: 26px; height: 26px; border-radius: 6px;
    background: rgba(255,255,255,.07);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,.45) !important; font-size: 13px;
    transition: background .14s, color .14s;
    text-decoration: none !important; flex-shrink: 0;
}
.rp-sb-buy:hover { background: rgba(59,130,246,.25); color: #93c5fd !important; }

/* Card wrapper inside sidebar */
.rp-sidebar .card.card-sidebar-mobile {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Section headers */
.rp-sidebar .nav-sidebar .nav-item-header {
    padding: 16px 18px 4px !important;
    margin: 0 !important;
}
.rp-sidebar .nav-sidebar .nav-item-header > div {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: rgba(255,255,255,.25) !important;
    line-height: 1;
}

/* Nav links */
.rp-sidebar .nav-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px !important;
    margin: 1px 8px !important;
    border-radius: 7px !important;
    font-size: 13px; font-weight: 500;
    color: rgba(255,255,255,.6) !important;
    transition: background .12s, color .12s !important;
}
.rp-sidebar .nav-sidebar .nav-link i {
    font-size: 15px;
    color: rgba(255,255,255,.35);
    margin-right: 0 !important;
    width: 18px; text-align: center; flex-shrink: 0;
    transition: color .12s;
}
.rp-sidebar .nav-sidebar .nav-link > span {
    flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rp-sidebar .nav-sidebar .nav-link:hover {
    background: rgba(255,255,255,.07) !important;
    color: rgba(255,255,255,.9) !important;
}
.rp-sidebar .nav-sidebar .nav-link:hover i { color: rgba(255,255,255,.7); }

/* Active + open parent */
.rp-sidebar .nav-sidebar .nav-item > .nav-link.active,
.rp-sidebar .nav-sidebar > .nav-item-open > .nav-link {
    background: rgba(59,130,246,.16) !important;
    color: #93c5fd !important;
}
.rp-sidebar .nav-sidebar .nav-item > .nav-link.active i,
.rp-sidebar .nav-sidebar > .nav-item-open > .nav-link i {
    color: #60a5fa !important;
}

/* Submenu arrow */
.rp-sidebar .nav-item-submenu > .nav-link::after {
    color: rgba(255,255,255,.3) !important;
    right: 12px !important;
}

/* Submenu group */
.rp-sidebar .nav-group-sub {
    background: rgba(0,0,0,.2) !important;
    border-radius: 8px !important;
    margin: 2px 8px 4px !important;
    padding: 3px 0 !important;
}
.rp-sidebar .nav-group-sub .nav-link {
    padding: 7px 12px 7px 38px !important;
    margin: 0 4px !important;
    border-radius: 6px !important;
    font-size: 12.5px !important;
    color: rgba(255,255,255,.45) !important;
}
.rp-sidebar .nav-group-sub .nav-link i {
    font-size: 11px !important;
    margin-right: 6px !important;
    width: auto !important;
    opacity: .55;
}
.rp-sidebar .nav-group-sub .nav-link:hover {
    background: rgba(255,255,255,.06) !important;
    color: rgba(255,255,255,.85) !important;
}
.rp-sidebar .nav-group-sub .nav-link.active {
    background: rgba(59,130,246,.15) !important;
    color: #93c5fd !important;
}

/* Scrollbar in sidebar */
.rp-sidebar .sidebar-content::-webkit-scrollbar { width: 4px; }
.rp-sidebar .sidebar-content::-webkit-scrollbar-track { background: transparent; }
.rp-sidebar .sidebar-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.rp-sidebar .sidebar-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ============================================
   Buy Credits Modal
   ============================================ */
#modal_min .modal-content  { border-radius: 14px; overflow: visible; border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
#modal_min .modal-header   { background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%); border: 0; border-radius: 14px 14px 0 0; padding: 18px 22px; }
#modal_min .modal-title    { font-weight: 700; color: #fff; font-size: 16px; }
#modal_min .modal-header .close { color: rgba(255,255,255,.7); text-shadow: none; opacity: 1; }
#modal_min .modal-header .close:hover { color: #fff; }
#modal_min .plan-btn {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 16px; border-radius: 8px; border: 1px solid var(--rp-border);
    background: #fff; margin-bottom: 8px; cursor: pointer;
    transition: border-color .15s, box-shadow .15s; text-decoration: none;
    color: var(--rp-text);
}
#modal_min .plan-btn:hover { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.1); text-decoration: none; color: var(--rp-text); }
#modal_min .plan-btn .plan-credits { font-size: 14px; font-weight: 700; color: #333; }
#modal_min .plan-btn .plan-price   { font-size: 13px; color: #3b82f6; font-weight: 600; }
#modal_min .plan-selected { border-color: #3b82f6 !important; background: #eff6ff !important; box-shadow: 0 0 0 3px rgba(59,130,246,.12) !important; }
#modal_min #paypal-button-container { margin-top: 12px; min-height: 48px; }

/* ============================================
   Footer
   ============================================ */
.rp-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--rp-border-light);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    font-size: 12px; color: var(--rp-text-muted);
    background: #fff;
}
.rp-footer a { color: var(--rp-text-muted); text-decoration: none; }
.rp-footer a:hover { color: var(--rp-primary); }
