/* ============================================
   CHAT APPLICATION — BRUTALIST
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg: #0a0a0a;
    --bg-sidebar: #0f0f0f;
    --bg-chat: #141414;
    --bg-input: #1a1a1a;
    --text: #e0e0e0;
    --text-muted: #888888;
    --accent: #ff4d00;
    --accent-hover: #ff6a2a;
    --green: #00ff88;
    --border: #2a2a2a;
    --border-hard: #444444;
    --white: #ffffff;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.app-layout {
    display: flex;
    height: 100vh;
}

/* ========== SIDEBAR ========== */

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid var(--border);
}

.sidebar-logo {
    display: block;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
    text-decoration: none;
}

.sidebar-logo span { color: var(--accent); }

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px solid var(--border-hard);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
}

.new-chat-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-history h4 {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.history-item {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid transparent;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    border-color: var(--border-hard);
    color: var(--text);
    background: var(--bg-chat);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 2px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    background: var(--border-hard);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-user-info {
    font-size: 13px;
    color: var(--text);
}

.sidebar-user-info small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-links {
    display: flex;
    gap: 12px;
}

.sidebar-links a {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.15s;
}

.sidebar-links a:hover {
    color: var(--accent);
}

/* ========== MAIN CHAT ========== */

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    min-width: 0;
}

.chat-header-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
}

.sidebar-toggle {
    background: none;
    border: 1px solid var(--border-hard);
    color: var(--text);
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.15s;
}

.sidebar-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chat-header-title {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Empty state */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.chat-empty-logo {
    font-family: var(--font-mono);
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 24px;
    letter-spacing: -2px;
}

.chat-empty h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--white);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.chat-empty p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: center;
}

.chat-empty .dev-notice {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid var(--accent);
    padding: 6px 14px;
    margin-top: 16px;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 32px;
    max-width: 480px;
    width: 100%;
}

.suggestion-card {
    background: transparent;
    border: 1px solid var(--border-hard);
    padding: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.suggestion-card:hover {
    border-color: var(--accent);
    background: rgba(255, 77, 0, 0.05);
}

.suggestion-card h4 {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.suggestion-card p {
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
    margin: 0;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: none;
    flex-direction: column;
    gap: 20px;
}

.chat-messages.active {
    display: flex;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-hard); }

.msg-row {
    display: flex;
    gap: 14px;
    max-width: 800px;
}

.msg-row.user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.msg-row.bot .msg-avatar {
    background: var(--accent);
    color: var(--bg);
}

.msg-row.user .msg-avatar {
    background: var(--border-hard);
    color: var(--text);
}

.msg-bubble {
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.6;
    max-width: 600px;
}

.msg-row.bot .msg-bubble {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    color: var(--text);
}

.msg-row.user .msg-bubble {
    background: var(--accent);
    color: var(--bg);
    font-weight: 500;
}

.msg-bubble a { color: var(--accent); text-decoration: underline; }
.msg-row.user .msg-bubble a { color: var(--bg); }

.msg-bubble code {
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    font-size: 13px;
}

.msg-bubble pre {
    background: var(--bg);
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 13px;
}

.app-typing {
    display: flex;
    gap: 14px;
    max-width: 800px;
}

.app-typing-dots {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.app-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    animation: blink 1.2s infinite;
}

.app-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.app-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Input area */
.chat-input-area {
    padding: 20px 24px;
    border-top: 2px solid var(--border);
}

.chat-input-wrap {
    display: flex;
    border: 2px solid var(--border-hard);
    background: var(--bg-input);
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-wrap:focus-within {
    border-color: var(--accent);
}

.chat-input-wrap textarea {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 18px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 48px;
    max-height: 150px;
    line-height: 1.5;
}

.chat-input-wrap textarea::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    background: var(--accent);
    border: none;
    padding: 14px 20px;
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.15s;
    opacity: 0.5;
}

.chat-send-btn.active {
    opacity: 1;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

.chat-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    font-family: var(--font-mono);
}

/* ========== SIDEBAR OVERLAY (MOBILE) ========== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

    .chat-header-bar {
        display: flex;
    }

    .chat-empty-logo {
        font-size: 36px;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sidebar { width: 100%; left: -100%; }

    .chat-input-area { padding: 12px 16px; }

    .chat-messages { padding: 16px; }

    .msg-bubble { max-width: 100%; }
}
