/* Apple Design System CSS Variables */
:root {
    /* Light mode */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8ed;

    --text-primary: rgba(0, 0, 0, 0.85);
    --text-secondary: rgba(0, 0, 0, 0.55);
    --text-tertiary: rgba(0, 0, 0, 0.35);

    --border-color: rgba(0, 0, 0, 0.1);
    --fill-primary: rgba(0, 0, 0, 0.04);
    --fill-secondary: rgba(0, 0, 0, 0.06);

    --accent-color: #007aff;
    --accent-green: #34c759;
    --accent-red: #ff3b30;
    --accent-orange: #ff9500;

    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1c1c1e;
        --bg-secondary: #2c2c2e;
        --bg-tertiary: #3a3a3c;

        --text-primary: rgba(255, 255, 255, 0.92);
        --text-secondary: rgba(255, 255, 255, 0.55);
        --text-tertiary: rgba(255, 255, 255, 0.30);

        --border-color: rgba(255, 255, 255, 0.12);
        --fill-primary: rgba(255, 255, 255, 0.08);
        --fill-secondary: rgba(255, 255, 255, 0.12);

        --accent-color: #0a84ff;
        --glass-bg: rgba(28, 28, 30, 0.72);
        --glass-border: rgba(255, 255, 255, 0.1);
    }
}

/* Apple Card */
.apple-card {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
    transition: box-shadow 250ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.apple-card:hover {
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Animations */
@keyframes slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dot-pulse {
    0%, 80%, 100% { transform: scale(0.3); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat message animations */
.message-bubble {
    animation: slide-up 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.user-bubble {
    background: var(--accent-color);
    color: white;
    border-radius: 16px 16px 4px 16px;
    padding: 10px 16px;
    font-size: 15px;
    line-height: 1.5;
    max-width: 75%;
    margin-left: auto;
    margin-bottom: 12px;
    width: fit-content;
}

.assistant-bubble {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px 16px 16px 4px;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.6;
    max-width: 75%;
    margin-bottom: 12px;
}

.assistant-bubble pre {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}

.assistant-bubble code {
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.9em;
}

.assistant-bubble :not(pre) > code {
    background: var(--fill-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Thinking dots */
.thinking-dots { display: flex; gap: 5px; padding: 8px 16px; }
.thinking-dots span {
    width: 8px; height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: dot-pulse 1.4s infinite ease-in-out both;
}
.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Sources panel */
.source-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; margin-bottom: 4px;
    background: var(--fill-primary); border-radius: 8px;
    font-size: 12px;
}
.source-title { color: var(--text-primary); font-weight: 500; }
.source-score { color: var(--text-tertiary); }

/* Session item active state */
.session-item.active { background: rgba(0,122,255,0.1); color: var(--accent-color); font-weight: 500; }

/* Links */
a { color: inherit; }
