/* --- Design Tokens --- */
:root {
    --primary-font: 'Outfit', sans-serif;
    
    /* Dark Theme (Default) */
    --bg-base: #1a1614;
    --bg-glass: rgba(43, 33, 27, 0.8);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-main: #fcf8f2;
    --text-muted: #a3958c;
    --accent: #f97316; /* Deep Saffron / Orange */
    --accent-glow: rgba(249, 115, 22, 0.4);
    
    --agent-task: #10b981;
    --agent-schedule: #facc15; /* Gold */
    --agent-knowledge: #ef4444; /* Terracotta Red */
    --agent-supervisor: #f97316; /* Saffron */
    --agent-lifestyle: #14b8a6;
    --agent-concierge: #a855f7;
}

[data-theme="light"] {
    --bg-base: #faf6f0;
    --bg-glass: rgba(255, 248, 240, 0.85);
    --border-glass: rgba(0, 0, 0, 0.1);
    --text-main: #2b211b;
    --text-muted: #78685e;
    --accent: #d946ef; /* Magenta-ish for contrast, or stick to saffron */
    --accent: #ea580c; /* Deep Earthy Saffron */
    --accent-glow: rgba(234, 88, 12, 0.2);
}

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

body {
    font-family: var(--primary-font);
    background-color: var(--bg-base);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 10;
}

.top-nav h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-main), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--border-glass);
    transform: rotate(15deg);
}

/* Chat Layout */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    overflow: hidden;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scrollbar-width: thin;
}

.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 4px; }

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.message.user-msg {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.user-msg .content {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
    border-bottom-right-radius: 2px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.content {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 1rem 1.2rem;
    border-radius: 16px;
    border-bottom-left-radius: 2px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.system-msg .content { border-top-left-radius: 2px; border-bottom-left-radius: 16px; }

/* Sub Agent Tag Styles */
.agent-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-Supervisor { background: rgba(59, 130, 246, 0.2); color: var(--agent-supervisor); }
.role-TaskAgent { background: rgba(16, 185, 129, 0.2); color: var(--agent-task); }
.role-ScheduleAgent { background: rgba(245, 158, 11, 0.2); color: var(--agent-schedule); }
.role-KnowledgeAgent { background: rgba(236, 72, 153, 0.2); color: var(--agent-knowledge); }
.role-LifestyleAgent { background: rgba(20, 184, 166, 0.2); color: var(--agent-lifestyle); }
.role-ConciergeAgent { background: rgba(168, 85, 247, 0.2); color: var(--agent-concierge); }

/* Input Area */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 0.75rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    padding: 0.5rem 0.5rem;
    resize: none;
    outline: none;
    max-height: 150px;
}

textarea::placeholder { color: var(--text-muted); }

.primary-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 18px;
    height: 44px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.primary-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-glow);
}

.primary-btn:active { transform: scale(0.95); }

/* Loading Animation */
.typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 3px;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
