/* ═══════════════════════════════════════════════════════════════════
   IRIS AI ASSISTANT — Clean "Ultimate AI" Theme
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Color Palette */
    --bg-main: #212121; /* Clean dark gray, like ChatGPT/Claude */
    --bg-sidebar: #171717;
    --bg-input: #2f2f2f;
    --bg-tile: #2f2f2f;
    --bg-tile-hover: #424242;
    
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    
    --accent-glow-1: #9b8afb; /* Groq/Gemini style purple */
    --accent-glow-2: #ff7e67; /* Warm peach */
    --accent-glow-3: #58a6ff; /* Cool blue */
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 16px;
    
    --transition-speed: 0.2s ease;
}

[data-theme="light"] {
    --bg-main: #ffffff;
    --bg-sidebar: #f9f9f9;
    --bg-input: #f4f4f4;
    --bg-tile: #f4f4f4;
    --bg-tile-hover: #e5e5e5;
    
    --text-primary: #0d0d0d;
    --text-secondary: #666666;
    --border-color: rgba(0, 0, 0, 0.1);
}

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

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

/* ── Animated Background ──────────────────────────────────────────── */

.mesh-background {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background-color: var(--bg-main);
    transition: background-color var(--transition-speed);
}

.mesh-blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.15; /* Subtle! */
    border-radius: 50%;
    animation: floatBlob 20s infinite ease-in-out alternate;
}

.blob-1 {
    width: 600px; height: 600px;
    background: var(--accent-glow-1);
    top: -10%; left: -10%;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px; height: 500px;
    background: var(--accent-glow-2);
    bottom: -20%; right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    width: 400px; height: 400px;
    background: var(--accent-glow-3);
    top: 40%; left: 40%;
    animation-delay: -10s;
}

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 100px) scale(1.2); }
}

/* ── Layout ───────────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 10;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: background-color var(--transition-speed);
}

.sidebar-header {
    padding: 12px 8px;
    margin-bottom: 12px;
}

.iris-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.new-chat-btn:hover {
    background: var(--bg-tile);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(150,150,150,0.3); border-radius: 10px; }

.session-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background var(--transition-speed);
}

.session-item:hover {
    background: var(--bg-main);
}

.session-item.active {
    background: var(--bg-main);
    font-weight: 500;
}

.session-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 0;
}

.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { color: #ef4444; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--transition-speed);
}

.icon-btn:hover {
    background: var(--bg-main);
}

/* ── Main Chat Area ───────────────────────────────────────────────── */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
}

.chat-header {
    height: 60px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.mobile-menu-btn {
    display: none;
}

/* ── Messages Container ───────────────────────────────────────────── */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

/* Center constrain wrapper for inner content */
.welcome-screen {
    margin: auto;
    text-align: center;
    max-width: 650px;
    width: 100%;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.welcome-screen h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    font-weight: 600;
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.suggestion-tile {
    background: var(--bg-tile);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    color: var(--text-primary);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.suggestion-tile:hover {
    background: var(--bg-tile-hover);
}

.tile-icon { font-size: 1.4rem; }
.tile-text { font-size: 0.95rem; color: var(--text-secondary); }

/* ── Message Bubbles ──────────────────────────────────────────────── */

.message {
    display: flex;
    gap: 16px;
    padding: 24px 0;
    width: 100%;
    max-width: 768px; /* Constrained width for readability */
    margin: 0 auto;
}

/* The user message bubbles are often aligned right or styled differently in modern UIs, 
   but Claude/ChatGPT keep them stacked in a central column. Let's do right-align for user. */
.message.user {
    justify-content: flex-end;
}

.message-content {
    background: transparent;
    max-width: 85%;
    font-size: 1rem;
    line-height: 1.6;
}

.message.user .message-content {
    background: var(--bg-input);
    padding: 12px 18px;
    border-radius: 18px;
}

.message.assistant .message-content {
    padding: 0; /* Flat text block for assistant */
    width: 100%;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px; /* Square/slightly rounded avatar */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.message.user .message-avatar {
    display: none; /* Hide user avatar for a cleaner look */
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--accent-glow-1), var(--accent-glow-3));
    color: white;
}

.message-body p { margin-bottom: 16px; }
.message-body p:last-child { margin-bottom: 0; }

.message-body pre {
    background: #000000 !important;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
    position: relative;
}

.message-body code {
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
    color: #e5e7eb;
}

.message-body p > code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #2f2f2f;
    border: 1px solid #424242;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.code-copy-btn:hover { background: #424242; }

/* Typing indicator */
.typing-dots span {
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* ── Input Area ───────────────────────────────────────────────────── */

.input-area {
    padding: 0 20px 24px 20px;
    max-width: 768px; /* Constrained width */
    width: 100%;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    transition: border-color var(--transition-speed);
}

.input-wrapper:focus-within {
    border-color: var(--text-secondary);
}

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

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

.input-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 4px;
    transition: background var(--transition-speed);
}

.input-btn:hover {
    background: var(--bg-tile);
}

.send-btn.active {
    background: var(--text-primary);
    color: var(--bg-main);
}

.voice-active {
    color: #ef4444;
}

.input-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 8px;
}

/* ── Responsive ───────────────────────────────────────────────────── */

.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed);
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0; bottom: 0;
        z-index: 50;
    }
    .sidebar.open { left: 0; }
    .sidebar-overlay.visible { opacity: 1; visibility: visible; }
    .mobile-menu-btn { display: block; }
    .welcome-suggestions { grid-template-columns: 1fr; }
    .message { max-width: 100%; padding: 16px; }
    .input-area { padding: 12px; }
}
