/* Ava Chat Companion - Feminine Elegant Design */

/* Root Variables */
:root {
    /* Feminine Color Palette */
    --primary-pink: #d891c4;
    --primary-mauve: #b084a6;
    --accent-rose: #e8a7c6;
    --soft-lavender: #e6d9e6;
    --light-cream: #f9f6f7;
    --deep-purple: #6b4968;
    --dark-charcoal: #2d2d2d;
    --white: #ffffff;
    
    /* Text Colors */
    --text-primary: #2d2d2d;
    --text-secondary: #6b4968;
    --text-light: #8a7d8a;
    
    /* Borders - NO RADIUS */
    --border-color: #d891c4;
    --border-light: #e6d9e6;
    
    /* Shadows */
    --shadow-soft: 0 2px 8px rgba(216, 145, 196, 0.1);
    --shadow-medium: 0 4px 16px rgba(216, 145, 196, 0.15);
    
    /* Typography */
    --font-primary: 'Georgia', 'Times New Roman', serif;
    --font-secondary: 'Helvetica Neue', Arial, sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    height: 100dvh;
}

body {
    font-family: var(--font-secondary);
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--light-cream) 0%, var(--soft-lavender) 100%);
    min-height: 100vh;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Chat Page Specific */
body.chat-page {
    height: 100%;
    overflow: hidden;
}

h1, h2, h3 {
    font-family: var(--font-primary);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-family: var(--font-secondary);
    font-size: 15px;
    font-weight: 500;
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--primary-pink);
    color: var(--white);
    border-color: var(--primary-pink);
}

.btn-primary {
    background: var(--primary-pink);
    color: var(--white);
    border-color: var(--primary-pink);
}

.btn-primary:hover {
    background: var(--primary-mauve);
    border-color: var(--primary-mauve);
}

.btn-full {
    width: 100%;
    text-align: center;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    font-size: 20px;
    transition: color 0.3s ease;
}

.btn-icon:hover {
    color: var(--primary-pink);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-light);
    background: var(--white);
    color: var(--text-primary);
    font-family: var(--font-secondary);
    font-size: 15px;
    transition: border-color 0.3s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-pink);
}

.form-hint {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 13px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 2px solid;
}

.alert-error {
    background: #fce8ec;
    border-color: #d891c4;
    color: #6b4968;
}

.alert-success {
    background: #e6f7ec;
    border-color: #b084a6;
    color: #6b4968;
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 580px;
    background: var(--white);
    padding: 48px;
    box-shadow: var(--shadow-medium);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-light);
    font-size: 16px;
}

.auth-form {
    margin-bottom: 24px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.trial-info {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-light);
}

.trial-info p {
    color: var(--text-light);
    font-size: 14px;
}

.auth-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 2px solid var(--border-light);
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-footer a {
    color: var(--primary-pink);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 0 1fr;
    grid-template-rows: 1fr;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: var(--white);
    transition: grid-template-columns 0.25s ease;
    overflow: hidden;
}

.chat-layout.sidebar-open {
    grid-template-columns: 320px 1fr;
}

/* Sidebar toggle button - always visible on desktop, hidden on mobile */
.sidebar-toggle-btn {
    display: none;
    position: absolute;
}

/* Hidden by default - only shown on desktop via media query */
.sidebar-toggle-tip {
    display: none !important;
    position: absolute;
}

@media (min-width: 769px) {
    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        width: 22px;
        height: 56px;
        background: var(--soft-lavender);
        border: 2px solid var(--border-light);
        border-left: none;
        cursor: pointer;
        z-index: 200;
        transition: left 0.25s ease, background 0.15s ease;
        padding: 0;
        color: var(--deep-purple);
    }

    .chat-layout.sidebar-open .sidebar-toggle-btn {
        left: 320px;
    }

    .sidebar-toggle-btn:hover {
        background: var(--primary-pink);
        color: var(--white);
    }

    .sidebar-toggle-btn svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        transition: transform 0.25s ease;
    }

    .chat-layout.sidebar-open .sidebar-toggle-btn svg {
        transform: scaleX(-1);
    }

    .sidebar-toggle-tip {
        display: none !important;
        position: fixed;
        top: 50%;
        left: 30px;
        transform: translateY(-50%);
        background: var(--deep-purple);
        color: var(--white);
        font-size: 12px;
        font-family: var(--font-secondary);
        white-space: nowrap;
        padding: 7px 14px;
        pointer-events: none;
        z-index: 201;
        box-shadow: 2px 2px 8px rgba(0,0,0,0.18);
        animation: tipPulse 2s ease-in-out infinite;
    }

    .sidebar-toggle-tip::before {
        content: '';
        position: absolute;
        top: 50%;
        left: -7px;
        transform: translateY(-50%);
        border-top: 7px solid transparent;
        border-bottom: 7px solid transparent;
        border-right: 7px solid var(--deep-purple);
    }

    @keyframes tipPulse {
        0%, 100% { opacity: 1; }
        50%       { opacity: 0.65; }
    }
}

/* Sidebar collapsed logout button */
.sidebar-collapsed-logout {
    display: none;
    position: absolute;
}

@media (min-width: 769px) {
    .sidebar-collapsed-logout {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: calc(50% + 38px);
        left: 0;
        width: 22px;
        height: 40px;
        background: var(--soft-lavender);
        border: 2px solid var(--border-light);
        border-left: none;
        border-top: none;
        color: var(--deep-purple);
        text-decoration: none;
        z-index: 200;
        transition: left 0.25s ease, background 0.15s ease, color 0.15s ease;
    }

    .sidebar-collapsed-logout:hover {
        background: var(--primary-mauve);
        color: var(--white);
    }

    .chat-layout.sidebar-open .sidebar-collapsed-logout {
        display: none;
    }
}

/* Sidebar */
.chat-sidebar {
    background: linear-gradient(180deg, var(--soft-lavender) 0%, var(--light-cream) 100%);
    border-right: 2px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-width: 0;
    flex-shrink: 0;
    grid-column: 1;
    grid-row: 1;
}

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

.sidebar-header h2 {
    font-size: 24px;
    margin: 0;
}

.user-info {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.subscription-status {
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-light);
}

.subscription-status.active {
    background: rgba(216, 145, 196, 0.1);
}

.subscription-status.inactive {
    background: rgba(232, 167, 198, 0.15);
}

.status-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.status-message {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.trial-messages {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 12px;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.conversations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 12px;
}

.conversations-header h3 {
    font-size: 16px;
}

.conversation-item {
    display: block;
    padding: 16px 24px;
    text-decoration: none;
    color: var(--text-primary);
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}

.conversation-item:hover {
    background: rgba(216, 145, 196, 0.1);
}

.conversation-item.active {
    background: rgba(216, 145, 196, 0.2);
    border-left-color: var(--primary-pink);
}

.conversation-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.conversation-meta {
    font-size: 12px;
    color: var(--text-light);
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 2px solid var(--border-light);
    flex: 1;
    overflow-y: auto;
    background: var(--light-cream);
}

.usage-stats p {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

/* Chat Main Area */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--white);
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    grid-column: 2;
    grid-row: 1;
}

/* Update notice bar - desktop only, hidden on mobile via media query */
.update-notice-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 7px 20px;
    background: var(--soft-lavender);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    font-size: 13px;
    color: var(--deep-purple);
    font-family: var(--font-secondary);
}

.update-notice-btn {
    background: none;
    border: 1px solid var(--deep-purple);
    color: var(--deep-purple);
    padding: 0 12px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-size: 11px;
    font-family: var(--font-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.update-notice-btn:hover {
    background: var(--deep-purple);
    color: var(--white);
}

.update-notice-hide {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: 4px;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.update-notice-hide:hover {
    color: var(--deep-purple);
}

.chat-layout.sidebar-open .update-notice-bar {
    border-left: 1px solid var(--primary-pink);
    border-right: 1px solid var(--primary-pink);
}

.chat-messages {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 32px;
    overflow-anchor: none;
    overscroll-behavior-y: contain;
    scroll-behavior: auto;
    background-image: linear-gradient(rgba(255,255,255,0.75), rgba(255,255,255,0.92)), url('../../imgs/ava-chat-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: local;
}

/* Drag-and-drop overlay */
.chat-main.drag-over {
    position: relative;
}

.chat-main.drag-over::after {
    content: 'Drop image or file here';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(216, 145, 196, 0.15);
    border: 3px dashed var(--primary-pink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-family: var(--font-secondary);
    font-weight: 600;
    color: var(--deep-purple);
    z-index: 100;
    pointer-events: none;
}

.welcome-message {
    text-align: center;
    padding: 64px 32px;
}

.welcome-message h2 {
    font-size: 32px;
    margin-bottom: 16px;
}

.welcome-message p {
    color: var(--text-light);
    font-size: 18px;
}

.message {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
}

.message-user {
    justify-content: flex-end;
}

.message-assistant {
    justify-content: flex-start;
}

/* Copy button styles */
.message-wrapper {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
    max-width: 80%;
}

.message-user .message-wrapper {
    justify-content: flex-end;
    margin-left: auto;
}

.message-assistant .message-wrapper {
    justify-content: flex-start;
    margin-right: auto;
}

.copy-button {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(216, 145, 196, 0.18);
    color: var(--deep-purple);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    font-size: 10px;
    font-family: var(--font-secondary);
    line-height: 16px;
    height: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    z-index: 2;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.message-content:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: var(--primary-pink);
    color: var(--white);
    border-color: var(--primary-pink);
}

.copy-button:active {
    background: var(--primary-mauve);
    border-color: var(--primary-mauve);
    color: var(--white);
}

.copy-button.copied {
    background: var(--deep-purple) !important;
    border-color: var(--deep-purple) !important;
    color: var(--white) !important;
    opacity: 1 !important;
    pointer-events: none;
}

.message-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    margin-right: 12px;
    flex-shrink: 0;
    border-radius: 0;
    border: 2px solid #6b4968;
    background-color: #1e0533;
    object-fit: cover;
    display: block;
}

.message-content {
    position: relative;
    max-width: 70%;
    padding: 16px 20px;
    border: 2px solid var(--border-light);
    flex-grow: 1;
    overflow-wrap: break-word;
    word-break: break-word;
    word-wrap: break-word;
    text-align: left;
}

/* When inside .message-body, content fills the body width */
.message-body .message-content {
    max-width: none;
}

/* Message body: column wrapper for content + toolbar */
.message-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: calc(100% - 52px);
}

.message-user .message-content {
    background: var(--soft-lavender);
    border-color: var(--primary-pink);
}

.message-assistant .message-content {
    background: var(--white);
    border-color: var(--border-light);
}

/* Code formatting */
.code-block-wrapper {
    position: relative;
    margin: 12px 0;
    background: #1e1e1e;
    overflow: hidden;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #2b2b2b;
    border-bottom: 1px solid #3a3a3a;
    min-height: 28px;
}

.code-lang-label {
    font-family: var(--font-secondary);
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.code-copy-btn {
    background: transparent;
    border: 1px solid #555;
    color: #ccc;
    font-size: 11px;
    font-family: var(--font-secondary);
    padding: 2px 10px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.4;
    margin-left: auto;
}

.code-copy-btn:hover {
    background: var(--primary-pink);
    color: var(--white);
    border-color: var(--primary-pink);
}

.code-copy-btn.copied {
    background: var(--deep-purple);
    border-color: var(--deep-purple);
    color: var(--white);
}

.message-content .code-block-wrapper pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    background: transparent;
}

.message-content pre {
    background: #1e1e1e;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
}

.message-content code.code-block {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e6e6e6;
    white-space: pre;
    display: block;
    tab-size: 4;
}

/* Syntax highlighting colors */
.hl-keyword { color: #c586c0; }
.hl-string { color: #ce9178; }
.hl-comment { color: #6a9955; font-style: italic; }
.hl-number { color: #b5cea8; }
.hl-builtin { color: #4ec9b0; }
.hl-tag { color: #569cd6; }

.message-content code.inline-code {
    background: #f0ebf5;
    color: #86448a;
    padding: 2px 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88em;
    border: 1px solid #e0d6e8;
}

.message-content strong {
    font-weight: 600;
    color: var(--primary-pink);
}

.message-content em {
    font-style: italic;
    color: var(--text);
}

.message-content del {
    text-decoration: line-through;
    opacity: 0.7;
}

/* Headings inside messages */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 12px 0 6px 0;
    padding: 0;
    font-weight: 600;
    color: var(--deep-purple);
    line-height: 1.3;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.25em; }
.message-content h3 { font-size: 1.1em; }
.message-content h4 { font-size: 1.0em; }
.message-content h5 { font-size: 0.95em; }
.message-content h6 { font-size: 0.9em; }

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

/* Paragraphs inside messages */
.message-content p {
    margin: 0 0 8px 0;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Lists inside messages */
.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-content li::marker {
    color: var(--primary-pink);
}

/* Checkbox list */
.message-content ul.md-checklist {
    list-style: none;
    padding-left: 4px;
}

.message-content ul.md-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message-content ul.md-checklist input[type="checkbox"] {
    margin-top: 4px;
    accent-color: var(--primary-pink);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Blockquotes */
.message-content blockquote {
    margin: 10px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--primary-pink);
    background: rgba(216, 145, 196, 0.08);
    color: var(--text-secondary);
    font-style: italic;
}

/* Links */
.message-content a {
    color: var(--primary-pink);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.message-content a:hover {
    color: var(--deep-purple);
}

/* Tables */
.message-content .table-wrapper {
    overflow-x: auto;
    margin: 10px 0;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.message-content th,
.message-content td {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    text-align: left;
}

.message-content th {
    background: var(--soft-lavender);
    font-weight: 600;
    color: var(--deep-purple);
}

.message-content td {
    background: var(--white);
}

.message-content tr:nth-child(even) td {
    background: rgba(230, 217, 230, 0.3);
}

/* Horizontal rule */
.message-content hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 14px 0;
}

/* Email copy box */
.email-copy-box {
    border: 2px solid var(--primary-pink);
    background: #fdf8fb;
    margin: 4px 0;
}

.email-copy-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--soft-lavender) 0%, #f3e8f0 100%);
    border-bottom: 1px solid var(--border-light);
}

.email-copy-box-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--deep-purple);
    font-family: var(--font-secondary);
}

.email-copy-btn {
    background: var(--deep-purple);
    color: var(--white);
    border: none;
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-secondary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease;
}

.email-copy-btn:hover {
    background: var(--primary-pink);
}

.email-copy-btn.copied {
    background: var(--primary-pink) !important;
    pointer-events: none;
}

.email-copy-box-body {
    padding: 14px 16px;
}

.email-copy-box-body p {
    margin: 0 0 6px 0;
}

.email-copy-box-body p:last-child {
    margin-bottom: 0;
}

/* ── Inline email viewer (rendered in chat) ── */
.email-inbox-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary-pink) 0%, #b76ba3 100%);
    color: var(--white);
    margin: -14px -18px 12px -18px;
}
.email-inbox-title {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-secondary);
}
.email-inbox-meta {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}
.email-inbox-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.email-inbox-btn {
    background: var(--deep-purple);
    color: var(--white);
    border: none;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-secondary);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background 0.15s;
}
.email-inbox-btn:hover {
    background: var(--primary-pink);
}

.email-card-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.email-card {
    border: 2px solid var(--border-light);
    background: var(--white);
    transition: opacity 0.3s;
}
.email-card + .email-card {
    border-top: none;
}
.email-card.read {
    opacity: 0.5;
}
.email-card-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 14px;
    cursor: pointer;
    gap: 10px;
    transition: background 0.15s;
}
.email-card-row:hover {
    background: var(--light-cream);
}
.email-card-indicator {
    width: 8px;
    height: 8px;
    background: var(--primary-pink);
    flex-shrink: 0;
    margin-top: 6px;
}
.email-card.read .email-card-indicator {
    background: #ccc;
}
.email-card-info {
    flex: 1;
    min-width: 0;
}
.email-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.email-card-from {
    font-weight: 600;
    color: var(--deep-purple);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}
.email-card-date {
    font-size: 11px;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 0;
}
.email-card-subject {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 2px 0;
}
.email-card-preview {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.email-card.expanded .email-card-preview {
    display: none;
}

/* Expanded body */
.email-card-body {
    display: none;
    padding: 0 14px 14px 32px;
}
.email-card.expanded .email-card-body {
    display: block;
}
.email-card-body-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}
.email-card-body-meta strong {
    color: var(--text-primary);
}
.email-card-body-text {
    background: #f9f9f9;
    border-left: 3px solid var(--primary-pink);
    padding: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-primary);
}
.email-card-body-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.email-action-btn {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-secondary);
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background 0.15s, opacity 0.15s;
    color: var(--white);
}
.email-action-read {
    background: #4a90e2;
}
.email-action-read:hover {
    background: #357abd;
}
.email-action-read.done {
    background: #28a745;
    cursor: default;
}
.email-action-reply {
    background: var(--deep-purple);
}
.email-action-reply:hover {
    background: var(--primary-pink);
}
.email-action-copy {
    background: var(--text-light);
}
.email-action-copy:hover {
    background: var(--deep-purple);
}
.email-action-copy.done {
    background: #28a745;
}
.email-action-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.email-card-more {
    padding: 10px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--primary-pink);
    font-weight: 600;
    background: var(--light-cream);
    border: 2px solid var(--border-light);
    border-top: none;
}

.typing-indicator {
    opacity: 0.6;
}

.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary-pink);
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

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

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Chat Input */
.chat-input-container {
    padding: 24px 32px;
    border-top: 2px solid var(--border-light);
    background-color: var(--light-cream);
    background-image: linear-gradient(rgba(250,246,249,0.88), rgba(250,246,249,0.88)), url('../../imgs/msg-bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    flex-grow: 0;
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-form textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 150px;
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.btn-file {
    padding: 12px 16px;
    background: #2196F3;
    background-image: linear-gradient(rgba(33,150,243,0.82), rgba(33,150,243,0.82)), url('../../imgs/btn-texture.webp');
    background-size: cover;
    background-position: center;
    border: 2px solid #2196F3;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.btn-file:hover:not(:disabled) {
    background: #1976D2;
    border-color: #1976D2;
    transform: scale(1.05);
}

.btn-file:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-file:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-file svg {
    display: block;
}

.btn-large-input {
    padding: 12px 16px;
    background: #9C27B0;
    background-image: linear-gradient(rgba(156,39,176,0.82), rgba(156,39,176,0.82)), url('../../imgs/btn-texture.webp');
    background-size: cover;
    background-position: center;
    border: 2px solid #9C27B0;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-large-input:hover:not(:disabled) {
    background: #7B1FA2;
    border-color: #7B1FA2;
    transform: scale(1.05);
}

.btn-large-input:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-large-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-large-input svg {
    display: block;
}

.btn-send {
    padding: 12px 20px;
    background: var(--primary-pink);
    background-image: linear-gradient(rgba(233,30,99,0.82), rgba(233,30,99,0.82)), url('../../imgs/btn-texture.webp');
    background-size: cover;
    background-position: center;
    border: 2px solid var(--primary-pink);
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 0;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-mauve);
    border-color: var(--primary-mauve);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stop generating button (replaces send during streaming) */
.btn-stop {
    padding: 12px 20px;
    background: #d32f2f;
    background-image: linear-gradient(rgba(211,47,47,0.82), rgba(211,47,47,0.82)), url('../../imgs/btn-texture.webp');
    background-size: cover;
    background-position: center;
    border: 2px solid #d32f2f;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 0;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-stop:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}

.btn-stop svg {
    display: block;
}

/* Continue button -- full-width, prominent, at bottom of chat */
.btn-continue-response {
    background: transparent;
    border: 2px solid var(--primary-pink);
    color: var(--primary-pink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 0;
    line-height: 1.4;
    text-align: center;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

.btn-continue-response:hover {
    background: var(--primary-pink);
    color: var(--white);
}

/* ── Message Toolbar ── */
.msg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
    background: #f6f0f6;
    border: 2px solid var(--border-light);
    border-top: none;
}

.msg-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-light);
    color: var(--deep-purple);
    font-size: 12px;
    font-family: var(--font-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.msg-toolbar-btn:last-child {
    border-right: none;
}

.msg-toolbar-btn:hover {
    background: var(--soft-lavender);
    color: var(--primary-pink);
}

.msg-toolbar-btn svg {
    flex-shrink: 0;
}

/* ── Styler Modal ── */
.styler-modal {
    position: fixed;
    z-index: 10000;
    width: 300px;
    background: var(--white);
    border: 2px solid var(--border-light);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.styler-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f6f0f6;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
    color: var(--deep-purple);
    user-select: none;
}

.styler-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.styler-modal-close:hover {
    color: var(--primary-pink);
}

.styler-modal-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.styler-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.styler-harmony-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.styler-swatch {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.styler-swatch:hover {
    transform: scale(1.15);
}

.styler-swatch.active {
    border-color: var(--deep-purple);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--deep-purple);
}

.styler-select {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    font-family: var(--font-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    background: var(--white);
    outline: none;
}

.styler-select:focus {
    border-color: var(--primary-pink);
}

.styler-size-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.styler-range {
    flex: 1;
    accent-color: var(--primary-pink);
}

.styler-size-val {
    font-size: 13px;
    font-weight: 500;
    color: var(--deep-purple);
    min-width: 36px;
    text-align: right;
}

.styler-reset-btn {
    margin-top: 4px;
    border: 1px solid var(--border-light) !important;
    justify-content: center;
    font-size: 11px;
    color: var(--text-light);
}

.styler-reset-btn:hover {
    background: #fce4ec;
    color: var(--primary-pink);
}

/* ── Markdown Info Panel ── */
.markdown-info-panel {
    width: 100%;
    background: #fefcfe;
    border: 2px solid var(--border-light);
    border-top: none;
}

.markdown-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #f6f0f6;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    font-weight: 600;
    color: var(--deep-purple);
}

.markdown-info-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.markdown-info-close:hover {
    color: var(--primary-pink);
}

.markdown-info-body {
    padding: 10px 14px;
}

.markdown-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.5;
}

.markdown-info-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f0eaf0;
    vertical-align: top;
}

.markdown-info-table td:first-child {
    font-family: 'Courier New', Courier, monospace;
    color: var(--deep-purple);
    white-space: nowrap;
    width: 40%;
}

.markdown-info-table td:last-child {
    color: var(--text-light);
}

.markdown-info-table tr:last-child td {
    border-bottom: none;
}

/* Small inline typing indicator for continue streaming */
.continue-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
    vertical-align: middle;
}

/* Subtle "Continuing..." label shown during auto-continue reconnect */
.continue-connecting {
    color: var(--text-light);
    font-size: 12px;
    font-style: italic;
    padding: 6px 0 2px;
    opacity: 0.7;
}

/* Stream activity indicator -- pulsing dots shown when content stalls */
.stream-activity-indicator {
    display: flex;
    gap: 6px;
    padding: 14px 0 4px;
    align-items: center;
}

.stream-activity-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-pink);
    display: inline-block;
    border-radius: 0;
    animation: streamPulse 1.4s ease-in-out infinite;
}

.stream-activity-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.stream-activity-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes streamPulse {
    0%, 80%, 100% {
        transform: scale(0.5);
        opacity: 0.3;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        transform: translateY(50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--soft-lavender);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-pink);
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--primary-pink);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 2px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--light-cream);
}

.btn-secondary {
    background: var(--text-light);
    border: 2px solid var(--text-light);
    color: var(--white);
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #6b4968;
    border-color: #6b4968;
}

/* Large Input Modal — Tabs + Search */
.lim-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    background: var(--soft-lavender);
    padding: 0 24px;
    gap: 0;
}

.lim-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    margin-bottom: -2px;
}

.lim-tab:hover {
    color: var(--primary-pink);
}

.lim-tab.active {
    color: var(--primary-pink);
    border-bottom-color: var(--primary-pink);
}

.lim-tab-panel {
    display: none;
}

.lim-tab-panel.active {
    display: flex;
}

/* ── Edit Modal Tabs ── */
.edit-tab-panel {
    display: none;
}

.edit-tab-panel.active {
    display: flex;
    flex: 1 1 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

#editMessageModal .modal-content {
    overflow: hidden;
}

/* ── Markdown Syntax Editor ── */
.md-editor-wrap {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.md-editor-backdrop {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 14px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    border: 2px solid var(--border-light);
    background: #fefcfe;
    color: var(--text-primary);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 0;
}

.md-editor-backdrop code {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    tab-size: inherit;
    white-space: inherit;
    background: none;
    padding: 0;
    display: block;
    color: inherit;
}

.md-editor-textarea {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 14px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 4;
    border: 2px solid var(--border-light);
    resize: none;
    box-sizing: border-box;
    overflow-y: auto;
    outline: none;
    color: transparent;
    caret-color: var(--text-primary);
    background: transparent;
    -webkit-text-fill-color: transparent;
    z-index: 1;
}

.md-editor-textarea:focus {
    border-color: var(--primary-pink);
}

.md-editor-textarea:focus ~ .md-editor-backdrop {
    border-color: var(--primary-pink);
}

.md-editor-textarea::selection {
    background: rgba(180, 130, 200, 0.3);
    -webkit-text-fill-color: var(--text-primary);
    color: var(--text-primary);
}

/* Syntax token colors */
.md-h      { color: #8b2fc9; font-weight: 700; }
.md-h-text  { color: #6b21a8; font-weight: 700; }
.md-bold    { color: #c2185b; font-weight: 700; }
.md-italic  { color: #6a1b9a; font-style: italic; }
.md-strike  { color: #78909c; text-decoration: line-through; }
.md-code    { color: #d32f2f; background: rgba(220, 200, 230, 0.25); }
.md-fence   { color: #00897b; font-weight: 600; }
.md-fence-lang { color: #00695c; font-weight: 400; font-style: italic; }
.md-link-text  { color: #1565c0; }
.md-link-url   { color: #6a1b9a; }
.md-link-punc  { color: #9e9e9e; }
.md-img-alt    { color: #e65100; }
.md-blockquote { color: #7e57c2; font-style: italic; }
.md-list    { color: #c2185b; font-weight: 700; }
.md-hr      { color: #bdbdbd; font-weight: 700; }
.md-table-pipe { color: #7e57c2; font-weight: 600; }
.md-escape  { color: #9e9e9e; }
.md-html    { color: #00838f; }
.md-text    { color: var(--text-primary); }

#editMessageModal .message-content {
    max-width: none;
    border: none;
    padding: 0;
}

/* ── Visual Editor Toolbar ── */
.ve-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    background: var(--soft-lavender);
    border-bottom: 2px solid var(--border-light);
}

.ve-btn {
    background: none;
    border: 1px solid transparent;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--deep-purple);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: var(--font-secondary);
    white-space: nowrap;
    line-height: 1.3;
}

.ve-btn:hover {
    background: var(--white);
    border-color: var(--border-light);
}

.ve-btn:active {
    background: var(--primary-pink);
    color: var(--white);
}

.ve-btn-styler {
    margin-left: auto;
    color: var(--primary-pink);
    font-weight: 700;
}

.ve-sep {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 4px;
}

/* Visual editor contenteditable area */
.ve-editable {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ve-editable:focus {
    border-color: var(--primary-pink) !important;
}

.ve-editable h1,
.ve-editable h2,
.ve-editable h3,
.ve-editable h4 {
    color: var(--text-secondary);
    margin: 12px 0 6px;
}

.ve-editable blockquote {
    border-left: 3px solid var(--primary-pink);
    margin: 8px 0;
    padding: 6px 14px;
    color: #555;
}

.ve-editable pre {
    background: #1e1e1e;
    color: #e6e6e6;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    white-space: pre-wrap;
    font-size: 13px;
}

.ve-editable table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

.ve-editable th,
.ve-editable td {
    border: 1px solid #ccc;
    padding: 6px 10px;
    text-align: left;
}

.ve-editable th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Memory search results */

/* Search suggestions dropdown */
.memory-search-wrap {
    position: relative;
}

.memory-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 2px solid #e6d9e6;
    border-top: none;
    z-index: 10;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.memory-suggestion {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.12s ease;
}

.memory-suggestion:hover {
    background: var(--soft-lavender);
    color: var(--primary-pink);
}

/* Filter bar */
.memory-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.memory-filter-check {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
}

.memory-filter-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary-pink);
    cursor: pointer;
}

.memory-filter-dates {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.memory-filter-date-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.memory-date-input {
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #e6d9e6;
    color: var(--text-dark);
    font-family: inherit;
    background: var(--white);
}

.memory-result-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s ease;
    overflow: hidden;
}

.memory-result-item:hover {
    background: var(--soft-lavender);
}

.memory-result-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.memory-result-role {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.memory-role-user {
    color: var(--primary-pink);
}

.memory-role-assistant {
    color: #7c5cbf;
}

.memory-result-date {
    font-size: 11px;
    color: var(--text-light);
}

.memory-result-conv {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-style: italic;
}

.memory-result-snippet {
    font-size: 13px;
    color: var(--text-dark);
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Memory preview pane */
#memoryPreviewBody {
    background: var(--white);
    font-family: inherit;
    line-height: 1.7;
}

#memoryPreviewBody pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 13px;
}

#memoryPreviewBody code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

#memoryPreviewBody p {
    margin: 8px 0;
}

#memoryPreviewBody h1,
#memoryPreviewBody h2,
#memoryPreviewBody h3 {
    margin: 14px 0 6px;
    color: var(--primary-pink);
}



/* OCR Modal */
.ocr-modal-content {
    max-width: 700px;
}

.ocr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(216, 145, 196, 0.2);
    border-top-color: var(--primary-pink);
    animation: ocrSpin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes ocrSpin {
    to { transform: rotate(360deg); }
}

#ocrTextarea:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 2px rgba(216, 145, 196, 0.2);
}

#ocrModalSend:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Update entries inside the updates modal */
.update-entry {
    border-bottom: 1px solid var(--border-light);
    padding: 16px 0;
}

.update-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.update-entry-date {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    font-family: var(--font-secondary);
}

.update-entry-title {
    font-size: 15px;
    color: var(--deep-purple);
    font-weight: 600;
    margin: 0 0 6px 0;
}

.update-entry-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

/* Links */
a {
    color: var(--primary-pink);
}

.link-secondary {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
}

.link-secondary:hover {
    color: var(--primary-pink);
    text-decoration: underline;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    background: var(--primary-pink);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: var(--primary-mauve);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--white);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mobile-menu-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    background: linear-gradient(180deg, var(--soft-lavender) 0%, var(--light-cream) 100%);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.mobile-menu-panel.active {
    transform: translateX(0);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
}

.mobile-menu-header {
    padding: 24px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-header h2 {
    font-size: 28px;
    margin: 0;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 36px;
    color: var(--primary-mauve);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mobile-menu-content {
    padding: 20px;
}

.mobile-user-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid var(--border-light);
}

.mobile-user-info strong {
    display: block;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 5px;
}

.mobile-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.mobile-balance {
    background: #e6d9e6;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.mobile-balance-label {
    margin: 0 0 5px 0;
    color: #8a7d8a;
    font-size: 12px;
}

.mobile-balance-amount {
    margin: 0;
    color: #6b4968;
    font-size: 24px;
    font-weight: 600;
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: white;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: all 0.2s;
}

.mobile-menu-link:hover {
    background: var(--soft-lavender);
    border-color: var(--primary-pink);
}

.mobile-menu-link svg {
    flex-shrink: 0;
}

.mobile-menu-link-danger {
    color: #d63384;
}

.mobile-menu-link-danger:hover {
    background: #ffe6f0;
    border-color: #d63384;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-overlay {
        display: block;
    }

    .mobile-menu-panel {
        display: block;
    }
    
    .chat-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        display: none; /* Hide desktop sidebar on mobile */
    }
    
    .update-notice-bar {
        display: none;
    }

    .chat-main {
        margin-left: 0;
        grid-column: 1;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .auth-container {
        padding: 32px 24px;
    }
    
    .chat-messages {
        padding: 60px 16px 8px;
    }
    
    /* Mobile chat message adjustments */
    .message-wrapper {
        max-width: 95%;
    }
    
    .message-content {
        max-width: none;
        width: 100%;
    }

    .message-body {
        max-width: calc(100% - 40px);
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        margin-right: 8px;
        border-radius: 0;
        border: 2px solid #6b4968;
        background-color: #1e0533;
    }
    
    .copy-button {
        font-size: 10px;
        padding: 2px 6px;
        height: 18px;
    }
    
    /* Reduce padding on mobile for more space */
    .message-content {
        padding: 12px 16px;
    }
    
    /* Mobile chat input improvements */
    .chat-input-container {
        padding: 12px;
    }
    
    .chat-form {
        gap: 8px;
    }
    
    .chat-form textarea {
        min-height: 44px;
        font-size: 16px;
        padding: 10px 12px;
    }
    
    .btn-send {
        min-height: 44px;
        padding: 12px 18px;
        font-size: 16px;
    }

    .btn-stop {
        min-height: 44px;
        padding: 12px 18px;
    }

    .msg-toolbar {
        gap: 0;
    }

    .msg-toolbar-btn {
        padding: 10px 12px;
        font-size: 11px;
    }

    .styler-modal {
        width: 260px;
    }

    .markdown-info-table td:first-child {
        font-size: 11px;
    }
    
    /* Hide file upload and large input buttons on mobile */
    .btn-file,
    .btn-large-input {
        display: none !important;
    }
}

/* ===================================
   MAIN HEADER STYLES
=================================== */

.main-header {
    background: white;
    border-bottom: 2px solid #e6d9e6;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header-left .logo {
    font-size: 24px;
    font-weight: 700;
    color: #e91e63;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.main-nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: #2c1810;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #e91e63;
}

.nav-link.active {
    color: #e91e63;
    background: #faf8fa;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 500;
    color: #2c1810;
}

.logout-btn {
    text-decoration: none;
    color: #8a7d8a;
    font-weight: 500;
    padding: 8px 16px;
    transition: color 0.2s ease;
}

.logout-btn:hover {
    color: #e91e63;
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
        height: 56px;
    }
    
    .main-nav {
        gap: 16px;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .user-name {
        display: none;
    }
}

/* ===================================
   TO-DO LIST STYLES
=================================== */

.todo-form-container {
    background: #ffffff;
    border: 1px solid #e6d9e6;
    padding: 24px;
    margin-bottom: 32px;
}

.todo-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e6d9e6;
    background: #ffffff;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
}

.task-input:focus {
    outline: none;
    border-color: #e91e63;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.todo-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.task-section {
    background: #ffffff;
    border: 1px solid #e6d9e6;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #faf8fa;
    border-bottom: 1px solid #e6d9e6;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c1810;
    margin: 0;
}

.task-count {
    background: #e91e63;
    color: white;
    padding: 4px 12px;
    font-size: 14px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.task-list {
    padding: 0;
    max-height: 600px;
    overflow-y: auto;
}

.task-list.collapsed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.task-list.expanded {
    max-height: 600px;
    transition: max-height 0.3s ease;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #ffffff;
    transition: background-color 0.2s ease;
}

.task-item:hover {
    background: #faf8fa;
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #e6d9e6;
    margin-right: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.task-checkbox:hover {
    border-color: #e91e63;
}

.task-checkbox.checked {
    background: #e91e63;
    border-color: #e91e63;
}

.task-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-title {
    font-size: 16px;
    font-weight: 500;
    color: #2c1810;
    line-height: 1.4;
}

.task-title.completed {
    text-decoration: line-through;
    color: #8a7d8a;
}

.task-description {
    font-size: 14px;
    color: #6b5b6b;
    line-height: 1.4;
}

.task-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-item:hover .task-actions {
    opacity: 1;
}

.task-action {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.task-action.edit {
    background: #87ceeb;
    color: white;
}

.task-action.edit:hover {
    background: #4a9bc1;
}

.task-action.delete {
    background: #dc3545;
    color: white;
}

.task-action.delete:hover {
    background: #b02a37;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #e6d9e6;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e6d9e6;
    background: #faf8fa;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c1810;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #8a7d8a;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #2c1810;
}

.modal-body {
    padding: 24px;
}

.enhancement-input,
.enhancement-output {
    margin-bottom: 20px;
}

.enhancement-input label,
.enhancement-output label {
    display: block;
    font-weight: 600;
    color: #2c1810;
    margin-bottom: 8px;
}

.enhancement-input input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e6d9e6;
    background: #f8f8f8;
    font-size: 14px;
}

.suggestions-container {
    border: 2px solid #e6d9e6;
    padding: 16px;
    min-height: 120px;
    background: #fafafa;
}

.loading-state {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #8a7d8a;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e6d9e6;
    border-top: 2px solid #e91e63;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.suggestion-item {
    padding: 12px 0;
    border-bottom: 1px solid #e6d9e6;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f0f0f0;
}

.suggestion-title {
    font-weight: 600;
    color: #2c1810;
    margin-bottom: 4px;
}

.suggestion-desc {
    font-size: 14px;
    color: #6b5b6b;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e6d9e6;
    background: #faf8fa;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #8a7d8a;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #6b5b6b;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
    }
    
    .task-item {
        padding: 12px 16px;
    }
    
    .task-actions {
        opacity: 1;
    }
    
    .modal-content {
        width: 95%;
        margin: 16px;
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 2px solid #e6d9e6;
    padding: 16px 20px;
    max-width: 400px;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #e91e63;
}

.notification-warning {
    border-left: 4px solid #ffc107;
}

.notification-error {
    border-left: 4px solid #dc3545;
}

.notification-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #2c1810;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #8a7d8a;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #2c1810;
}

/* Selected suggestion styling */
.suggestion-item.selected {
    background: #e91e63 !important;
    color: white;
}

.suggestion-item.selected .suggestion-title {
    color: white;
}

.suggestion-item.selected .suggestion-desc {
    color: #f0f0f0;
}
