@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg: #f0f4ff;
    --bg2: #fff;
    --sidebar-bg: #ffffff;
    --text: #12192c;
    --text-muted: #6b7280;
    --border: rgba(99,102,241,0.12);

    /* Vibrant accent palette */
    --violet: #7c3aed;
    --violet-light: #ede9fe;
    --cyan: #06b6d4;
    --cyan-light: #cffafe;
    --rose: #f43f5e;
    --rose-light: #ffe4e6;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --green: #10b981;
    --green-light: #d1fae5;

    --grad-main: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --grad-warm: linear-gradient(135deg, #f43f5e 0%, #f59e0b 100%);
    --grad-cool: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --grad-green: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);

    --sidebar-width: 270px;
    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(124, 58, 237, 0.08);
    --shadow-md: 0 8px 40px rgba(124, 58, 237, 0.14);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, .logo { font-family: 'Outfit', sans-serif; }

/* ── APP LAYOUT ── */
.app-container { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 36px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 20px rgba(124,58,237,0.05);
    transition: width 0.3s cubic-bezier(.4,0,.2,1), padding 0.3s ease;
    overflow: hidden;
}

/* Collapsed sidebar */
.sidebar.collapsed {
    width: 60px;
    padding: 36px 10px;
}
.sidebar.collapsed .logo-container,
.sidebar.collapsed .nav-links span,
.sidebar.collapsed .logo-sub,
.sidebar.collapsed .nav-footer .nav-links span {
    display: none;
}
.sidebar.collapsed .nav-links a {
    justify-content: center;
    padding: 12px;
    gap: 0;
}
.sidebar.collapsed .nav-links a i { width: auto; font-size: 1.1rem; }

/* Sidebar toggle arrow button */
#sidebar-toggle {
    position: fixed;
    top: 50%;
    left: calc(var(--sidebar-width) - 14px);
    transform: translateY(-50%);
    z-index: 200;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid rgba(124,58,237,0.25);
    box-shadow: 0 2px 10px rgba(124,58,237,0.18);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: left 0.3s cubic-bezier(.4,0,.2,1), transform 0.3s ease;
    color: var(--violet);
    font-size: 0.8rem;
}
#sidebar-toggle:hover { background: var(--violet-light); box-shadow: 0 4px 16px rgba(124,58,237,0.28); }
#sidebar-toggle.collapsed { left: 46px; }
#sidebar-toggle.collapsed i { transform: rotate(180deg); }

.logo-container { margin-bottom: 48px; padding-left: 8px; }

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    background: var(--grad-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.nav-links { list-style: none; flex-grow: 1; }
.nav-links li { margin-bottom: 6px; }

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.93rem;
    transition: all 0.2s;
}

.nav-links a i { width: 20px; text-align: center; font-size: 1rem; }
.nav-links a:hover { background: var(--violet-light); color: var(--violet); }
.nav-links a.active { background: var(--grad-main); color: #fff; box-shadow: 0 4px 14px rgba(124,58,237,0.3); }
.nav-links a.active i { color: #fff; }

.nav-footer {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 20px;
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 48px;
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content {
    margin-left: 60px;
}

/* ── PAGE HEADER ── */
.page-title {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.page-desc { color: var(--text-muted); font-size: 1rem; margin-bottom: 32px; }

/* ── CARDS ── */
.card {
    background: var(--bg2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 28px;
}

/* ── CHAT UI ── */
.chat-wrapper {
    max-width: 860px;
    margin: 0 auto;
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px;
    background: var(--bg2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    margin-bottom: 16px;
}

.message {
    max-width: 78%;
    padding: 16px 22px;
    border-radius: 20px;
    line-height: 1.55;
    font-size: 0.95rem;
    animation: popIn 0.3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes popIn { from { opacity:0; transform:scale(0.9) translateY(10px); } to { opacity:1; transform:none; } }

.message.user {
    align-self: flex-end;
    background: var(--grad-main);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.ai {
    align-self: flex-start;
    background: #f8f7ff;
    border: 1px solid rgba(124,58,237,0.1);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: 60px;
    padding: 8px 8px 8px 24px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s;
}
.chat-input-area:focus-within { border-color: var(--violet); }

#chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.97rem;
    color: var(--text);
    padding: 8px 0;
}

.btn-send {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--grad-main);
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.btn-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(124,58,237,0.4); }

/* ── Typing dots ── */
.typing-dots { display: flex; gap: 5px; padding: 6px 0; }
.dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--violet);
    animation: bounce 1.3s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0);opacity:.4;} 40%{transform:translateY(-7px);opacity:1;} }

/* ── AI logs in chat ── */
.ai-logs { font-family: monospace; font-size: 0.75rem; color: var(--violet); opacity: .75; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }

/* ── Mobile Menu Toggle Button (Hidden on Desktop) ── */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    background: var(--grad-main);
    color: #fff;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124,58,237,0.3);
}

@media (max-width: 900px) {
    .sidebar { width: 72px; padding: 28px 12px; }
    .sidebar.collapsed { width: 60px; }
    .logo-container, .logo-sub, .nav-links span, .nav-footer { display: none; }
    .main-content { margin-left: 72px; padding: 24px; }
    #sidebar-toggle { left: 58px; }
    #sidebar-toggle.collapsed { left: 46px; }
}

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; }
    
    .sidebar { 
        position: fixed;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }
    .sidebar.active { left: 0; }
    
    .logo-container, .logo-sub, .nav-links span, .nav-footer { display: block !important; }
    
    .main-content { margin-left: 0 !important; padding: 20px; padding-top: 80px; }
    #sidebar-toggle { display: none; }
    
    .chat-wrapper { height: calc(100vh - 180px); }
    .message { max-width: 92%; }
    .chat-input-area { margin-bottom: 10px; }
    
    .intro-header h1 { font-size: 1.8rem; }
}
