/* CSS DESIGN SYSTEM - CLARIONX CHAT */
:root {
    /* DEFAULT (DARK THEME) VARIABLES */
    --bg-dark: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: #1f293d;
    --bg-input: #1a2332;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(59, 130, 246, 0.4);

    --primary: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --accent: #8b5cf6;
    --success: #10b981;
    --danger: #f43f5e;

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --font-main: 'Outfit', sans-serif;
    --font-code: 'Fira Code', monospace;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --bg-header: rgba(11, 15, 25, 0.95);
}

body.light-theme {
    /* LIGHT THEME OVERRIDES */
    --bg-dark: #f0f4f8;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #e2e8f0;
    --border-color: rgba(0, 0, 0, 0.1);

    --text-main: #000000;
    --text-muted: #4b5563;
    --text-dim: #6b7280;

    --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --bg-header: rgba(240, 244, 248, 0.95);
}

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

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* SIDEBAR */
.sidebar {
    width: 300px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.brand-text h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.badge {
    font-size: 0.65rem;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.new-chat-btn {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: 10px 16px;
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.sidebar-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section.scrollable {
    overflow-y: auto;
}

.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.custom-select {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    outline: none;
    font-family: var(--font-main);
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.session-item:hover,
.session-item.active {
    background: var(--bg-card);
    color: var(--text-main);
    border-left: 3px solid var(--primary);
}

/* RAG Knowledge Base Modern Styling */
.rag-knowledge-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rag-upload-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px dashed var(--primary, #6366f1);
    color: var(--text-main, #ffffff);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 4px;
}

.rag-upload-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(168, 85, 247, 0.35));
    border-style: solid;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.document-item {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    color: var(--text-main, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.document-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.4);
}

.document-item .doc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 82%;
}

.document-item .doc-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-item .delete-doc-btn {
    background: transparent;
    border: none;
    color: #f43f5e;
    opacity: 0.65;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.document-item .delete-doc-btn:hover {
    opacity: 1.0;
    background: rgba(244, 63, 94, 0.15);
}

.no-docs-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    font-style: italic;
    padding: 4px 2px;
}

.sidebar-footer {
    padding: 16px 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.user-info span {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-status {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* MAIN CHAT AREA */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    position: relative;
}

.chat-header {
    min-height: 65px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    z-index: 100;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.mobile-toggle {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.toggle-pill-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.toggle-pill-btn.active {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cart-btn {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MESSAGES CONTAINER */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-screen {
    max-width: 800px;
    margin: auto;
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-screen h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.05rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.feature-card i {
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.feature-card h4 {
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0;
}

/* CHAT BUBBLES */
.message-row {
    display: flex;
    gap: 14px;
    max-width: 850px;
    margin: 0 auto;
    width: 100%;
}

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

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.message-row.user .msg-avatar {
    background: var(--primary-gradient);
    color: #fff;
}

.message-row.assistant .msg-avatar {
    background: var(--bg-card);
    color: var(--accent);
    border: 1px solid var(--border-color);
}

.msg-content-box {
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 80%;
}

.message-row.user .msg-content-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 14px 18px;
    border-radius: var(--radius-md);
}

.message-row.assistant .msg-content-box {
    background: transparent;
    border: none;
    padding: 0;
    max-width: 100%;
}

.rag-tag {
    font-size: 0.75rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

/* PRODUCT CARDS IN CHAT */
.chat-product-cards {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.chat-product-card {
    min-width: 200px;
    max-width: 220px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.chat-product-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.chat-product-card h5 {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.chat-product-card .price {
    color: var(--success);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.chat-product-card button {
    width: 100%;
    padding: 6px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* INPUT TOOLBAR */
.input-container {
    padding: 16px 24px 20px;
    background: var(--bg-dark);
}

.input-toolbar {
    max-width: 850px;
    margin: 0 auto;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-glow);
}

.input-toolbar:focus-within {
    border-color: var(--border-highlight);
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    resize: none;
    max-height: 120px;
}

.mic-btn.recording {
    color: var(--danger);
    background: rgba(244, 63, 94, 0.2);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(244, 63, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
    }
}

.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ATTACHMENT PREVIEW */
.attachment-preview-bar {
    max-width: 850px;
    margin: 0 auto 8px;
}

.preview-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.preview-item img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 4px;
}

/* SHOPPING DRAWER */
.shopping-drawer {
    width: 340px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: -340px;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: right 0.3s ease;
}

.shopping-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.shop-search input {
    width: 100%;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    outline: none;
}

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.shop-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    gap: 12px;
}

.shop-card img {
    width: 75px;
    height: 75px;
    object-fit: cover;
    border-radius: 8px;
}

.shop-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.shop-card-info h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.shop-card-info .price {
    color: var(--success);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.shop-card-info button {
    margin-top: auto;
    padding: 6px 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.cart-summary {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.checkout-btn {
    width: 100%;
    padding: 14px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

/* MODAL OVERLAY */
/* MODAL OVERLAY & CARD */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 9, 20, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2), 0 0 20px rgba(59, 130, 246, 0.1);
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* FIREBASE AUTH SOCIAL & FORM STYLES */
.auth-social-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.social-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    outline: none;
}

.social-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.social-btn.google-btn:hover {
    color: #4285F4;
    background: rgba(66, 133, 244, 0.1);
    border-color: #4285F4;
}

.social-btn.anon-btn:hover {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    border-color: #a855f7;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    width: 100%;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 14px;
}

.auth-tabs {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.auth-tabs .tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
}

.auth-tabs .tab-btn.active {
    color: #ffffff;
    background: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    border-bottom: none;
}

.form-group {
    margin-bottom: 18px;
    width: 100%;
    box-sizing: border-box;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 10px;
    outline: none;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.submit-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    margin-top: 6px;
    box-sizing: border-box;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.memory-modal-card {
    max-width: 650px;
    width: 90%;
}

.memory-count-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.4);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.memory-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.cat-tab {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.cat-tab:hover {
    color: var(--text-main);
    border-color: var(--primary-color);
}

.cat-tab.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.add-memory-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-memory-box input {
    flex: 1;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.mem-cat-select {
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
}

.memory-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    gap: 10px;
}

.memory-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.memory-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

.cat-pill.profile { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.cat-pill.preference { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.cat-pill.instruction { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.cat-pill.work { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.cat-pill.shopping { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

.memory-actions {
    display: flex;
    gap: 6px;
}

.memory-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.memory-actions button:hover {
    color: var(--text-main);
}

.memory-actions button.delete-btn:hover {
    color: #ef4444;
}

.modal-footer-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.danger-outline-btn {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.danger-outline-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.inline-edit-box {
    display: flex;
    gap: 6px;
    flex: 1;
}

.inline-edit-box input {
    padding: 4px 8px;
    background: var(--bg-main);
    border: 1px solid var(--primary-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    flex: 1;
}

/* Toast alert for extracted memories */
.memory-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-toast {
    background: var(--bg-card);
    border: 1px solid var(--primary-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.hidden {
    display: none !important;
}


/* APP NAVIGATION PILLS IN HEADER */
.nav-app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.nav-app-btn.film-btn {
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

.nav-app-btn.film-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.nav-app-btn.physio-btn {
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
    background: rgba(16, 185, 129, 0.08);
}

.nav-app-btn.physio-btn:hover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.nav-app-btn.shop-btn {
    border-color: rgba(59, 130, 246, 0.35);
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.08);
}

.nav-app-btn.shop-btn:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.cart-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* GENERIC APP DRAWERS */
.app-drawer {
    width: 440px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 500;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    transition: transform var(--transition-medium);
}

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-header.film-header h3 {
    color: #f87171;
}

.drawer-header.physio-header h3 {
    color: #34d399;
}

.drawer-header.shop-header h3 {
    color: #60a5fa;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.drawer-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.drawer-filter-bar input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
}

.custom-select-sm {
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
}

/* FILMMASTI CINEMA CARDS */
.film-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.film-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    gap: 12px;
}

.film-poster {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.film-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.film-details h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: #fff;
}

.film-badge {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.showtime-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.showtime-chip {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.showtime-chip:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* PHYSIOTHERAPY CARDS & SYMPTOM CHECKER */
.symptom-checker-box {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
}

.symptom-checker-box h4 {
    color: #34d399;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.symptom-input-row {
    display: flex;
    gap: 8px;
}

.symptom-input-row input {
    flex: 1;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
}

.physio-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.physio-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.physio-card h4 {
    color: #34d399;
    font-size: 1rem;
    margin-bottom: 4px;
}

.physio-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.physio-card .price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* INTERACTIVE CHAT CARDS */
.chat-interactive-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 10px;
    box-shadow: var(--shadow-glow);
}

.card-header-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    display: inline-block;
    margin-bottom: 8px;
}

.card-header-badge.film {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.card-header-badge.physio {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.card-header-badge.shop {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* ------------------------------------------------------------------- */
/* MODEL SELECTOR DROPDOWN MENU (MATCHING REFERENCE UI) */
/* ------------------------------------------------------------------- */
.model-select-wrapper {
    position: relative;
    display: inline-block;
}

.model-pill-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-weight: 600;
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

.model-pill-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.model-pill-btn .text-accent {
    color: #38bdf8;
}

.model-pill-btn .arrow-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.model-pill-btn.active .arrow-icon {
    transform: rotate(180deg);
}

.model-input-pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-family: var(--font-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.model-input-pill-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--border-highlight);
}

.model-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    max-height: 440px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-color);
    z-index: 1000;
    padding: 0 0 6px 0;
    font-family: var(--font-main);
    backdrop-filter: blur(20px);
}

.model-dropdown-menu.hidden {
    display: none;
}

.model-dropdown-menu .dropdown-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #2dd4bf;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(45, 212, 191, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px 14px 0 0;
    cursor: pointer;
}

.model-dropdown-menu .dropdown-header:hover {
    background: rgba(45, 212, 191, 0.14);
}

.model-list {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}

.model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.model-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.model-item.active {
    background: rgba(56, 189, 248, 0.1);
    border-left-color: #38bdf8;
}

.model-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-item-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.model-item.active .model-item-icon {
    color: #38bdf8;
}

.model-item-name {
    font-size: 0.88rem;
    color: var(--text-main);
    font-weight: 500;
}

.model-item-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    margin-left: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.model-item-badge.badge-max {
    background: rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
}

.model-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-check-icon {
    color: #38bdf8;
    font-size: 0.85rem;
}

.model-lock-icon {
    color: var(--text-dim);
    font-size: 0.78rem;
    opacity: 0.4;
}

/* MESSAGE MODEL BADGE TAG */
.message-model-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ------------------------------------------------------------------- */
/* RECENT CONVERSATIONS DROPDOWN MENU */
/* ------------------------------------------------------------------- */
.history-select-wrapper {
    position: relative;
    display: inline-block;
}

.history-pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.history-pill-btn:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.history-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 440px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-color);
    z-index: 1000;
    padding: 0 0 6px 0;
    font-family: var(--font-main);
    backdrop-filter: blur(20px);
}

.history-dropdown-menu.hidden {
    display: none;
}

.history-dropdown-menu .dropdown-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #38bdf8;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px 14px 0 0;
}

.new-chat-sm-btn {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.new-chat-sm-btn:hover {
    opacity: 0.9;
    transform: scale(1.03);
}

.history-list {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.history-item.active {
    background: rgba(56, 189, 248, 0.1);
    border-left-color: #38bdf8;
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.history-item-icon {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.history-item.active .history-item-icon {
    color: #38bdf8;
}

.history-item-title {
    font-size: 0.85rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.history-item-del-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.history-item:hover .history-item-del-btn {
    opacity: 1;
}

.history-item-del-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.sidebar-collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.sidebar-collapsible-header .toggle-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.sidebar-collapsible-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.cursor-pointer {
    cursor: pointer;
}

/* AI TOOL EXECUTION PROGRESS BADGES */
.tool-progress-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.tool-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    font-size: 0.82rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
    animation: pulsePill 2s infinite ease-in-out;
}

.tool-progress-pill.completed {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
    animation: none;
}

@keyframes pulsePill {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.99); }
}

/* ========================================================= */
/* GEMINI-STYLE MARKDOWN RENDERING (TYPOGRAPHY & LISTS)      */
/* ========================================================= */

.msg-content-box p {
    margin-bottom: 16px;
}

.msg-content-box h1, 
.msg-content-box h2, 
.msg-content-box h3, 
.msg-content-box h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 500;
    color: #f8fafc;
}

.msg-content-box h3 {
    font-size: 1.3rem;
}

/* Gemini Timeline Style Ordered Lists & Unordered Lists */
.msg-content-box ol,
.msg-content ol {
    list-style: none;
    counter-reset: gemini-step;
    padding-left: 0;
    margin: 16px 0;
    position: relative;
}

.msg-content-box ol::before,
.msg-content ol::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 13px;
    width: 2px;
    background: repeating-linear-gradient(
      to bottom,
      var(--border-highlight) 0,
      var(--border-highlight) 4px,
      transparent 4px,
      transparent 8px
    );
    z-index: 0;
}

.msg-content-box ol > li,
.msg-content ol > li {
    position: relative;
    padding-left: 42px;
    margin-bottom: 16px;
    min-height: 28px;
    z-index: 1;
    line-height: 1.6;
    list-style: none;
}

.msg-content-box ol > li::before,
.msg-content ol > li::before {
    content: counter(gemini-step);
    counter-increment: gemini-step;
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 2;
}

.msg-content-box ul,
.msg-content ul {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}

.msg-content-box ul > li,
.msg-content ul > li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 8px;
    line-height: 1.6;
    list-style: none;
}

.msg-content-box ul > li::before,
.msg-content ul > li::before {
    content: "•";
    position: absolute;
    left: 4px;
    top: 0;
    color: var(--primary);
    font-size: 1.2rem;
    line-height: 1.4;
}

.msg-content-box p,
.msg-content p {
    margin-bottom: 12px;
    line-height: 1.65;
}

.msg-content-box h1, .msg-content-box h2, .msg-content-box h3,
.msg-content h1, .msg-content h2, .msg-content h3 {
    margin: 18px 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Custom Code Block Wrapper (Gemini Dark Theme) */
.code-block-wrapper {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    margin: 20px 0;
    overflow: hidden;
}

.code-block-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.code-lang {
    font-size: 0.8rem;
    text-transform: capitalize;
    color: #94a3b8;
    font-weight: 500;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
    padding: 4px;
}

.code-copy-btn:hover {
    color: #f8fafc;
}

.code-block-wrapper pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Inline code */
.msg-content-box :not(pre) > code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Fira Code', monospace;
    color: #e2e8f0;
}

/* PROFILE DROPDOWN MENU */
.profile-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 20px;
    width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-color);
    z-index: 1000;
    padding: 8px 0;
    font-family: var(--font-main);
    backdrop-filter: blur(20px);
}

.profile-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.profile-dropdown-menu .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.profile-dropdown-menu .dropdown-item .item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-dropdown-menu .dropdown-item i {
    color: var(--text-muted);
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.profile-dropdown-menu .has-submenu {
    position: relative;
}

.profile-dropdown-menu .submenu {
    position: absolute;
    left: 100%;
    bottom: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
}

.settings-sidebar .tab-btn {
    text-align: left;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.settings-sidebar .tab-btn.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.settings-sidebar .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

/* Empty State Centering */
.chat-main.is-empty .messages-container {
    flex: 0;
    margin-top: 40px;
    overflow-y: visible;
}

.chat-main.is-empty .input-container {
    margin-bottom: 0;
}

/* Markdown Table Styling */
.msg-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.msg-content th,
.msg-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.msg-content th {
    font-weight: 600;
    color: var(--text-main);
}

.msg-content tbody tr:last-child td {
    border-bottom: none;
}

/* MESSAGE ACTION BUTTONS (TTS & COPY) */
.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 6px;
}

.msg-action-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.msg-action-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* PLUGINS STORE MODAL (ChatGPT Plugins Style) */
.plugins-modal-card {
    max-width: 880px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.plugins-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-color);
}

.plugins-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.plugins-modal-header .subtitle {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.plugins-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 14px;
    width: 220px;
}

.plugins-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.85rem;
    width: 100%;
}

.plugins-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.plugins-section .section-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.installed-plugins-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.installed-plugin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.installed-plugin-badge:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.plugins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
}

.plugin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.plugin-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.plugin-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    overflow: hidden;
}

.plugin-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.plugin-card-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.plugin-card-info p {
    margin: 3px 0 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px;
}

.plugin-install-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.plugin-install-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.plugin-install-btn.installed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
}