/**
 * Inspero SEO/GEO Analyzer — Frontend Styles
 * Version: 5.7.0 — Impreza Integration + Flat Design
 */

/* ═══════════════════════════════════════════
   ROOT VARIABLES
   ═══════════════════════════════════════════ */
:root {
    /* Spacing */
    --seo-space-xs: 4px;
    --seo-space-sm: 8px;
    --seo-space-md: 16px;
    --seo-space-lg: 24px;
    --seo-space-xl: 40px;

    /* Typography */
    --seo-font-xs: 11px;
    --seo-font-sm: 12px;
    --seo-font-base: 13px;
    --seo-font-md: 14px;
    --seo-font-lg: 15px;
    --seo-font-xl: 18px;
    --seo-font-xxl: 28px;
    --seo-font-score: 48px;

    /* Radius — mapped to Impreza */
    --seo-radius-sm: var(--site-border-radius, 6px);
    --seo-radius-md: var(--site-border-radius, 8px);
    --seo-radius-lg: var(--site-border-radius, 10px);
    --seo-radius-pill: 12px;
    --seo-radius-full: 50%;

    /* Surfaces — mapped to Impreza */
    --seo-surface-alt: var(--color-content-bg, #f8f9fb);
    --seo-surface-muted: var(--color-content-bg, #f3f4f6);
    --seo-surface-code: #fcfcfd;
    --seo-color-muted: #6b7280;
    --seo-color-faded: #9ca3af;
}

/* ═══════════════════════════════════════════
   MAIN WRAPPER
   ═══════════════════════════════════════════ */
.seo-analyzer-wrapper {
    font-size: var(--font-size, 18px);
    line-height: var(--line-height, 28px);
    color: var(--color-content-text, var(--seo-text, #444444));
    max-width: 100%;
    margin: 0 auto;
}

/* FontAwesome enforcement — theme CSS may override font-family */
.seo-analyzer-wrapper i[class*="fa-"],
.seo-analyzer-wrapper .fa-regular,
.seo-analyzer-wrapper .fa-solid,
#seo-modal-overlay i[class*="fa-"] {
    font-family: 'Font Awesome 6 Free', 'FontAwesome', sans-serif !important;
    font-weight: 400 !important;
    font-style: normal !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════
   CARD & FORM
   ═══════════════════════════════════════════ */
.seo-analyzer-card {
    background: var(--color-content-bg-alt, var(--seo-background, #ffffff));
    border: 1px solid var(--color-content-border, var(--seo-border, #ededed));
    border-radius: var(--seo-radius-lg);
    padding: var(--seo-space-xl);
    margin-bottom: 30px;
}

.seo-analyzer-title {
    font-family: var(--h2-font-family, var(--font-family));
    font-size: var(--h2-font-size, 1.8rem);
    font-weight: var(--h2-font-weight, 400);
    line-height: var(--h2-line-height, 1.2);
    color: var(--color-content-heading, #222222);
    margin: 0 0 30px 0;
}

.seo-analyzer-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.seo-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--seo-space-sm);
}

.seo-form-group label {
    font-weight: var(--bold-font-weight, 700);
    font-size: var(--seo-font-md);
    color: var(--seo-text, #444444);
}

.seo-input {
    width: 100%;
    padding: 12px var(--seo-space-md);
    border: 2px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-md);
    font-family: var(--font-family);
    font-size: 16px;
    transition: all 0.2s;
}

.seo-input:focus {
    outline: none;
    border-color: var(--color-content-primary, var(--seo-primary, #004cff));
}

/* Action Button Group (Analyze + Force Refresh) */
.seo-action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-direction: row;
}

/* Button — minimal, let theme handle colors/hover */
.seo-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.seo-button:disabled,
.seo-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Force Refresh Button */
.seo-force-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-md);
    background: var(--seo-background, #fff);
    color: var(--seo-secondary, #666);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    flex-shrink: 0;
}

.seo-force-refresh-btn:hover {
    border-color: var(--seo-primary, #004cff);
    color: var(--seo-primary, #004cff);
    background: var(--seo-surface-alt, #f8f9fb);
}

/* Clear All / Reset Button */
.seo-clear-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-md);
    background: var(--seo-background, #fff);
    color: var(--seo-secondary, #666);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    flex-shrink: 0;
}

.seo-clear-all-btn:hover {
    border-color: var(--seo-error, #ef4444);
    color: var(--seo-error, #ef4444);
    background: var(--seo-surface-alt, #f8f9fb);
}

/* ═══════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════ */
.seo-loading-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
}

.seo-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--seo-border, #ededed);
    border-top-color: var(--seo-primary, #004cff);
    border-radius: var(--seo-radius-full);
    animation: seoSpin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

/* Skeleton shimmer for loading state */
.skeleton-loader {
    display: inline-block !important;
    min-height: 24px;
    min-width: 50px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e8e8e8 25%, #d4d4d4 50%, #e8e8e8 75%) !important;
    background-size: 200% 100% !important;
    animation: seoSkeletonShimmer 1.5s ease-in-out infinite !important;
    color: transparent !important;
    overflow: hidden;
    pointer-events: none;
}

/* Block-level skeleton placeholders (divs, sections) should fill width */
div.skeleton-loader,
.seo-recommendation.skeleton-loader,
.tab-section-title.skeleton-loader {
    display: block !important;
    width: 100%;
    min-height: 40px;
}

/* Readiness circle skeletons inside grids */
.seo-readiness-circle.skeleton-loader {
    min-height: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
}

/* Tab section skeletons inside grid columns */
.seo-hero-dashboard .skeleton-loader,
.vs-card-charts .skeleton-loader,
.tech-meta-2col .skeleton-loader,
.geo-grid-row3 .skeleton-loader,
.geo-grid-row2 .skeleton-loader {
    width: 100%;
    min-height: 60px;
}

.skeleton-loader * {
    visibility: hidden !important;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Reveal transition when skeleton is removed */
.seo-reveal {
    animation: seoRevealFade 0.3s ease forwards;
}

@keyframes seoRevealFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dynamic loading status text */
#loading-status-text,
#comp-loading-status-text {
    font-size: 15px;
    color: var(--seo-secondary, #666);
    font-weight: 500;
    transition: opacity 0.3s;
}

/* ═══════════════════════════════════════════
   RESULTS & TABS
   ═══════════════════════════════════════════ */
.seo-results {
    margin-top: 30px;
}

.seo-tabs {
    display: flex;
    gap: 0;
    background: var(--seo-surface-alt);
    border-bottom: 2px solid var(--seo-border, #e5e7eb);
    overflow-x: auto;
}

.seo-tab {
    flex: 1;
    padding: 18px var(--seo-space-lg);
    border: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: var(--seo-font-lg);
    font-weight: var(--font-weight, 400);
    color: var(--seo-color-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.seo-tab:hover {
    color: var(--seo-primary, #004cff);
    background: rgba(0, 76, 255, 0.05);
}

.seo-tab.active {
    color: var(--seo-primary, #004cff);
    font-weight: var(--bold-font-weight, 600);
    border-bottom-color: var(--seo-primary, #004cff);
    background: var(--seo-background, #ffffff);
}

.seo-tab-content {
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
    border-top: none;
    border-radius: 0 0 var(--seo-radius-lg) var(--seo-radius-lg);
    padding: var(--seo-space-xl);
}

.seo-tab-panel {
    display: none;
}

.seo-tab-panel.active {
    display: block;
}

/* ═══════════════════════════════════════════
   OVERVIEW TAB
   ═══════════════════════════════════════════ */
.seo-overview-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Row 2 spans full width */
.seo-overview-full {
    grid-column: 1 / -1;
}

/* Section Titles (header bar) */
.seo-section-title {
    font-family: var(--font-family);
    font-size: var(--seo-font-lg);
    font-weight: 700;
    color: var(--color-content-heading, #222222);
    margin: 0;
    padding: 12px var(--seo-space-md) !important;
    background: var(--seo-surface-alt);
    border-bottom: 1px solid var(--seo-border, #ededed);
}

/* Card body padding */
.seo-card-body {
    padding: var(--seo-space-lg);
}

.seo-score-card {
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    padding: 0;
    text-align: center;
    overflow: hidden;
}

/* Detailed Scores card (matches SEO Score card style) */
.seo-detailed-scores-card {
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.seo-detailed-scores-card .seo-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Score Circle */
.seo-score-circle {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
}

.seo-score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.seo-score-number {
    display: block;
    font-size: var(--seo-font-score);
    font-weight: var(--bold-font-weight, 700);
    color: var(--color-content-heading, #222222);
    line-height: 1;
}

/* T1: Hero readiness circles — smaller number to fit within 120px circles */
#seoSitePreview .seo-readiness-circle .seo-score-number {
    font-size: 25px !important;
}

.seo-score-label {
    display: block;
    font-size: var(--seo-font-md);
    color: var(--seo-color-faded);
    margin-top: var(--seo-space-sm);
}

/* Score Status Badge */
.seo-score-status {
    margin-top: var(--seo-space-md);
}

.seo-status-badge {
    display: inline-block;
    padding: var(--seo-space-sm) var(--seo-space-md);
    border-radius: var(--seo-radius-md);
    font-size: var(--seo-font-md);
    font-weight: var(--bold-font-weight, 600);
}

.seo-status-badge.seo-status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--seo-error, #ef4444);
}

.seo-status-badge.seo-status-warning {
    background: rgba(249, 115, 22, 0.1);
    color: var(--seo-warning, #f97316);
}

.seo-status-badge.seo-status-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--seo-success, #10b981);
}

/* Breakdown Bars */
.seo-breakdown-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.seo-breakdown-item {
    display: flex;
    flex-direction: column;
    gap: var(--seo-space-sm);
}

.seo-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.seo-breakdown-label {
    font-size: var(--seo-font-md);
    font-weight: var(--bold-font-weight, 600);
    color: var(--seo-text, #444444);
}

.seo-breakdown-score {
    font-size: 16px;
    font-weight: var(--bold-font-weight, 700);
    color: var(--seo-success, #10b981);
}

.seo-breakdown-bar {
    height: 12px;
    background: var(--seo-surface-muted);
    border-radius: var(--seo-radius-sm);
    overflow: hidden;
}

.seo-breakdown-fill {
    height: 100%;
    background: var(--seo-success, #10b981);
    border-radius: var(--seo-radius-sm);
    transition: width 1s ease, background-color 0.3s ease;
}

/* Recommendations Card */
.seo-recommendations-card {
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    padding: 0;
    overflow: hidden;
}

.seo-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.seo-recommendation {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: var(--seo-space-md);
    border-radius: var(--seo-radius-lg);
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
}

.seo-recommendation.error {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.seo-recommendation.warning {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.2);
}

.seo-recommendation.info {
    background: rgba(0, 76, 255, 0.05);
    border-color: rgba(0, 76, 255, 0.2);
}

.seo-recommendation-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--seo-radius-full);
}

.seo-recommendation.error .seo-recommendation-icon {
    color: var(--seo-error, #ef4444);
    background: rgba(239, 68, 68, 0.1);
}

.seo-recommendation.warning .seo-recommendation-icon {
    color: var(--seo-warning, #f97316);
    background: rgba(249, 115, 22, 0.1);
}

.seo-recommendation.info .seo-recommendation-icon {
    color: var(--seo-primary, #004cff);
    background: rgba(0, 76, 255, 0.1);
}

.seo-recommendation-content {
    flex: 1;
}

.seo-recommendation-content h4 {
    font-family: var(--font-family);
    font-size: var(--seo-font-md);
    font-weight: var(--bold-font-weight, 600);
    margin: 0 0 var(--seo-space-xs) 0;
    color: var(--color-content-heading, #222222);
}

.seo-recommendation-content p {
    margin: 0;
    font-size: var(--seo-font-base);
    line-height: 1.5;
    color: var(--seo-color-muted);
}

/* ═══════════════════════════════════════════
   SITE PREVIEW CARD
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {
    .seo-analyzer-form {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        gap: var(--seo-space-md);
        align-items: end;
    }

    .seo-form-group {
        margin-bottom: 0 !important;
    }
}

.seo-site-preview {
    background: var(--seo-background, #ffffff);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    padding: 20px;
    margin-bottom: 30px;
    display: none;
}

.seo-site-preview.active {
    display: block;
}

.seo-preview-grid {
    display: block;
}

.seo-preview-thumb,
.vs-site-thumb {
    position: relative;
    aspect-ratio: 9 / 7;
    border: 1px solid var(--color-content-border, var(--seo-border));
    border-radius: var(--seo-radius-lg);
    overflow: hidden;
    background: var(--seo-surface-alt);
}

.seo-preview-thumb {
    width: 100%;
    max-width: 360px;
}

.seo-preview-thumb-inner,
.vs-site-thumb-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    gap: var(--seo-space-sm);
}

.seo-preview-thumb-inner img,
.vs-favicon {
    width: 48px;
    height: 48px;
    border-radius: var(--seo-radius-md);
}

.seo-preview-thumb-inner .seo-preview-domain,
.vs-domain-fallback {
    font-size: var(--seo-font-xs);
    color: var(--seo-color-faded);
    text-align: center;
    padding: 0 12px;
    word-break: break-all;
}

/* mShots Preview — container with background-image + dark overlay + centered content */
.seo-mshot-container {
    background-size: cover;
    background-position: top left;
    background-repeat: no-repeat;
    background-color: var(--seo-surface-alt, #1e293b);
    transition: background-image 0.4s ease;
}

.seo-mshot-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
    border-radius: inherit;
}

.seo-mshot-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    gap: 8px;
    padding: 16px;
}

.seo-mshot-favicon {
    width: 50px;
    height: 50px;
    border-radius: var(--seo-radius-md, 8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: #ffffff;
    padding: 5px;
}

.seo-mshot-domain {
    font-size: var(--seo-font-xs, 12px);
    color: #fff;
    text-align: center;
    word-break: break-all;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

/* When mShots loads, hide the fallback inner (favicon+domain shown via overlay instead) */
.seo-mshot-loaded .seo-preview-thumb-inner {
    display: none;
}

.seo-mshot-loaded .vs-site-thumb-inner {
    display: none;
}

.seo-preview-layout {
    display: flex;
    align-items: stretch;
    gap: var(--seo-space-lg);
}

/* Screenshot container: fill parent height */
.seo-preview-layout>.seo-preview-thumb {
    width: 360px;
    flex-shrink: 0;
    max-width: 360px;
    height: auto;
    aspect-ratio: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stats area fills remaining space — equal-height rows */
.seo-preview-layout>.seo-preview-metrics {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--seo-space-md);
}

.seo-metric-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--seo-space-md);
    flex: 1;
}

.seo-metric-row+.seo-metric-row {
    margin-top: 0;
}

.seo-metric-row>.tab-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* ═══════════════════════════════════════════
   EXECUTIVE DASHBOARD — 5-Column Grid
   ═══════════════════════════════════════════ */
.seo-hero-dashboard {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    gap: 20px;
}

/* T2: Screenshot inside hero grid — identical ratio to competitor */
.seo-hero-dashboard>.seo-preview-thumb {
    width: 100%;
    max-width: none;
    aspect-ratio: 9 / 7;
}

/* Readiness items sit in their grid cell, centered */
.seo-readiness-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* T1: Readiness circle uses same structure as main seo-score-circle,
   scaled down to 120px via explicit w/h override */
.seo-readiness-circle {
    width: 120px;
    height: 120px;
}

.seo-readiness-circle svg {
    display: block;
    width: 100%;
    height: 100%;
}

#seoSitePreview .seo-score-circle {
    margin-bottom: 0;
}

.seo-readiness-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-content-heading, #222222);
    text-align: center;
    letter-spacing: 0.02em;
}

/* Readiness info (i) icon */
.seo-readiness-info {
    cursor: pointer;
    font-size: 11px;
    opacity: 0.5;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.seo-readiness-info:hover {
    opacity: 1;
}

/* ─── Competitor card charts (smaller variant) ─── */
.vs-card-charts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-top: var(--seo-space-md);
}

.vs-card-charts .seo-readiness-circle {
    width: 72px;
    height: 72px;
}

.vs-card-charts .seo-readiness-label {
    font-size: var(--seo-font-xs, 11px);
}

.vs-card-charts .seo-score-number {
    font-size: 16px;
}

/* ─── Competitor VS header redesigned ─── */
.vs-header-card .seo-score-circle {
    margin-bottom: 0 !important;
}

.vs-header-card {
    background: var(--seo-background, #fff);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    padding: var(--seo-space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--seo-space-sm);
}

.vs-header-domain {
    font-size: var(--seo-font-base, 14px);
    font-weight: 700;
    letter-spacing: 0.01em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* T2: Competitor card screenshot — identical to main hero */
.vs-card-thumb {
    width: 100%;
    aspect-ratio: 9 / 7;
}

@media (max-width: 768px) {
    .seo-hero-dashboard {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .seo-hero-dashboard>.seo-preview-thumb {
        grid-column: 1 / -1;
        max-width: 360px;
        justify-self: center;
    }

    .vs-card-charts {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════
   SHARED TAB SECTION STYLES
   ═══════════════════════════════════════════ */
.tab-section {
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    overflow: hidden;
    background: var(--seo-background);
    margin-bottom: 20px;
}

.tab-section-title {
    font-size: var(--seo-font-lg);
    font-weight: 700;
    color: var(--color-content-heading, #222);
    padding: 12px var(--seo-space-md);
    background: var(--seo-surface-alt);
    border-bottom: 1px solid var(--seo-border, #ededed);
    margin: 0;
}

/* Tab section divider (AEO sub-heading inside GEO tab) */
.tab-section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 36px 0 20px;
    font-size: var(--seo-font-lg);
    font-weight: 700;
    color: var(--color-content-heading, #222);
}

.tab-section-divider::before,
.tab-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--seo-border, #ededed);
}

.tab-section-divider span {
    white-space: nowrap;
}

.tab-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
    font-size: var(--seo-font-base);
}

.tab-row:last-child {
    border-bottom: none;
}

.tab-row-label {
    color: var(--seo-text);
}

.tab-row-val {
    font-weight: 600;
    color: var(--seo-text);
}

.tab-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--seo-space-md);
    padding: var(--seo-space-md);
}

.tab-stat-card {
    background: #f9fafb;
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    padding: var(--seo-space-md);
    text-align: center;
}

.tab-stat-val {
    font-size: var(--seo-font-xxl);
    font-weight: 700;
    margin-bottom: var(--seo-space-xs);
}

.tab-stat-label {
    font-size: var(--seo-font-sm);
    color: var(--seo-color-muted);
}

.tab-section-body {
    padding: var(--seo-space-md);
    font-size: var(--seo-font-base);
    line-height: 1.7;
    color: var(--seo-text);
}

.tab-section-body.mono {
    font-family: monospace;
    font-size: var(--seo-font-sm);
    line-height: 1.8;
    word-break: break-word;
}

/* Alert row */
.tab-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
}

.tab-alert:last-child {
    border-bottom: none;
}

.tab-alert-icon {
    font-size: var(--seo-font-xl);
    flex-shrink: 0;
}

.tab-alert-text strong {
    display: block;
    font-size: var(--seo-font-base);
    color: #444;
}

.tab-alert-text span {
    font-size: var(--seo-font-sm);
    color: var(--seo-color-muted);
}

/* Heading tag rows */
.tab-heading-row {
    display: flex;
    gap: 12px;
    padding: 10px var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
    font-size: var(--seo-font-base);
    transition: background 0.15s ease;
}

.tab-heading-row:last-child {
    border-bottom: none;
}

.tab-heading-row:hover {
    background: var(--seo-surface-alt);
}

.tab-heading-tag {
    font-size: var(--seo-font-sm);
    font-weight: 700;
    min-width: 32px;
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 4px;
    text-align: center;
    line-height: 1.4;
}

.tab-heading-level-1 {
    background: rgba(79, 70, 229, 0.12);
    color: #4f46e5;
}

.tab-heading-level-2 {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.tab-heading-level-3 {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.tab-heading-level-4 {
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
}

.tab-heading-level-5 {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.tab-heading-level-6 {
    background: rgba(107, 114, 128, 0.08);
    color: #9ca3af;
}

/* Readability progress bars */
.tab-bar-row {
    padding: 10px var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
}

.tab-bar-row:last-child {
    border-bottom: none;
}

.tab-bar-label {
    font-size: var(--seo-font-base);
    color: #444;
    margin-bottom: var(--seo-space-sm);
}

.tab-bar-track {
    height: 8px;
    background: var(--seo-surface-muted);
    border-radius: var(--seo-space-xs);
    overflow: hidden;
}

.tab-bar-fill {
    height: 100%;
    border-radius: var(--seo-space-xs);
    transition: width 0.6s ease;
}

/* Meta preview blocks */
.tab-meta-block {
    padding: var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
}

.tab-meta-block:last-child {
    border-bottom: none;
}

.tab-meta-label {
    font-size: var(--seo-font-xs);
    font-weight: 700;
    color: var(--seo-color-faded);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--seo-space-xs);
}

.tab-meta-text {
    font-size: var(--seo-font-base);
    color: var(--seo-text);
    line-height: 1.5;
    word-break: break-word;
}

.tab-meta-status {
    margin-top: var(--seo-space-sm);
    font-size: var(--seo-font-sm);
}

/* Column grids */
.tab-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.tab-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

/* GEO/AEO tab grid rows (desktop) */
@media (min-width: 768px) {
    .geo-grid-row3 {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }

    .geo-grid-row2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }

    .geo-grid-row3>.tab-section,
    .geo-grid-row2>.tab-section {
        margin-bottom: 0;
    }

    .tech-meta-2col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }

    .tech-meta-2col>.tab-section {
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .tech-meta-2col>.tab-section>.seo-kw-result {
        margin-top: auto;
    }
}

@media (max-width: 767px) {

    .geo-grid-row3,
    .geo-grid-row2,
    .tech-meta-2col {
        display: block;
    }
}

/* ═══════════════════════════════════════════
   SCHEMA CARD (Technical + Competitor)
   ═══════════════════════════════════════════ */
.schema-status-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--seo-space-md);
    padding: var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
}

.schema-status-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.schema-status-title {
    margin: 0;
    font-size: var(--seo-font-md);
    font-weight: 600;
    color: var(--seo-text);
}

.schema-status-desc {
    margin: var(--seo-space-xs) 0 0;
    font-size: var(--seo-font-base);
    color: var(--seo-color-muted);
}

.schema-accordion-item {
    border-bottom: 1px solid var(--seo-surface-muted);
}

.schema-accordion-item:last-child {
    border-bottom: none;
}

.schema-accordion-header {
    padding: 12px var(--seo-space-md);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.15s;
}

.schema-accordion-header:hover {
    background: var(--seo-surface-alt);
}

.schema-format-badge {
    display: inline-block;
    font-size: var(--seo-font-xs);
    font-weight: 700;
    padding: 3px var(--seo-space-sm);
    border-radius: var(--seo-radius-pill);
    background: rgba(0, 76, 255, 0.1);
    color: var(--seo-primary);
    margin-right: 10px;
}

.schema-type-name {
    font-weight: 600;
    font-size: var(--seo-font-base);
    color: var(--seo-text);
}

.schema-toggle-icon {
    font-size: var(--seo-font-md);
    color: #999;
    transition: transform 0.2s;
}

.schema-accordion-content {
    display: none;
    border-top: 1px solid var(--seo-surface-muted);
    background: var(--seo-surface-code);
}

.schema-code-wrap {
    padding: var(--seo-space-md);
    max-height: 500px;
    overflow-y: auto;
}

.schema-code-wrap code {
    font-family: monospace;
    font-size: var(--seo-font-base);
    line-height: 1.8;
}

/* Competitor: side-by-side schema detail */
.vs-schema-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.vs-schema-col {
    min-width: 0;
}

.vs-schema-col:first-child {
    border-right: 1px solid var(--seo-surface-muted);
}

.vs-schema-col-head {
    padding: var(--seo-space-sm) var(--seo-space-md);
    font-size: var(--seo-font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--seo-surface-code);
    border-bottom: 1px solid var(--seo-surface-muted);
}

.vs-schema-col-head.col-you {
    color: var(--seo-primary);
}

.vs-schema-col-head.col-comp {
    color: var(--seo-error);
}

.vs-schema-col-body {
    padding: 0;
}

/* ═══════════════════════════════════════════
   COMPETITOR TAB — VS PANEL
   ═══════════════════════════════════════════ */
.seo-competitor-form-wrap {
    margin-bottom: 10px;
}

.seo-competitor-form-wrap h3 {
    font-family: var(--h3-font-family, var(--font-family));
    font-size: var(--h3-font-size, 1.4rem);
    font-weight: var(--h3-font-weight, 400);
    color: var(--color-content-heading, #222222);
    margin: 0 0 var(--seo-space-md) 0;
}

.seo-competitor-explanation {
    font-size: var(--seo-font-sm, 13px);
    color: var(--seo-color-muted, #888);
    line-height: 1.6;
    margin: 0 0 var(--seo-space-md) 0;
}

.seo-competitor-google-btn {
    margin-bottom: var(--seo-space-md);
    text-decoration: none !important;
}

.seo-competitor-input-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.seo-competitor-input-row .seo-input {
    flex: 1;
}

/* VS Header */
.vs-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    align-items: center;
    margin-bottom: 20px;
}

.vs-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--seo-radius-full);
    background: #1a1a2e;
    color: #fff;
    font-size: var(--seo-font-md);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 -4px;
    z-index: 3;
    flex-shrink: 0;
}

/* Ranking Badge */
.vs-ranking-badge {
    display: flex;
    align-items: center;
    gap: var(--seo-space-md);
    padding: var(--seo-space-md) 18px;
    border-radius: var(--seo-radius-lg);
    margin: 0 auto 22px;
    max-width: 480px;
    border: 1px solid;
    justify-content: center;
}

.vs-ranking-badge.vs-ranking-error {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.vs-ranking-badge.vs-ranking-success {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.vs-ranking-badge.vs-ranking-warning {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.2);
}

.vs-ranking-icon {
    font-size: 26px;
    flex-shrink: 0;
    line-height: 1;
}

.vs-ranking-error .vs-ranking-icon {
    color: var(--seo-error);
}

.vs-ranking-success .vs-ranking-icon {
    color: var(--seo-success);
}

.vs-ranking-warning .vs-ranking-icon {
    color: var(--seo-warning);
}

.vs-ranking-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vs-ranking-text {
    font-size: var(--seo-font-md);
    color: var(--seo-text);
}

.vs-ranking-gap {
    font-size: var(--seo-font-base);
    font-weight: 700;
}

.vs-ranking-error .vs-ranking-gap {
    color: var(--seo-error);
}

.vs-ranking-success .vs-ranking-gap {
    color: var(--seo-success);
}

.vs-ranking-warning .vs-ranking-gap {
    color: var(--seo-warning);
}

/* Grid */
.vs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

/* Section Groups — 2-column card layout on desktop */
.vs-group {
    margin-bottom: var(--seo-space-xl);
}

.vs-group:last-child {
    margin-bottom: 0;
}

.vs-group-cards>.vs-section {
    min-width: 0;
}

@media (min-width: 768px) {
    .vs-group-cards {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .vs-group-cards>.vs-section {
        width: 100%;
    }

    .vs-group-cards>.vs-fullwidth-section,
    .vs-group-cards>.tab-section.vs-fullwidth-section {
        grid-column: 1 / -1;
    }
}

/* Space between Scores box and first section group */
.vs-group-first {
    margin-top: 50px !important;
}

.vs-group-heading {
    font-family: var(--h3-font-family, var(--font-family));
    font-size: var(--h3-font-size, 1.25rem);
    font-weight: var(--h3-font-weight, 600);
    color: var(--color-content-heading, #222);
    margin: 0 0 18px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--seo-primary);
}

.vs-fullwidth-section {
    margin-bottom: 18px;
}

/* Centered scores wrapper */
.vs-scores-center {
    max-width: 600px;
    margin: 0 auto 24px;
}

/* Reading Grade Badge */
.seo-reading-grade {
    font-weight: 700;
}

/* Section Card */
.vs-section {
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    overflow: hidden;
    background: var(--seo-background);
}

.vs-section-title {
    font-size: var(--seo-font-lg);
    font-weight: 700;
    color: var(--color-content-heading, #222);
    padding: 12px var(--seo-space-md);
    background: var(--seo-surface-alt);
    border-bottom: 1px solid var(--seo-border, #ededed);
    margin: 0;
}

/* Table Head */
.vs-table-head {
    display: grid;
    grid-template-columns: 1fr 90px 90px;
    padding: var(--seo-space-sm) var(--seo-space-md);
    border-bottom: 1px solid #f0f1f3;
    background: var(--seo-surface-code);
}

.vs-th-you,
.vs-th-comp {
    font-size: var(--seo-font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-th-you {
    color: var(--seo-primary);
}

.vs-th-comp {
    color: var(--seo-error);
}

/* Data Rows */
.vs-row {
    display: grid;
    grid-template-columns: 1fr 90px 90px;
    padding: 9px var(--seo-space-md);
    border-bottom: 1px solid var(--seo-surface-muted);
    align-items: center;
}

.vs-row:last-of-type {
    border-bottom: none;
}

.vs-row-label {
    font-size: var(--seo-font-base);
    color: var(--seo-text);
}

.vs-row-val {
    text-align: center;
    font-size: var(--seo-font-base);
    font-weight: 600;
    color: var(--seo-text);
}

/* Pill badges */
.vs-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--seo-radius-sm);
    font-size: var(--seo-font-base);
    font-weight: 700;
    line-height: 1.4;
}

.vs-pill.vs-winner {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
}

.vs-pill.vs-loser {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.10);
}

/* Check icons */
.vs-check-ok,
.vs-check-fail,
.vs-check-warn,
.vs-check-unknown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--seo-radius-full);
    font-size: var(--seo-font-md);
    font-weight: 700;
}

.vs-check-ok {
    background: rgba(16, 185, 129, 0.12);
    color: var(--seo-success);
}

.vs-check-fail {
    background: rgba(239, 68, 68, 0.10);
    color: var(--seo-error);
}

.vs-check-warn {
    background: rgba(249, 115, 22, 0.12);
    color: var(--seo-warning);
}

.vs-check-unknown {
    background: rgba(156, 163, 175, 0.12);
    color: var(--seo-secondary);
}

/* Meta Preview */
.vs-meta-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--seo-surface-muted);
}

.vs-meta-col {
    padding: var(--seo-space-md);
}

.vs-meta-col:first-child {
    border-right: 1px solid var(--seo-surface-muted);
}

.vs-meta-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--seo-color-faded);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--seo-space-xs);
}

.vs-meta-text {
    font-size: var(--seo-font-sm);
    color: var(--seo-text);
    line-height: 1.5;
    word-break: break-word;
}

/* ═══════════════════════════════════════════
   SOCIAL PREVIEW CARDS (Side-by-Side Grid)
   ═══════════════════════════════════════════ */
.social-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--seo-space-md);
}

@media (max-width: 860px) {
    .social-grid {
        grid-template-columns: 1fr;
    }
}

.social-grid-col>.tab-section {
    margin-bottom: 0;
}

.social-preview-card {
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-lg);
    overflow: hidden;
    background: var(--seo-surface-alt, #fafafa);
    margin: var(--seo-space-md);
    margin-bottom: var(--seo-space-sm);
}

.social-preview-img {
    width: 100%;
    overflow: hidden;
    background: #f0f0f0;
}

.social-preview-img-og {
    aspect-ratio: 1.91 / 1;
}

.social-preview-img img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.social-preview-body {
    padding: 14px 16px;
}

.social-preview-url {
    font-size: 11px;
    color: var(--seo-color-faded, #888);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.social-preview-title {
    font-size: var(--seo-font-md, 16px);
    font-weight: 600;
    color: var(--seo-text, #333);
    margin-bottom: 4px;
    line-height: 1.3;
}

.social-preview-desc {
    font-size: var(--seo-font-sm, 13px);
    color: var(--seo-color-muted, #666);
    line-height: 1.45;
}

.social-preview-twitter {
    border-color: #cfd9de;
}

/* ═══════════════════════════════════════════
   N-GRAM DENSITY TABS
   ═══════════════════════════════════════════ */
.seo-ngram-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--seo-space-sm, 10px);
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-sm, 6px);
    overflow: hidden;
    width: 100%;
}

.seo-ngram-tab {
    flex: 1;
    padding: 6px 16px;
    font-size: var(--seo-font-sm, 13px);
    font-weight: 500;
    color: var(--seo-color-muted, #666);
    background: var(--seo-background, #fff);
    border: none;
    border-right: 1px solid var(--seo-border, #ededed);
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.3;
    text-align: center;
}

.seo-ngram-tab:last-child {
    border-right: none;
}

.seo-ngram-tab:hover {
    background: var(--seo-surface-alt, #f5f5f5);
}

.seo-ngram-tab.active {
    background: var(--seo-primary, #004cff);
    color: #fff;
}

/* ═══════════════════════════════════════════
   HISTORY & PROGRESS
   ═══════════════════════════════════════════ */
.hist-section {
    margin-bottom: var(--seo-space-md);
}

.hist-row .hist-from {
    opacity: 0.55;
    font-weight: 400;
}

.hist-improvements .tab-section-title {
    background: rgba(16, 185, 129, 0.04);
}

.hist-regressions .tab-section-title {
    background: rgba(239, 68, 68, 0.03);
}

.hist-unchanged .tab-section-title {
    background: var(--seo-surface-alt, #fafafa);
}

/* ═══════════════════════════════════════════
   INFO MODAL (replaces hover tooltips)
   ═══════════════════════════════════════════ */

/* (ⓘ) icon — inline next to section titles */
.seo-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    font-size: 14px;
    line-height: 1;
    color: var(--seo-color-faded, #9ca3af);
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
    vertical-align: middle;
    -webkit-user-select: none;
    user-select: none;
}

.seo-info-icon:hover,
.seo-info-icon:focus {
    color: var(--seo-primary, #004cff);
    transform: scale(1.15);
    outline: none;
}

/* Smart Metric Trigger — anchor wrapper from render_metric_label() */
.seo-metric-trigger {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

.seo-metric-trigger:hover {
    color: var(--seo-primary, #004cff);
}

.seo-metric-trigger:hover .seo-info-icon {
    color: var(--seo-primary, #004cff);
    transform: scale(1.15);
}

/* Full-screen overlay */
#seo-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 99999;
    display: none;
}

/* Centered modal box */
#seo-modal-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    padding: 28px 30px 28px;
    border-radius: 16px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
}

/* Header row: title + close aligned */
#seo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
}

/* Close button (X) */
#seo-modal-close {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--seo-radius-full, 50%);
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}

#seo-modal-close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.06);
}

/* Modal title */
#seo-modal-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

/* Modal body text */
#seo-modal-body {
    margin: 0 0 18px 0;
    font-size: 15px;
    line-height: 1.65;
    color: #4b5563;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

#seo-modal-body p {
    margin: 0 0 10px 0;
}

#seo-modal-body p:last-child {
    margin-bottom: 0;
}

#seo-modal-body strong,
#seo-modal-body b {
    font-weight: 700;
    color: #1a1a2e;
}

#seo-modal-body ul,
#seo-modal-body ol {
    margin: 8px 0 8px 18px;
    padding: 0;
}

#seo-modal-body li {
    margin-bottom: 4px;
}

#seo-modal-body a {
    color: var(--seo-primary, #004cff);
    text-decoration: underline;
}

/* Learn more link */
#seo-modal-link {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--seo-primary, #004cff) !important;
    text-decoration: none !important;
    transition: color 0.15s;
}

#seo-modal-link:hover {
    color: #0036b3 !important;
    text-decoration: underline !important;
}

/* Drill-down clickable stat values */
.seo-drill-trigger,
.drill-down-trigger {
    cursor: pointer;
    color: inherit;
    transition: opacity 0.15s;
}

.seo-drill-trigger:hover,
.drill-down-trigger:hover {
    opacity: 0.7;
}

.seo-drill-icon {
    color: var(--seo-primary, #004cff);
    font-size: 0.7em;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.15s;
}

.seo-drill-trigger:hover .seo-drill-icon,
.drill-down-trigger:hover .seo-drill-icon {
    transform: scale(1.2);
}

/* Drill-down inside stat cards — keep the parent's font size */
.tab-stat-val .seo-drill-trigger {
    font-size: inherit;
    font-weight: inherit;
}

/* Drill-down inside vs-pill (competitor tab) */
.vs-pill .seo-drill-trigger {
    font-size: inherit;
    font-weight: inherit;
}

/* Drill-down modal list styles */
.seo-drill-list {
    max-height: 400px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
}

.seo-drill-list ol {
    padding-left: 24px;
    margin: 0;
}

.seo-drill-list li {
    margin-bottom: 6px;
    word-break: break-all;
}

.seo-drill-list a {
    color: var(--seo-primary, #004cff);
}

.seo-drill-kw-match {
    text-decoration: underline;
    color: var(--seo-primary, #004cff);
}

/* Admin tooltip table (Settings page) */
.seo-tooltip-group-heading {
    margin: 24px 0 8px;
    padding: 10px 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 2px solid #2271b1;
}

.seo-tooltip-table th {
    width: 160px;
}

/* ═══════════════════════════════════════════
   DRILL-DOWN TABLES & BADGES
   ═══════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.seo-drill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.seo-drill-table th,
.seo-drill-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--seo-border, #ededed);
    vertical-align: middle;
}

.seo-drill-table thead th {
    background: var(--seo-surface-alt, #f8f9fb);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--seo-color-muted, #666);
    white-space: nowrap;
}

.seo-drill-table tbody tr:hover {
    background: var(--seo-surface-alt, #f8f9fb);
}

.seo-drill-cell-name {
    max-width: 260px;
    word-break: break-all;
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: 12px;
}

.seo-drill-cell-sub {
    font-family: inherit;
    font-size: 11px;
    color: var(--seo-color-muted, #666);
    margin-top: 2px;
    word-break: break-word;
    font-style: italic;
}

/* Badges */
.seo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.seo-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--seo-success, #10b981);
}

.seo-badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--seo-error, #ef4444);
}

.seo-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--seo-warning, #f59e0b);
}

/* Drill-down action button */
.seo-drill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-sm, 6px);
    background: var(--seo-background, #fff);
    color: var(--seo-primary, #004cff);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s;
}

.seo-drill-btn:hover {
    background: var(--seo-primary, #004cff);
    color: #fff !important;
    border-color: var(--seo-primary, #004cff);
}

/* Keyword gamification messages */
.seo-kw-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px var(--seo-space-md, 16px);
    border-radius: var(--seo-radius-sm, 6px);
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

.seo-kw-result.success {
    background: rgba(16, 185, 129, 0.06);
    color: var(--seo-success, #10b981);
}

.seo-kw-result.warning {
    background: rgba(239, 68, 68, 0.04);
    color: var(--seo-error, #ef4444);
}

/* ═══════════════════════════════════════════
   MAGIC PROMPT (Admin Only)
   ═══════════════════════════════════════════ */
.magic-prompt-wrap {
    border: 2px solid var(--seo-primary, #004cff);
    border-radius: var(--seo-radius-lg);
    padding: 28px 26px;
    background: linear-gradient(135deg, rgba(0, 76, 255, 0.03) 0%, rgba(99, 102, 241, 0.04) 100%);
}

.magic-prompt-header {
    margin-bottom: 20px;
}

.magic-prompt-header-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.magic-prompt-icon {
    font-size: 22px;
    color: var(--seo-primary);
    line-height: 1;
}

.magic-prompt-header-text h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-content-heading, #1a1a2e);
}

.magic-prompt-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(0, 76, 255, 0.10);
    color: var(--seo-primary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.magic-prompt-desc {
    margin: 8px 0 0;
    font-size: var(--seo-font-sm);
    color: var(--seo-color-muted);
    line-height: 1.5;
}

#magic-prompt-container {
    margin-top: 18px;
}

#magic-prompt-text {
    width: 100%;
    height: 320px;
    padding: 16px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: #e2e8f0;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--seo-radius-md);
    resize: vertical;
    white-space: pre-wrap;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch;
}

#magic-prompt-text:focus {
    outline: none;
    border-color: var(--seo-primary);
}

.magic-prompt-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .seo-overview-layout {
        grid-template-columns: 1fr;
    }

    .seo-overview-full {
        grid-column: auto;
    }
}

@media (max-width: 768px) {

    .seo-analyzer-card,
    .seo-tab-content {
        padding: 20px;
    }

    .seo-tabs {
        overflow-x: auto;
    }

    .seo-tab {
        flex: 0 0 auto;
        min-width: 120px;
    }

    .seo-score-card,
    .seo-recommendations-card {
        padding: 0;
    }

    .seo-card-body {
        padding: var(--seo-space-md);
    }

    .seo-competitor-input-row {
        flex-direction: column;
    }

    .seo-competitor-input-row .seo-input {
        width: 100%;
    }

    .seo-action-buttons {
        width: 100%;
        justify-content: center;
    }

    .seo-force-refresh-btn {
        width: auto !important;
    }

    .seo-clear-all-btn {
        width: auto !important;
    }

    .vs-header {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .vs-badge {
        margin: 0 auto;
    }

    .vs-header-card {
        width: 100%;
    }

    .vs-grid {
        grid-template-columns: 1fr;
        gap: var(--seo-space-md);
    }

    .vs-table-head,
    .vs-row {
        grid-template-columns: 1fr 70px 70px;
        padding: 9px 12px;
    }

    .vs-th-you,
    .vs-th-comp {
        font-size: 10px;
        letter-spacing: 0;
    }

    .vs-pill {
        padding: 2px var(--seo-space-sm);
        font-size: var(--seo-font-sm);
    }

    .vs-meta-preview {
        grid-template-columns: 1fr;
    }

    .vs-meta-col:first-child {
        border-right: none;
        border-bottom: 1px solid var(--seo-surface-muted);
    }

    .vs-schema-detail {
        grid-template-columns: 1fr;
    }

    .vs-schema-col:first-child {
        border-right: none;
        border-bottom: 1px solid var(--seo-border, #ededed);
    }

    .seo-preview-layout {
        flex-direction: column;
        gap: var(--seo-space-md);
    }

    .seo-preview-layout>.seo-preview-thumb {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 16 / 10;
        flex-shrink: 1;
    }

    .seo-preview-metrics {
        width: 100%;
    }

    .seo-metric-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        flex: none;
    }

    .tab-stat-card {
        padding: 12px var(--seo-space-sm);
    }

    .tab-stat-val {
        font-size: 22px;
    }

    .tab-2col,
    .tab-3col {
        grid-template-columns: 1fr;
        gap: var(--seo-space-md);
    }

    .tab-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Modal: tighter on mobile */
    #seo-modal-box {
        width: 92%;
        padding: 24px 20px 22px;
    }

    #seo-modal-title {
        font-size: 17px;
    }

    #seo-modal-body {
        font-size: 14px;
    }

    /* Magic Prompt mobile */
    .magic-prompt-wrap {
        padding: 20px 16px;
    }

    .magic-prompt-header-text h3 {
        font-size: 17px;
    }

    #magic-prompt-text {
        height: 240px;
        font-size: 11.5px;
    }
}

/* ═══════════════════════════════════════════════
   CSS-ONLY TOOLTIP — [data-inspero-tooltip]
   ═══════════════════════════════════════════════ */
[data-inspero-tooltip] {
    position: relative;
}

[data-inspero-tooltip]::before,
[data-inspero-tooltip]::after {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 100001;
}

[data-inspero-tooltip]::before {
    content: attr(data-inspero-tooltip);
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    min-width: 180px;
    max-width: 260px;
    white-space: normal;
    padding: 7px 12px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
}

[data-inspero-tooltip]::after {
    content: '';
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a1a2e;
}

[data-inspero-tooltip]:hover::before,
[data-inspero-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

/* ═══════════════════════════════════════════════
   RECOMMENDATION ANCHOR FLASH ANIMATION
   ═══════════════════════════════════════════════ */
@keyframes seo-flash-highlight {
    0% {
        box-shadow: 0 0 0 4px var(--seo-primary, #004cff);
        outline-color: var(--seo-primary, #004cff);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(0, 76, 255, 0.2);
        outline-color: rgba(0, 76, 255, 0.5);
    }

    100% {
        box-shadow: none;
        outline-color: transparent;
    }
}

.seo-flash-target {
    animation: seo-flash-highlight 2s ease-out;
    outline: 2px solid var(--seo-primary, #004cff);
    outline-offset: 4px;
    border-radius: var(--seo-radius-lg, 10px);
}

.seo-recommendation-link {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.seo-recommendation-link:hover {
    text-decoration-style: solid;
    color: var(--seo-primary, #004cff);
}

/* ═══════════════════════════════════════════════
   COMPARISON TABLE (Competitor Scores)
   ═══════════════════════════════════════════════ */
.seo-comp-table {
    width: 100%;
    overflow-x: auto;
}

.seo-comp-table-inner {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--seo-border, #e5e7eb);
    border-radius: var(--seo-radius-lg, 10px);
    overflow: hidden;
}

.seo-comp-table-inner th {
    background: var(--seo-surface-alt, #f8fafc);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px;
    text-align: center;
    color: var(--seo-text, #333);
    border-bottom: 2px solid var(--seo-border, #e5e7eb);
}

.seo-comp-th-metric {
    text-align: left !important;
    width: 50%;
}

.seo-comp-th-you,
.seo-comp-th-comp {
    width: 25%;
}

.seo-comp-table-inner td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--seo-border, #e5e7eb);
    font-size: 13px;
}

.seo-comp-table-inner tr:last-child td {
    border-bottom: none;
}

.seo-comp-metric {
    font-weight: 600;
    color: var(--seo-text, #333);
}

.seo-comp-cell {
    text-align: center;
}

.seo-score-pill {
    display: inline-block;
    min-width: 38px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    line-height: 1;
}

.seo-pill-good {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.seo-pill-ok {
    background: rgba(249, 115, 22, 0.12);
    color: #d97706;
}

.seo-pill-bad {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

/* ═══ v5.0.0: Linguistic Analysis Cards ═══ */
.seo-snippet-list {
    list-style: none;
    padding: 0;
    margin: var(--seo-space-sm) 0 0;
}

.seo-snippet-item {
    padding: 10px var(--seo-space-md);
    border-left: 3px solid var(--seo-warning);
    background: rgba(249, 115, 22, 0.03);
    margin-bottom: 6px;
    border-radius: 0 var(--seo-radius-sm) var(--seo-radius-sm) 0;
    font-size: var(--seo-font-sm);
    line-height: 1.5;
    color: var(--seo-text);
}

.seo-snippet-item.seo-snippet-error {
    border-left-color: var(--seo-error);
    background: rgba(239, 68, 68, 0.03);
}

.seo-snippet-item.seo-snippet-success {
    border-left-color: var(--seo-success);
    background: rgba(16, 185, 129, 0.03);
}

.seo-snippet-wc {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--seo-warning);
    margin-left: 6px;
    opacity: 0.8;
}

.seo-word-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: var(--seo-space-sm) 0;
}

.seo-word-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    background: var(--seo-surface-alt, #f3f4f6);
    color: var(--seo-text);
    line-height: 1.4;
}

.seo-word-pill .pill-count {
    font-size: 10px;
    opacity: 0.6;
    font-weight: 400;
}

/* ═══════════════════════════════════════════
   v5.7.0: HELPER TEXT, TAB INTROS & LOADING OPTIN
   ═══════════════════════════════════════════ */
.seo-helper-text {
    display: block;
    margin-top: 6px;
    color: #8c8c8c;
    font-size: 14px;
    line-height: 1.4;
}

.seo-tab-intro-content {
    margin-bottom: 20px;
}

.seo-loading-optin {
    margin-top: var(--seo-space-lg);
    padding: var(--seo-space-md) var(--seo-space-lg);
}

.seo-loading-optin-text {
    font-weight: 600;
    margin: 0 0 12px;
}

/* ═══════════════════════════════════════════
   v5.7.0: COMPETITOR STEPS (3-step form guide)
   ═══════════════════════════════════════════ */
.seo-comp-steps {
    margin: 20px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.seo-comp-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.seo-comp-step-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--seo-radius-full);
    background: var(--color-content-primary, var(--seo-primary, #004cff));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.seo-comp-step-text {
    margin: 0 0 10px;
    font-weight: 500;
}

.seo-comp-step-text-only {
    margin: 0;
}

/* ═══════════════════════════════════════════
   v5.7.0: CRO — CTA BLOCKS (Hero, Footer, Competitor)
   ═══════════════════════════════════════════ */

/* Shared CTA text */
.seo-cta-text {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--color-content-text, var(--seo-text, #444));
}

.seo-cta-text-warning {
    color: var(--seo-error, #ef4444);
}

.seo-cta-text-success {
    color: var(--seo-success, #10b981);
}

/* Shared CTA link row */
.seo-cta-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Inline CTA button links */
.seo-cta-link {
    margin: 0 8px 8px 0;
    display: inline-block;
}

/* Hero Dashboard CTA */
.seo-hero-cta {
    grid-column: 1 / -1;
    margin-top: var(--seo-space-lg);
    padding: 20px 28px;
    border-radius: var(--seo-radius-lg);
    border: 1px solid var(--color-content-border, var(--seo-border, #ededed));
    background: var(--color-content-bg-alt, var(--seo-background, #fff));
    text-align: center;
}

/* Tab Footer CTA */
.seo-tab-footer-cta {
    margin-top: 30px;
    padding: var(--seo-space-lg);
    border-radius: var(--seo-radius-lg);
    border: 1px solid var(--color-content-border, var(--seo-border, #ededed));
    background: var(--color-content-bg-alt, var(--seo-background, #fff));
    text-align: center;
}

/* Competitor Kill-Switch CTA */
.seo-comp-cta {
    margin: 20px 0;
    padding: var(--seo-space-lg);
    border-radius: var(--seo-radius-lg);
    border: 2px solid var(--color-content-primary, var(--seo-primary, #004cff));
    background: var(--color-content-bg-alt, var(--seo-background, #fff));
    text-align: center;
}

/* ═══════════════════════════════════════════
   v5.7.0: FLAT HOVER STATES
   ═══════════════════════════════════════════ */
.seo-tab-footer-cta:hover,
.seo-comp-cta:hover {
    border-color: var(--color-content-primary, var(--seo-primary, #004cff));
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

.tab-stat-card {
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.tab-stat-card:hover {
    border-color: var(--color-content-primary, var(--seo-primary, #004cff));
    transform: translateY(-2px);
}

.tab-section {
    transition: border-color 0.2s ease;
}

/* ═══════════════════════════════════════════
   v5.7.0: TABLE ALTERNATING ROWS
   ═══════════════════════════════════════════ */
.seo-drill-table tbody tr:nth-child(even) {
    background: var(--color-content-bg, var(--seo-surface-alt, #f8f9fb));
}

.seo-comp-table-inner tbody tr:nth-child(even) {
    background: var(--color-content-bg, var(--seo-surface-alt, #f8f9fb));
}

.vs-row:nth-child(even) {
    background: var(--color-content-bg, var(--seo-surface-alt, #f8f9fb));
}

/* ═══════════════════════════════════════════
   v5.8.0: AI PROMPT GENERATOR (Competitor Tab)
   ═══════════════════════════════════════════ */
.ai-prompt-section {
    margin-top: 30px;
    border: 2px solid var(--color-content-primary, var(--seo-primary, #004cff));
    border-radius: var(--seo-radius-lg, 10px);
    padding: 28px 26px;
    background: linear-gradient(135deg, rgba(0, 76, 255, 0.03) 0%, rgba(99, 102, 241, 0.04) 100%);
}

.ai-prompt-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-content-heading, #1a1a2e);
}

.ai-prompt-title i {
    color: var(--seo-primary, #004cff);
    font-size: 22px;
}

/* Lock Screen */
.ai-prompt-lock {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.ai-prompt-lock input[type="password"] {
    padding: 10px 14px;
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-sm, 6px);
    font-size: 14px;
    background: var(--color-content-bg, var(--seo-background, #fff));
    color: var(--seo-text, #333);
    width: 200px;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-prompt-lock input[type="password"]:focus {
    border-color: var(--color-content-primary, var(--seo-primary, #004cff));
}

.ai-prompt-unlock-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--seo-radius-sm, 6px);
    background: var(--color-content-primary, var(--seo-primary, #004cff));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.ai-prompt-unlock-btn:hover {
    opacity: 0.85;
}

/* Hidden content wrapper */
.ai-prompt-content {
    margin-top: 20px;
}

/* Language mismatch warning */
.ai-prompt-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
    border-radius: var(--seo-radius-sm, 6px);
    border: 2px solid var(--seo-error, #ef4444);
    background: rgba(239, 68, 68, 0.06);
    color: var(--seo-text, #333);
    font-size: 14px;
    line-height: 1.55;
}

.ai-prompt-warning i {
    color: var(--seo-error, #ef4444);
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Prompt textarea */
.ai-prompt-textarea {
    width: 100%;
    height: 320px;
    padding: 16px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: #e2e8f0;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--seo-radius-md, 8px);
    resize: vertical;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-prompt-textarea:focus {
    outline: none;
    border-color: var(--seo-primary, #004cff);
}

/* Copy button */
.ai-prompt-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

.ai-prompt-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--seo-border, #ededed);
    border-radius: var(--seo-radius-sm, 6px);
    background: var(--color-content-bg, var(--seo-background, #fff));
    color: var(--seo-primary, #004cff);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-prompt-copy-btn:hover {
    background: var(--seo-primary, #004cff);
    color: #fff;
    border-color: var(--seo-primary, #004cff);
}

.ai-prompt-copy-btn.copied {
    background: var(--seo-success, #10b981);
    color: #fff;
    border-color: var(--seo-success, #10b981);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-prompt-section {
        padding: 20px 16px;
    }

    .ai-prompt-title {
        font-size: 17px;
    }

    .ai-prompt-textarea {
        height: 240px;
        font-size: 11.5px;
    }

    .ai-prompt-lock input[type="password"] {
        width: 100%;
    }
}