/* ═══════════════════════════════════════════════════════════
   Vista Brain — Analytics Suite (GA4) CSS
   Orange theme · OKLCH colors · .ga4- prefix
   ═══════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────── */
.ga4-section {
    display: flex;
    height: calc(100vh - 24px);
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg-primary, oklch(0.13 0.025 260));
    color: var(--text-primary, oklch(0.9 0.01 260));
    border-radius: 16px;
    overflow: hidden;
}

.ga4-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: oklch(0.11 0.02 260);
    border-right: 1px solid oklch(0.22 0.02 260);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.25s ease;
}
.ga4-sidebar.collapsed {
    width: 52px;
}
.ga4-sidebar.collapsed .ga4-nav-text,
.ga4-sidebar.collapsed .ga4-nav-badge,
.ga4-sidebar.collapsed .ga4-sidebar-header span,
.ga4-sidebar.collapsed .ga4-sidebar-header p {
    display: none;
}

.ga4-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Sidebar Header ─────────────────────────────────────── */
.ga4-sidebar-header {
    padding: 18px 16px 12px;
    border-bottom: 1px solid oklch(0.22 0.02 260);
}
.ga4-sidebar-header h2 {
    font-size: 13px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: oklch(0.9 0.01 260);
}
.ga4-sidebar-header h2 i {
    color: oklch(0.75 0.15 65);
}
.ga4-sidebar-header p {
    font-size: 10px;
    color: oklch(0.55 0.02 260);
    margin: 4px 0 0;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ── Nav Items ──────────────────────────────────────────── */
.ga4-nav {
    list-style: none;
    padding: 8px;
    margin: 0;
    flex: 1;
}
.ga4-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: oklch(0.65 0.02 260);
    transition: all 0.15s ease;
    margin-bottom: 2px;
}
.ga4-nav-item:hover {
    background: oklch(0.18 0.02 260);
    color: oklch(0.85 0.01 260);
}
.ga4-nav-item.active {
    background: oklch(0.75 0.15 65 / 0.12);
    color: oklch(0.75 0.15 65);
    font-weight: 600;
}
.ga4-nav-item i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.ga4-nav-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: oklch(0.75 0.15 65 / 0.15);
    color: oklch(0.75 0.15 65);
    text-transform: uppercase;
}

/* ── Topbar ─────────────────────────────────────────────── */
.ga4-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid oklch(0.22 0.02 260);
    min-height: 48px;
    gap: 12px;
    flex-shrink: 0;
}
.ga4-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ga4-collapse-btn {
    background: none;
    border: 1px solid oklch(0.25 0.02 260);
    color: oklch(0.6 0.02 260);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.ga4-collapse-btn:hover {
    background: oklch(0.18 0.02 260);
    color: oklch(0.85 0.01 260);
}
.ga4-topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: oklch(0.9 0.01 260);
}
.ga4-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ga4-date-range {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: oklch(0.16 0.02 260);
    border: 1px solid oklch(0.25 0.02 260);
    color: oklch(0.7 0.02 260);
    cursor: pointer;
}
.ga4-date-range:hover {
    border-color: oklch(0.75 0.15 65 / 0.5);
}
.ga4-refresh-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: oklch(0.16 0.02 260);
    border: 1px solid oklch(0.25 0.02 260);
    color: oklch(0.6 0.02 260);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.ga4-refresh-btn:hover {
    border-color: oklch(0.75 0.15 65);
    color: oklch(0.75 0.15 65);
}

/* ── Content Area ───────────────────────────────────────── */
.ga4-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ── Hero Banner ────────────────────────────────────────── */
.ga4-hero {
    background: linear-gradient(135deg, oklch(0.75 0.15 65), oklch(0.75 0.15 85));
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    color: #fff;
}
.ga4-hero::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.ga4-hero-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 4px;
}
.ga4-hero-sub {
    font-size: 12px;
    opacity: 0.85;
    margin: 0 0 16px;
}
.ga4-hero-stat {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.ga4-hero-num {
    font-size: 36px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}
.ga4-hero-label {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 500;
}

/* ── Metric Cards Grid ──────────────────────────────────── */
.ga4-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.ga4-metric-box {
    background: oklch(0.16 0.02 260);
    border: 1px solid oklch(0.22 0.02 260);
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.15s;
}
.ga4-metric-box:hover {
    border-color: oklch(0.3 0.02 260);
}
.ga4-metric-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ga4-metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ga4-metric-icon.orange { background: oklch(0.75 0.15 65 / 0.15); color: oklch(0.75 0.15 65); }
.ga4-metric-icon.blue { background: oklch(0.65 0.18 250 / 0.15); color: oklch(0.65 0.18 250); }
.ga4-metric-icon.teal { background: oklch(0.75 0.15 175 / 0.15); color: oklch(0.75 0.15 175); }
.ga4-metric-icon.coral { background: oklch(0.65 0.2 25 / 0.15); color: oklch(0.65 0.2 25); }
.ga4-metric-icon.amber { background: oklch(0.75 0.15 85 / 0.15); color: oklch(0.75 0.15 85); }
.ga4-metric-icon.purple { background: oklch(0.6 0.15 300 / 0.15); color: oklch(0.6 0.15 300); }
.ga4-metric-icon.green { background: oklch(0.65 0.17 145 / 0.15); color: oklch(0.65 0.17 145); }
.ga4-metric-change {
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}
.ga4-metric-change.up { color: oklch(0.75 0.15 175); }
.ga4-metric-change.down { color: oklch(0.65 0.2 25); }
.ga4-metric-change.neutral { color: oklch(0.55 0.02 260); }
.ga4-metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: oklch(0.92 0.01 260);
}
.ga4-metric-label {
    font-size: 11px;
    color: oklch(0.55 0.02 260);
    margin-top: 2px;
    font-weight: 500;
}

/* ── Cards ──────────────────────────────────────────────── */
.ga4-card {
    background: oklch(0.16 0.02 260);
    border: 1px solid oklch(0.22 0.02 260);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.ga4-card-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 16px;
    color: oklch(0.9 0.01 260);
}
.ga4-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid oklch(0.22 0.02 260);
}
.ga4-card-no-pad {
    padding: 0;
    overflow: hidden;
}

/* ── Charts ─────────────────────────────────────────────── */
.ga4-chart-wrap {
    position: relative;
    height: 280px;
}

/* ── Tables ─────────────────────────────────────────────── */
.ga4-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.ga4-table thead th {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: oklch(0.55 0.02 260);
    text-transform: uppercase;
    border-bottom: 1px solid oklch(0.22 0.02 260);
    text-align: left;
}
.ga4-table thead th.num {
    text-align: right;
}
.ga4-table tbody tr {
    border-bottom: 1px solid oklch(0.22 0.02 260 / 0.5);
    transition: background 0.1s;
}
.ga4-table tbody tr:hover {
    background: oklch(0.18 0.02 260 / 0.5);
}
.ga4-table tbody td {
    padding: 10px 14px;
    color: oklch(0.85 0.01 260);
}
.ga4-table tbody td.num {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}
.ga4-table tbody td.dim {
    color: oklch(0.55 0.02 260);
}

/* ── Grids ──────────────────────────────────────────────── */
.ga4-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.ga4-grid-3-2 {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Dot indicator ──────────────────────────────────────── */
.ga4-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Badge / Tag ────────────────────────────────────────── */
.ga4-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

/* ── Realtime pulse ─────────────────────────────────────── */
.ga4-realtime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: oklch(0.65 0.2 25);
    animation: ga4Pulse 2s infinite;
}
@keyframes ga4Pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 oklch(0.65 0.2 25 / 0.6); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px oklch(0.65 0.2 25 / 0); }
}

/* ── Retention Heatmap ──────────────────────────────────── */
.ga4-heat-cell {
    width: 100%;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 9px;
}

/* ── Funnel bars ────────────────────────────────────────── */
.ga4-funnel-bar-bg {
    height: 16px;
    border-radius: 4px;
    background: oklch(0.18 0.02 260);
    overflow: hidden;
}
.ga4-funnel-bar {
    height: 16px;
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* ── AI Chat ────────────────────────────────────────────── */
.ga4-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
}
.ga4-chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ga4-chat-bubble {
    max-width: 80%;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
}
.ga4-chat-bubble.assistant {
    background: oklch(0.18 0.02 260);
    border: 1px solid oklch(0.22 0.02 260);
    color: oklch(0.9 0.01 260);
}
.ga4-chat-bubble.user {
    background: oklch(0.75 0.15 65);
    color: #fff;
    margin-left: auto;
}
.ga4-chat-input-wrap {
    padding: 16px;
    border-top: 1px solid oklch(0.22 0.02 260);
    display: flex;
    gap: 8px;
}
.ga4-chat-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid oklch(0.25 0.02 260);
    background: oklch(0.16 0.02 260);
    color: oklch(0.9 0.01 260);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
}
.ga4-chat-input:focus {
    border-color: oklch(0.75 0.15 65 / 0.5);
}
.ga4-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, oklch(0.75 0.15 65), oklch(0.75 0.15 85));
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ga4-chat-send:disabled {
    opacity: 0.5;
    cursor: default;
}
.ga4-chat-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 20px 12px;
}
.ga4-chat-suggestion {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    text-align: left;
    background: oklch(0.18 0.02 260);
    color: oklch(0.85 0.01 260);
    border: 1px solid oklch(0.22 0.02 260 / 0.8);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}
.ga4-chat-suggestion:hover {
    border-color: oklch(0.75 0.15 65 / 0.5);
}

/* ── Page header ────────────────────────────────────────── */
.ga4-page-header {
    margin-bottom: 18px;
}
.ga4-page-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: oklch(0.92 0.01 260);
}
.ga4-page-header p {
    font-size: 12px;
    color: oklch(0.55 0.02 260);
    margin: 4px 0 0;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .ga4-sidebar { width: 52px; }
    .ga4-sidebar .ga4-nav-text,
    .ga4-sidebar .ga4-nav-badge,
    .ga4-sidebar .ga4-sidebar-header span,
    .ga4-sidebar .ga4-sidebar-header p { display: none; }
    .ga4-grid-2, .ga4-grid-3-2 { grid-template-columns: 1fr; }
    .ga4-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .ga4-sidebar { display: none; }
    .ga4-metrics-grid { grid-template-columns: 1fr; }
    .ga4-hero-num { font-size: 28px; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
.ga4-section ::-webkit-scrollbar { width: 6px; height: 6px; }
.ga4-section ::-webkit-scrollbar-track { background: transparent; }
.ga4-section ::-webkit-scrollbar-thumb { background: oklch(0.5 0.02 260 / 0.3); border-radius: 3px; }

/* ── Typing indicator ───────────────────────────────────── */
.ga4-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: oklch(0.55 0.02 260);
    opacity: 0.4;
    animation: ga4TypingPulse 1.4s infinite;
}
@keyframes ga4TypingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
