/* ============================================================
   Personal Assistant AI — Premium Dark Theme
   ============================================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a27;
    --bg-hover: #22222f;
    --bg-card: #16161f;
    --text-primary: #e8e8ed;
    --text-secondary: #9494a8;
    --text-muted: #5c5c72;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --accent-glow: rgba(108, 92, 231, 0.15);
    --success: #00cec9;
    --warning: #fdcb6e;
    --danger: #ff7675;
    --border: #2a2a3a;
    --border-light: #1e1e2e;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font: 'DM Sans', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --sidebar-w: 280px;
    --panel-w: 340px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ---- SCREENS ---- */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ---- LOGIN ---- */
.login-container {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%; position: relative;
    background: radial-gradient(ellipse at 50% 0%, rgba(108,92,231,0.08) 0%, transparent 60%);
}
.login-glow {
    position: absolute; top: -200px; left: 50%; transform: translateX(-50%);
    width: 600px; height: 600px; border-radius: 50%;
    background: radial-gradient(circle, rgba(108,92,231,0.12) 0%, transparent 70%);
    filter: blur(80px); pointer-events: none;
}
.login-card {
    text-align: center; padding: 60px 48px; position: relative; z-index: 1;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 24px; max-width: 420px; width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.login-logo { font-size: 64px; margin-bottom: 16px; }
.login-card h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.5px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 32px; font-size: 15px; }
.btn-google {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 14px 32px; border-radius: var(--radius);
    background: #fff; color: #333; font-size: 15px; font-weight: 600;
    text-decoration: none; transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.login-note { color: var(--text-muted); font-size: 12px; margin-top: 24px; line-height: 1.5; }

/* ---- SIDEBAR ---- */
#sidebar {
    width: var(--sidebar-w); height: 100vh; display: flex; flex-direction: column;
    background: var(--bg-secondary); border-right: 1px solid var(--border);
    flex-shrink: 0; transition: var(--transition);
}
.sidebar-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 16px 12px; border-bottom: 1px solid var(--border-light);
}
.sidebar-logo { font-size: 24px; }
.sidebar-title { font-weight: 600; font-size: 15px; flex: 1; }
.sidebar-search { padding: 12px 16px; }
.sidebar-search input {
    width: 100%; padding: 8px 12px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 13px; outline: none;
    transition: var(--transition);
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-conversations {
    flex: 1; overflow-y: auto; padding: 4px 8px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.conv-item {
    padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 13px; color: var(--text-secondary); transition: var(--transition);
    display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.conv-item.active { background: var(--accent-glow); color: var(--accent-light); }
.conv-item .conv-icon { opacity: 0.5; font-size: 14px; flex-shrink: 0; }
.conv-item .conv-title { overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-delete {
    margin-left: auto; opacity: 0; font-size: 12px; padding: 2px 6px;
    border-radius: 4px; border: none; background: transparent; color: var(--danger);
    cursor: pointer; flex-shrink: 0;
}
.conv-item:hover .conv-delete { opacity: 0.6; }
.conv-item .conv-delete:hover { opacity: 1; background: rgba(255,118,117,0.1); }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border-light); }
.user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; margin-bottom: 8px;
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; }
#user-name { font-size: 13px; font-weight: 500; }
.sidebar-nav { display: flex; gap: 4px; }
.nav-btn {
    flex: 1; padding: 8px; border: none; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); cursor: pointer; font-size: 16px;
    transition: var(--transition);
}
.nav-btn:hover { background: var(--bg-hover); transform: scale(1.05); }

/* ---- CHAT AREA ---- */
#chat-area {
    flex: 1; display: flex; flex-direction: column;
    height: 100vh; min-width: 0;
}
.chat-welcome {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px; padding: 40px;
}
.welcome-icon { font-size: 72px; margin-bottom: 8px; }
.chat-welcome h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; }
.chat-welcome p { color: var(--text-secondary); font-size: 16px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
.quick-btn {
    padding: 10px 18px; border-radius: 24px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 13px; cursor: pointer;
    transition: var(--transition); font-family: var(--font);
}
.quick-btn:hover { border-color: var(--accent); color: var(--accent-light); background: var(--accent-glow); }

/* ---- MESSAGES ---- */
.messages-container {
    flex: 1; overflow-y: auto; padding: 24px 20%;
    scroll-behavior: smooth;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
@media (max-width: 1200px) { .messages-container { padding: 24px 10%; } }
@media (max-width: 768px) { .messages-container { padding: 24px 16px; } }

.message {
    margin-bottom: 24px; animation: msgIn 0.3s ease-out;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.message .msg-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.message .msg-role {
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.message.user .msg-role { color: var(--accent-light); }
.message.assistant .msg-role { color: var(--success); }
.message .msg-time { font-size: 11px; color: var(--text-muted); }
.message .msg-body {
    font-size: 14.5px; line-height: 1.7; color: var(--text-primary);
}
.message.user .msg-body {
    background: var(--accent-glow); border: 1px solid rgba(108,92,231,0.2);
    padding: 14px 18px; border-radius: 16px 16px 4px 16px;
}
.message.assistant .msg-body {
    padding: 2px 0;
}
.message .msg-body pre {
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px; margin: 10px 0;
    overflow-x: auto; font-family: var(--mono); font-size: 13px;
}
.message .msg-body code {
    font-family: var(--mono); font-size: 13px;
    background: var(--bg-tertiary); padding: 2px 6px;
    border-radius: 4px;
}
.message .msg-body p { margin-bottom: 10px; }
.message .msg-body p:last-child { margin-bottom: 0; }
.message .msg-model {
    font-size: 11px; color: var(--text-muted); margin-top: 6px;
    font-family: var(--mono);
}

/* ---- INPUT ---- */
.chat-input-area {
    padding: 16px 20%; border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}
@media (max-width: 1200px) { .chat-input-area { padding: 16px 10%; } }
@media (max-width: 768px) { .chat-input-area { padding: 16px; } }

.input-wrapper {
    display: flex; align-items: flex-end; gap: 8px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: 16px; padding: 8px 12px 8px 16px;
    transition: var(--transition);
}
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
#chat-input {
    flex: 1; background: none; border: none; color: var(--text-primary);
    font-size: 14.5px; font-family: var(--font); resize: none;
    max-height: 150px; outline: none; line-height: 1.5; padding: 6px 0;
}
#chat-input::placeholder { color: var(--text-muted); }
.btn-send {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--accent); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: white; transition: var(--transition); flex-shrink: 0;
}
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-send:not(:disabled):hover { background: var(--accent-light); transform: scale(1.05); }
.input-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 4px 0; font-size: 11px;
}
.model-indicator { color: var(--text-muted); font-family: var(--mono); }
.typing-indicator { color: var(--accent-light); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---- SIDE PANEL ---- */
.side-panel {
    width: var(--panel-w); height: 100vh; flex-shrink: 0;
    background: var(--bg-secondary); border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    animation: slideIn 0.2s ease-out;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.panel-header h3 { font-size: 16px; font-weight: 600; }
.panel-content { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* ---- MEMORY PANEL ---- */
.memory-category { margin-bottom: 20px; }
.memory-category h4 {
    font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); margin-bottom: 8px; padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}
.memory-item {
    display: flex; align-items: start; gap: 8px; padding: 8px;
    border-radius: var(--radius-sm); font-size: 13px;
    transition: var(--transition);
}
.memory-item:hover { background: var(--bg-hover); }
.memory-key { color: var(--accent-light); font-weight: 500; min-width: 80px; }
.memory-value { color: var(--text-secondary); flex: 1; }
.memory-actions { display: flex; gap: 4px; opacity: 0; transition: var(--transition); }
.memory-item:hover .memory-actions { opacity: 1; }
.memory-actions button {
    background: none; border: none; cursor: pointer; font-size: 12px;
    padding: 2px 4px; border-radius: 4px;
}
.memory-actions button:hover { background: var(--bg-tertiary); }

/* ---- BUTTONS ---- */
.btn-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ---- UTILITY ---- */
.hidden { display: none !important; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.login-links{margin-top:16px;font-size:12px}.login-links a{color:var(--text-muted);text-decoration:none;transition:var(--transition)}.login-links a:hover{color:var(--accent-light)}
