/* ═══════════════════════════════════════════════════════
   COCKPIT v4 — VISUAL REFRESH (v2.58.1)
   Modern dashboard overhaul: gradients, glassmorphism,
   brand icons, animated charts, depth & motion
   
   Extracted from cockpit.html for maintainability.
   To rollback: remove <link> to this file in cockpit.html.
   ═══════════════════════════════════════════════════════ */

/* ── Animated Background Mesh ── */
body {
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 30%, #ecfdf5 55%, #f0fdf4 80%, #fafafa 100%);
    background-attachment: fixed;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(5,150,105,0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(99,102,241,0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(6,182,212,0.03) 0%, transparent 50%);
    animation: meshDrift 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}
@keyframes meshDrift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(2%, -2%) rotate(1deg); }
}
/* Reduce animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
    .no-data .icon-ring { animation: none; }
    .scan-progress .bar { animation: progress-sweep 2s ease-in-out forwards; }
    .card, .fix-item, .geo-cell, .feed-item, .score-click-wrap,
    .btn-primary, .btn-probe, .btn-recipe, .sb-item, .gbp-stat-card {
        transition: none;
    }
}

/* ── Enhanced Navbar ── */
.navbar {
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(20px) saturate(1.8);
    border-bottom: 1px solid rgba(226,232,240,0.5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 20px rgba(0,0,0,0.02);
}
.nav-brand {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}
.btn-scan-nav {
    background: linear-gradient(135deg, #059669, #0d9488);
    box-shadow: 0 2px 8px rgba(5,150,105,0.3);
    border-radius: 10px;
    transition: all 0.3s;
}
.btn-scan-nav:hover {
    box-shadow: 0 4px 16px rgba(5,150,105,0.4);
    transform: translateY(-1px);
}

/* ── Glass Cards ── */
.card {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(16px) saturate(1.6);
    border: 1px solid rgba(226,232,240,0.5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04),
                0 4px 16px rgba(0,0,0,0.04),
                inset 0 1px 0 rgba(255,255,255,0.8);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06),
                0 12px 40px rgba(0,0,0,0.08),
                inset 0 1px 0 rgba(255,255,255,0.9);
}
.card h3 {
    background: linear-gradient(135deg, var(--text-dark), #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.card h3 i {
    -webkit-text-fill-color: initial;
    background: none;
}

/* ── Dashboard Header — Dark Gradient Banner ── */
.id-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #1a3a4a 100%);
    border: none;
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: 0 8px 32px rgba(15,23,42,0.25),
                0 2px 8px rgba(0,0,0,0.15),
                inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}
.id-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(5,150,105,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.id-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(6,182,212,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.id-name { color: #f1f5f9; }
.live-dot { color: #4ade80; }
.live-dot::before { background: #4ade80; }
.tier-badge { border: 1px solid rgba(255,255,255,0.15); }
.tier-badge.free { background: rgba(100,116,139,0.3); color: #cbd5e1; }
.btn-new-scan {
    border-color: rgba(5,150,105,0.5);
    background: rgba(5,150,105,0.15);
    color: #4ade80;
}
.btn-new-scan:hover { background: #059669; color: white; }
.btn-reset-audit {
    border-color: rgba(239,68,68,0.4);
    background: rgba(239,68,68,0.1);
    color: #fca5a5;
}
.btn-reset-audit:hover { background: #EF4444; color: white; }
.btn-share-client {
    border-color: rgba(5,150,105,0.4);
    background: rgba(5,150,105,0.1);
    color: #6ee7b7;
}
.btn-share-client:hover { background: #059669; color: white; }
.mode-toggle {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
}
.mode-btn {
    color: rgba(255,255,255,0.5);
}
.mode-btn.active {
    background: linear-gradient(135deg, #059669, #0d9488);
    color: white;
    box-shadow: 0 2px 8px rgba(5,150,105,0.4);
}
.score-label { color: rgba(255,255,255,0.5); }

/* ── Enhanced Score Ring ── */
.score-click-wrap {
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)) padding-box,
                linear-gradient(135deg, #059669, #06B6D4, #6366f1) border-box;
    border: 2px solid transparent;
    border-radius: 16px;
    transition: all 0.3s;
}
.score-click-wrap:hover {
    box-shadow: 0 0 24px rgba(5,150,105,0.3), 0 0 48px rgba(99,102,241,0.15);
    transform: scale(1.08);
}
.score-mini .track { stroke: rgba(255,255,255,0.1); }
.score-mini .val { color: #f1f5f9; }
.score-click-hint { color: #4ade80; }

/* ── Score Breakdown Popup Upgrade ── */
.score-breakdown-popup {
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(226,232,240,0.5);
    border-radius: 20px;
    padding: 1.5rem;
}
.sb-item {
    background: linear-gradient(135deg, #f8fafc, #f0f9ff);
    border: 1px solid rgba(226,232,240,0.6);
    border-radius: 12px;
    transition: transform 0.2s;
}
.sb-item:hover { transform: scale(1.03); }

/* ── Primary Buttons — Gradient ── */
.btn-primary {
    background: linear-gradient(135deg, #059669, #0d9488);
    box-shadow: 0 4px 15px rgba(5,150,105,0.35);
    border-radius: 12px;
    transition: all 0.3s;
}
.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(5,150,105,0.45);
    transform: translateY(-2px);
}

/* ── Probe Button ── */
.btn-probe {
    background: linear-gradient(135deg, #059669, #0d9488);
    box-shadow: 0 4px 16px rgba(5,150,105,0.35);
    transition: all 0.3s;
}
.btn-probe:hover {
    box-shadow: 0 6px 24px rgba(5,150,105,0.5);
    transform: translateY(-2px);
}

/* ── No-Data Splash Upgrade ── */
.no-data .icon-ring {
    width: 96px;
    height: 96px;
    background: linear-gradient(135deg, #ecfdf5, #f0f9ff);
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 0 0 3px rgba(5,150,105,0.15), 0 8px 32px rgba(5,150,105,0.15);
    font-size: 2.4rem;
    animation: splashPulse 3s ease-in-out infinite;
}
@keyframes splashPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(5,150,105,0.15), 0 8px 32px rgba(5,150,105,0.15); }
    50% { box-shadow: 0 0 0 8px rgba(5,150,105,0.08), 0 12px 48px rgba(5,150,105,0.2); }
}
.no-data h2 {
    background: linear-gradient(135deg, #0f172a, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── AI Leaderboard — Brand Colors ── */
.ai-lb-card {
    border: 1px solid rgba(5,150,105,0.15);
    background: rgba(236,253,245,0.5);
    backdrop-filter: blur(12px);
}
.ai-dom-table thead {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1a3a4a 100%);
}
.ai-dom-table tbody tr { transition: all 0.2s; }
.ai-dom-table tbody tr:hover {
    background: #f0f9ff;
    transform: scale(1.005);
}

/* Brand icon styles for AI models */
.ai-brand-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}
.ai-brand-icon.chatgpt { background: linear-gradient(135deg, #10a37f, #0d8c6e); color: white; }
.ai-brand-icon.claude { background: linear-gradient(135deg, #d4a574, #c4956a); color: white; }
.ai-brand-icon.gemini { background: linear-gradient(135deg, #4285f4, #34a853); color: white; }
.ai-brand-icon.google { background: linear-gradient(135deg, #4285f4, #ea4335); color: white; }
.ai-brand-icon.perplexity { background: linear-gradient(135deg, #1fb8cd, #2593d0); color: white; }

/* ── Competitor Cards — Enhanced ── */
.comp-row > .card {
    border-top: 3px solid transparent;
    transition: all 0.3s;
}
.comp-row > .card:nth-child(1) { border-top-color: #059669; }
.comp-row > .card:nth-child(2) { border-top-color: #6366f1; }
.comp-row > .card:nth-child(3) { border-top-color: #f59e0b; }
.comp-card-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Fix-It Enhanced ── */
.fix-item {
    border-radius: 12px;
    transition: all 0.25s;
    border: 1px solid rgba(226,232,240,0.6);
}
.fix-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.fix-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 0.95rem;
}
.fix-icon.critical {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    box-shadow: 0 2px 8px rgba(239,68,68,0.15);
}
.fix-icon.warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}
.fix-icon.ok {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    box-shadow: 0 2px 8px rgba(34,197,94,0.15);
}
.btn-recipe {
    background: linear-gradient(135deg, #059669, #0d9488);
    box-shadow: 0 2px 8px rgba(5,150,105,0.3);
    border-radius: 10px;
    transition: all 0.3s;
}
.btn-recipe:hover {
    box-shadow: 0 4px 16px rgba(5,150,105,0.4);
    transform: translateY(-1px);
}

/* ── Geo Grid Enhanced ── */
.geo-cell {
    border-radius: 10px;
    font-weight: 800;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
.geo-cell:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 5;
}
.geo-cell.r1,.geo-cell.r2,.geo-cell.r3 {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    box-shadow: 0 1px 4px rgba(34,197,94,0.15);
}

/* ── Feed Items ── */
.feed-item {
    border-radius: 12px;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}
.feed-item:hover {
    transform: translateX(4px);
}

/* ── Action Plan Card ── */
#actionPlanCard {
    border: 1px solid rgba(34,197,94,0.15);
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(12px);
}

/* ── Preflight Module ── */
.preflight-module {
    border-radius: 20px;
    overflow: hidden;
}
.pf-step.active .pf-step-num {
    box-shadow: 0 0 0 4px rgba(5,150,105,0.2);
}

/* ── Modals Enhanced ── */
.diag-modal-content,
.matrix-info-content {
    border-radius: 20px;
    border: 1px solid rgba(226,232,240,0.5);
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
}
.upgrade-modal-content {
    border-radius: 20px;
}

/* ── Scan Progress Bar ── */
.scan-progress .bar {
    background: linear-gradient(90deg, #059669, #06B6D4, #6366f1);
    background-size: 200% 100%;
    animation: progress-sweep 2s ease-in-out forwards, progressGradient 1.5s ease-in-out infinite;
}
@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Cockpit Scan Bar Enhanced ── */
.cockpit-scan-bar {
    border-radius: 16px;
    border: 2px solid rgba(226,232,240,0.6);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transition: all 0.3s;
}
.cockpit-scan-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(5,150,105,0.1), 0 8px 32px rgba(0,0,0,0.06);
}
.cockpit-scan-bar button {
    background: linear-gradient(135deg, #059669, #0d9488);
    transition: all 0.3s;
}

/* ── GBP Stats Enhanced ── */
.gbp-stat-card {
    background: linear-gradient(135deg, #f8fafc, #f0f9ff);
    border: 1px solid rgba(226,232,240,0.6);
    border-radius: 12px;
    transition: transform 0.2s;
}
.gbp-stat-card:hover { transform: translateY(-2px); }

/* ── Scrollbar Styling ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(148,163,184,0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.5); }

/* ── Score Chart Container ── */
.score-chart-wrap {
    max-width: 280px;
    margin: 1rem auto;
    position: relative;
}
.score-chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.score-chart-center .scc-val {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
}
.score-chart-center .scc-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Platform Icons Row ── */
.platform-icons-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.platform-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    transition: transform 0.2s;
}
.platform-icon:hover { transform: scale(1.15); }
.platform-icon.pi-google { background: linear-gradient(135deg, #4285f4, #34a853); }
.platform-icon.pi-chatgpt { background: linear-gradient(135deg, #10a37f, #0d8c6e); }
.platform-icon.pi-claude { background: linear-gradient(135deg, #d4a574, #c4956a); }
.platform-icon.pi-gemini { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.platform-icon.pi-bing { background: linear-gradient(135deg, #00809d, #0078d4); }
.platform-icon.pi-perplexity { background: linear-gradient(135deg, #1fb8cd, #2593d0); }

/* ── Animated Stat Cards ── */
.stat-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(226,232,240,0.5);
    backdrop-filter: blur(8px);
}
.stat-mini-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.stat-mini-val {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
}
.stat-mini-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ═══ COCKPIT v4 RESPONSIVE ═══ */
@media (max-width: 768px) {
    .compare-grid { grid-template-columns: 1fr; }
    .compare-col { padding: 1.25rem; }
    .compare-features li { font-size: 0.82rem; }
    .id-header { border-radius: 14px; padding: 1rem 1.25rem; }
    .id-header::before, .id-header::after { display: none; }
    #platformBar { flex-direction: column; align-items: flex-start !important; }
    #platformScanStats { width: 100%; justify-content: space-between; }
    .compare-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .compare-hero h3 { font-size: 1.15rem; }
}
@media (max-width: 480px) {
    .compare-table { font-size: 0.78rem; }
    .compare-table th, .compare-table td { padding: 0.5rem 0.6rem; }
    .compare-col { padding: 1rem; }
    .compare-col-logo { width: 32px; height: 32px; font-size: 1rem; }
    .compare-col-name { font-size: 0.95rem; }
    .stat-mini { padding: 0.5rem 0.65rem; }
    .stat-mini-val { font-size: 0.88rem; }
    .platform-icon { width: 24px; height: 24px; font-size: 0.6rem; }
    .score-breakdown-popup { padding: 1rem; border-radius: 14px; }
    .card:hover { transform: none; }
}
