/* ===== Shared Demo Styles ===== */
/* All demos share color tokens with the main site (see styles.css :root). */

:root {
    --primary: #00D9FF;
    --primary-dark: #00A8CC;
    --secondary: #6C5CE7;
    --accent: #FF6B9D;
    --success: #2ECC71;
    --warning: #F39C12;
    --danger: #E74C3C;
    --gradient-2: linear-gradient(135deg, #00D9FF 0%, #6C5CE7 100%);
    --gradient-3: linear-gradient(135deg, #FF6B9D 0%, #FFA06B 100%);

    --bg-primary: #0A0E27;
    --bg-secondary: #1A1F3A;
    --bg-tertiary: #232849;
    --text-primary: #E8ECF4;
    --text-secondary: #A8B2D1;
    --text-muted: #6B7494;
    --border-color: rgba(0, 217, 255, 0.12);
    --border-color-hover: rgba(0, 217, 255, 0.25);
    --card-bg: #1A1F3A;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}

/* ===== Demo Top Bar (back-to-site nav) ===== */
.demo-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 39, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.demo-topbar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.demo-topbar-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.demo-topbar-back:hover {
    color: var(--primary);
}

.demo-topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.demo-topbar-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 1rem;
    min-width: 0;
}

.demo-topbar-title .product-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.demo-topbar-title small {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}

.demo-topbar-badge {
    background: rgba(0, 217, 255, 0.1);
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    border: 1px solid var(--primary);
    white-space: nowrap;
}

/* ===== Demo Shell (page container) ===== */
.demo-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.demo-shell-header {
    margin-bottom: 2rem;
}

.demo-shell-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

.demo-shell-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Panels ===== */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.panel-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
}

.panel-action {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.panel-action:hover {
    background: rgba(0, 217, 255, 0.1);
}

/* ===== Stat tiles ===== */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-tile {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.stat-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    opacity: 0.7;
}

.stat-tile.accent::before { background: var(--accent); }
.stat-tile.success::before { background: var(--success); }
.stat-tile.warning::before { background: var(--warning); }
.stat-tile.secondary::before { background: var(--secondary); }

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.stat-delta {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-ai {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(0, 217, 255, 0.2));
    color: var(--primary);
    border: 1px solid rgba(0, 217, 255, 0.3);
}

.badge-ai::before {
    content: '✨';
    font-size: 0.7rem;
}

.badge-success {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
}

.badge-muted {
    background: rgba(168, 178, 209, 0.1);
    color: var(--text-secondary);
}

/* ===== Chat bubbles ===== */
.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.45;
}

.chat-bubble.them {
    background: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chat-bubble.us {
    background: var(--gradient-2);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-bubble.ai {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.25), rgba(0, 217, 255, 0.18));
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-timestamp {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0.5rem 0;
}

.chat-author {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

/* ===== Buttons (demo, inert) ===== */
.demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color-hover);
}

.demo-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.demo-btn.primary {
    background: var(--gradient-2);
    color: white;
    border: none;
}

.demo-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 217, 255, 0.3);
    color: white;
}

.demo-btn.ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.demo-btn.ghost:hover {
    color: var(--primary);
    background: rgba(0, 217, 255, 0.08);
}

/* ===== Demo footnote ===== */
.demo-footnote {
    max-width: 1400px;
    margin: 3rem auto 2rem;
    padding: 1.25rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    border-top: 1px solid var(--border-color);
}

.demo-footnote a {
    color: var(--primary);
}

/* ===== Phone frame (used by mobile demos) ===== */
.phone-frame {
    width: 390px;
    height: 800px;
    background: #000;
    border-radius: 44px;
    padding: 10px;
    margin: 0 auto;
    box-shadow:
        0 0 0 2px rgba(168, 178, 209, 0.15),
        0 30px 80px rgba(0, 0, 0, 0.6);
    position: relative;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    border-radius: 36px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.phone-notch {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 28px;
    background: #000;
    border-radius: 16px;
    z-index: 20;
}

.phone-statusbar {
    padding: 14px 28px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 10;
}

.phone-statusbar-right {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.phone-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem 1rem;
}

.phone-body::-webkit-scrollbar { width: 0; }

.phone-tabbar {
    display: flex;
    justify-content: space-around;
    padding: 0.6rem 1rem 1.2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.phone-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.phone-tab.active {
    color: var(--primary);
}

.phone-tab .icon {
    font-size: 1.2rem;
}

/* ===== Generic list rows ===== */
.list-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.list-row-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--gradient-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.list-row-main {
    flex: 1;
    min-width: 0;
}

.list-row-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.list-row-meta {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.list-row-trailing {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: right;
    flex-shrink: 0;
}

/* ===== Mini SVG charts ===== */
.chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.chart-axis-label {
    fill: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.chart-bar {
    fill: url(#barGradient);
    transition: opacity 0.2s ease;
}

.chart-bar:hover {
    opacity: 0.8;
}

.chart-bar.peak {
    fill: url(#peakGradient);
}

.chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line-area {
    fill: url(#areaGradient);
    opacity: 0.4;
}

.chart-grid {
    stroke: var(--border-color);
    stroke-dasharray: 3 3;
    stroke-width: 1;
}

.chart-dot {
    fill: var(--primary);
    stroke: var(--bg-primary);
    stroke-width: 2;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .demo-shell {
        padding: 1.25rem;
    }

    .demo-topbar {
        padding: 0.7rem 1rem;
    }

    .demo-topbar-title small {
        display: none;
    }
}

@media (max-width: 480px) {
    .phone-frame {
        width: 100%;
        max-width: 390px;
        height: 720px;
    }

    .demo-shell-header h1 {
        font-size: 1.4rem;
    }
}
