:root {
    /* --- NEW COLOR PALETTE --- */
    --brand-blue: #4285F4;   /* Google Blue */
    --brand-red: #EA4335;    /* Alert Red */
    --brand-purple: #7C3AED; /* AI Purple */
    
    --bg-app: #F3F4F6;       /* Light Grey Background */
    --bg-panel: #FFFFFF;     /* White Panels */
    --bg-sidebar: #FFFFFF;
    
    --border: #E5E7EB;       /* Subtle Borders */
    --text-main: #111827;    /* Near Black */
    --text-muted: #6B7280;   /* Muted Grey */
    
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --sidebar-width: 260px;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- AUTH SCREENS --- */
#auth-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(243, 244, 246, 0.8); /* Light blurred overlay */
    backdrop-filter: blur(5px);
    z-index: 10000;
}

#login-box, #paywall {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 380px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#login-box h1, #paywall h1 {
    font-weight: 700;
    font-size: 24px;
    color: var(--text-main);
    margin: 10px 0;
}

.system-header {
    font-family: var(--font-main);
    color: var(--brand-purple);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px;
    box-sizing: border-box;
    z-index: 100;
}

.brand {
    font-family: var(--font-main);
    color: var(--text-main);
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 40px;
    flex-shrink: 0;
}

/* NEW: Blinking Cursor Animation */
.blink {
    animation: blink-animation 1s steps(2, start) infinite;
    color: var(--brand-purple); /* Optional: matches the brand dot color */
}

@keyframes blink-animation {
    to { visibility: hidden; }
}

.brand::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    background: var(--brand-purple);
    border-radius: 50%;
}

.nav-group { display: flex; flex-direction: column; gap: 8px; }

.nav-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background: #F3F4F6;
    color: var(--brand-blue);
}

.nav-btn.active {
    background: #EEF2FF; /* Very light purple/blue */
    color: var(--brand-purple);
}

.nav-num {
    font-family: var(--font-mono);
    font-size: 10px;
    opacity: 0.5;
    margin-right: 12px;
    width: 15px;
}

.nav-footer {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: auto;
}

.user-status {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.status-dot {
    width: 8px;
    height: 8px;
    background: var(--brand-blue);
    border-radius: 50%;
}

.footer-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: block;
    padding: 5px 0;
    transition: color 0.2s;
}
.footer-link:hover { color: var(--brand-red); }

/* --- MAIN CONTENT AREA --- */
.content-area {
    margin-left: var(--sidebar-width);
    height: 100vh;
    box-sizing: border-box;
    background: var(--bg-app);
}

.tab-pane { display: none; height: 100%; }
.tab-pane.active { display: block; animation: fadeUp 0.4s ease; } /* Reverted display: block */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- SPLIT VIEW LAYOUT --- */
.split-view {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    height: 100%;
}

/* LEFT PANEL (TOOL) */
.panel-tool {
    padding: 60px;
    overflow-y: auto;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    position: relative;
}

.panel-header {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 32px;
    margin: 0 0 10px 0;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.panel-desc {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 16px;
    line-height: 1.5;
}

/* RIGHT PANEL (MANUAL) */
.panel-manual {
    padding: 60px;
    background: #F9FAFB; /* Slightly off-white */
    overflow-y: auto;
}

.panel-manual h3 {
    font-family: var(--font-main);
    color: var(--brand-blue);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 24px;
}

.panel-manual p, .panel-manual li {
    font-family: var(--font-main);
    color: #4B5563;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 20px;
}

.panel-manual strong { color: var(--brand-purple); font-weight: 600; }

/* --- FORM ELEMENTS --- */
input, textarea {
    width: 100%;
    padding: 16px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 13px;
    margin-bottom: 20px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* Main Action Button */
.btn-main {
    width: 100%;
    padding: 16px;
    background: var(--brand-purple);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.3);
}

.btn-main:hover {
    background: #6D28D9;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(124, 58, 237, 0.4);
}

.btn-main:active { transform: translateY(0); }

/* Secondary/Text Buttons */
.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 12px;
    cursor: pointer;
    margin-top: 15px;
    text-decoration: underline;
}
.btn-text:hover { color: var(--brand-red); }

/* Small Button */
.btn-small {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-main);
    font-family: var(--font-main);
    padding: 0 15px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-small:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
    background: #F0F9FF;
}

/* --- TOOL SPECIFIC --- */
.result-box {
    margin-top: 30px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #F8FAFC; /* Slate 50 */
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-main);
    display: none;
    line-height: 1.6;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 32px;
    color: var(--text-main);
    margin: 0 auto 20px;
    box-shadow: var(--shadow);
}

/* PMAX Specific */
.stat-bar {
    background: #FFFFFF;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between; 
    align-items: center; /* Ensures everything is vertically centered */
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.stat-bar strong {
    color: var(--brand-purple); /* Using your AI purple for the numbers */
    font-size: 14px;
    font-weight: 700;
}

.step-container { margin-bottom: 30px; }
.step-label {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 11px;
    color: var(--brand-blue);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-row { display: flex; height: 48px; gap: 10px; }
.input-row input { margin: 0; }
.input-row button { width: 100px; height: 100%; }

/* --- Generated Links --- */
.neural-link {
    color: var(--brand-blue);
    text-decoration: none;
    border-bottom: 1px dotted var(--brand-blue);
    font-weight: 600;
    transition: all 0.2s;
}
.neural-link:hover {
    background-color: rgba(66, 133, 244, 0.1);
    border-bottom: 1px solid var(--brand-blue);
    color: #fff;
}

/* --- TIER LOCKING STYLES --- */
.locked-blur {
    /* We remove the filter here so the button inside doesn't get blurred */
    pointer-events: none;
    user-select: none;
}

.btn-upgrade {
    background: var(--brand-red) !important;
    box-shadow: 0 4px 6px -1px rgba(234, 67, 53, 0.3) !important;
}

.btn-upgrade:hover {
    background: #d93025 !important;
    transform: translateY(-1px);
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); padding: 15px; }
    .content-area { margin-left: 0; height: auto; overflow: visible; }
    .split-view { grid-template-columns: 1fr; }
    .panel-tool, .panel-manual { padding: 30px; border-right: none; }
    .nav-group { flex-direction: row; overflow-x: auto; gap: 10px; padding-bottom: 5px; }
    .nav-btn { white-space: nowrap; }
    .brand { margin-bottom: 15px; }
}

/* The Number in the text: [1] */
.citation-link {
    color: #4285F4; /* Google Blue */
    font-weight: 800;
    text-decoration: none;
    font-size: 0.75em;
    vertical-align: super;
    margin-left: 2px;
    background: rgba(66, 133, 244, 0.1);
    padding: 0 4px;
    border-radius: 4px;
}

.citation-link:hover {
    background: #4285F4;
    color: white;
}

/* The buttons at the bottom */
.neural-footer { margin-top: 25px; border-top: 1px solid #eee; padding-top: 15px; }
.neural-footer h4 { font-size: 10px; color: #888; text-transform: uppercase; margin-bottom: 10px; }
.ref-row { display: flex; flex-wrap: wrap; gap: 8px; }

.ref-badge {
    display: inline-block;
    background: #f3f4f6;
    color: #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 10px;
    text-decoration: none;
    font-family: monospace;
    border: 1px solid #ddd;
}
.ref-badge:hover { background: #333; color: #fff; }

/* Styling the paired data point */
.data-point-wrapper {
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
    border-bottom: 1px solid transparent;
}

.data-point-wrapper:hover {
    background: rgba(66, 133, 244, 0.1);
    border-bottom: 1px solid var(--brand-blue);
}

/* Citation Links inside the text */
.citation-link {
    color: var(--brand-blue);
    text-decoration: none;
    font-weight: 800;
    font-size: 10px;
    background: #eef2ff;
    padding: 1px 4px;
    border-radius: 3px;
    vertical-align: super;
}

/* Better Badge Styling */
.ref-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s;
}

.ref-badge:hover {
    border-color: var(--brand-purple);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ref-index {
    background: var(--brand-purple);
    color: white;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 800;
}

/* The container for bold text + citation */
.neural-citation-group {
    padding: 0 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

/* Highlight state triggered by JS */
/* Force the highlight to be visible */
.text-highlight {
    background-color: #ffde58 !important; /* Bright Yellow Background */
    color: #000 !important;
    border-bottom: 2px solid var(--brand-purple) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.citation-link {
    display: inline-block;
    background: #4285F4;
    color: white !important;
    font-size: 9px;
    font-weight: 800;
    width: 14px;
    height: 14px;
    text-align: center;
    line-height: 14px;
    border-radius: 50%;
    text-decoration: none;
    margin-left: 4px;
    vertical-align: super;
}

/* The badge at the bottom */
.ref-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Highlight state triggered by JS */
.badge-highlight {
    border-color: var(--brand-purple) !important;
    background-color: #F5F3FF !important;
    transform: scale(1.05) translateY(-5px); /* Pop out effect */
    box-shadow: 0 10px 15px -3px rgba(124, 58, 237, 0.3) !important;
}

.ref-index {
    background: var(--brand-purple);
    color: white;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 800;
}

.ref-domain {
    font-weight: 600;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

select.wizard-input {
    background: #FFFFFF;
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

select.wizard-input:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* --- ANALYTICS DASHBOARD (SPLIT VIEW OPTIMIZED) --- */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two columns in the tool panel */
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: #FFFFFF;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
}
.card-purple::before { background: var(--brand-purple); }
.card-blue::before { background: var(--brand-blue); }
.card-green::before { background: #10B981; }
.card-red::before { background: var(--brand-red); }

.stat-card .step-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.stat-card .panel-header {
    font-size: 24px; /* Slightly smaller to fit the split view */
    margin: 0;
    font-family: var(--font-mono);
}

#analytics-chart-container {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 25px;
}

#signal-stream {
    max-height: 400px;
    overflow-y: auto;
}

.stream-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
    font-family: var(--font-mono);
    font-size: 12px;
}

.event-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 9px;
    text-transform: uppercase;
}

.tag-system { background: #F3F4F6; color: #6B7280; }
.tag-interaction { background: #EEF2FF; color: var(--brand-purple); }
.tag-intent { background: #ECFDF5; color: #059669; }
.tag-alert { background: #FEF2F2; color: var(--brand-red); }

/* ... existing code ... */
.locked-blur {
    /* REMOVE filter: blur(...) from here entirely */
    pointer-events: none;
    user-select: none;
}

/* NEW: The container that holds the clear button on top of the blur */
.upgrade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    /* This blurs ONLY the content behind the overlay */
    backdrop-filter: blur(12px) !important; 
    -webkit-backdrop-filter: blur(12px) !important; /* Safari support */
    background: rgba(255, 255, 255, 0.3); 
    pointer-events: all; /* Allow the button to be clicked */
}
.tag-alert { background: #FEF2F2; color: var(--brand-red); }

/* --- PROFILE SPECIFIC --- */
.profile-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}

.profile-row:last-child { border-bottom: none; }

.tier-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}
.tier-free { background: #F3F4F6; color: #6B7280; }
.tier-pro { background: #EEF2FF; color: var(--brand-purple); border: 1px solid var(--brand-purple); }

.tier-pro { background: #EEF2FF; color: var(--brand-purple); border: 1px solid var(--brand-purple); }

/* --- INLINE UPGRADE BUTTON --- */
.btn-upgrade-inline {
    background: var(--brand-red);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-family: var(--font-main);
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    margin-left: 10px;
    text-transform: uppercase;
    transition: transform 0.2s;
}
.btn-upgrade-inline:hover { transform: scale(1.05); background: #d93025; }

/* --- BLUEPRINT & CASE STUDY MODULES --- */

.hero-blueprint {
    padding: 120px 0 80px;
    background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.05), transparent);
    border-bottom: 1px solid var(--border-subtle);
}

.blueprint-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 20px;
}

/* THE NEURAL VISUALIZER (CSS Infographic) */
.infographic-container {
    background: #111827; /* Matches terminal footer */
    border-radius: 24px;
    padding: 60px;
    color: white;
    margin: 60px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    border: 1px solid #374151;
    overflow: hidden;
}

.viz-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
}

.viz-circle {
    width: 280px;
    height: 280px;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotate-neural 30s linear infinite;
}

.viz-circle::before {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    border: 1px dashed var(--brand-purple);
    border-radius: 50%;
    opacity: 0.5;
    animation: rotate-neural 40s linear reverse infinite;
}

.viz-node {
    position: absolute;
    background: white;
    color: var(--text-main);
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    border-radius: 4px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

.viz-core-text {
    color: var(--brand-purple);
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-align: center;
    z-index: 2;
}

@keyframes rotate-neural { 
    from { transform: rotate(0deg); } 
    to { transform: rotate(360deg); } 
}

/* DATA PILLARS */
.pillar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 40px 0;
}

.pillar {
    border: 1px solid var(--border-subtle);
    padding: 30px;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: white;
}

.pillar:hover { 
    border-color: var(--brand-blue); 
    background: #F8FAFC; 
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
}

.pillar strong {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: 8px;
}

/* THE INFORMATION GAIN BANNER */
.stat-banner {
    background: var(--brand-blue);
    color: white;
    padding: 40px;
    border-radius: 16px;
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin: 60px 0;
    box-shadow: 0 20px 40px rgba(66, 133, 244, 0.2);
}

.stat-item h4 { 
    font-size: 2.8rem; 
    font-family: var(--font-mono); 
    margin-bottom: 5px;
    letter-spacing: -2px;
}

.stat-item p { 
    font-size: 0.75rem; 
    font-family: var(--font-mono);
    text-transform: uppercase; 
    font-weight: 700;
    opacity: 0.9; 
}

/* MOBILE RESPONSIVE UPDATES FOR PMAX PAGE */
@media (max-width: 768px) {
    .infographic-container {
        grid-template-columns: 1fr;
        padding: 40px 20px;
        text-align: center;
    }
    
    .viz-wrapper {
        height: 320px;
    }

    .viz-circle {
        width: 200px;
        height: 200px;
    }

    /* Adjust node distance for smaller screens */
    .viz-node {
        font-size: 0.6rem;
    }

    .pillar-grid {
        grid-template-columns: 1fr;
    }

    .stat-banner {
        flex-direction: column;
        gap: 40px;
    }

    .hero-blueprint h1 {
        font-size: 2.8rem;
    }
}

/* Style for prescribed tools in the audit output */
#audit-summary b {
    background: var(--brand-blue);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-family: var(--font-mono);
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(66, 133, 244, 0.2);
}