﻿/* =========================================================
   BeehoodAi Chat - Main Layout
   ========================================================= */

.chat-page {
    width: 100%;
    height: 100vh;
    padding: 16px;
    box-sizing: border-box;
    background: #f4f6fb;
    font-family: "Segoe UI", Arial, sans-serif;
}

/* =========================================================
   Main Container
   ========================================================= */

.chat-container {
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(31, 41, 55, 0.12);
}

/* =========================================================
   LEFT SIDEBAR
   ========================================================= */

.conversation-sidebar {
    width: 260px;
    min-width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid #e8eaf0;
    box-sizing: border-box;
}


/* =========================================================
   Sidebar Header
   ========================================================= */

.sidebar-header {
    height: 76px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
}


.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #202124;
    font-size: 18px;
    font-weight: 700;
}


.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff;
    font-size: 23px;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.25);
}


/* =========================================================
   New Chat
   ========================================================= */

.sidebar-new-chat {
    padding: 0 14px 18px;
    box-sizing: border-box;
}


.new-chat-button {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #dfe3ea;
    border-radius: 12px;
    background: #ffffff;
    color: #30343b;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}


    .new-chat-button:hover {
        background: #f5f6ff;
        border-color: #667eea;
        color: #4f46e5;
    }


.new-chat-icon {
    font-size: 18px;
    line-height: 1;
}


/* =========================================================
   Conversation Section
   ========================================================= */

.conversation-section {
    flex: 1;
    min-height: 0;
    padding: 0 10px;
    overflow: hidden;
    box-sizing: border-box;
}


.conversation-section-title {
    padding: 4px 10px 10px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}


.conversation-loading,
.conversation-empty {
    padding: 12px 10px;
    color: #9ca3af;
    font-size: 13px;
}


/* =========================================================
   Conversation List
   ========================================================= */

.conversation-list {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    box-sizing: border-box;
}


    .conversation-list::-webkit-scrollbar {
        width: 6px;
    }


    .conversation-list::-webkit-scrollbar-track {
        background: transparent;
    }


    .conversation-list::-webkit-scrollbar-thumb {
        background: #d2d6df;
        border-radius: 10px;
    }


        .conversation-list::-webkit-scrollbar-thumb:hover {
            background: #b9bec9;
        }


/* =========================================================
   Conversation Item
   ========================================================= */

.conversation-item {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    display: block;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #202124;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    outline: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}


    .conversation-item:hover {
        background: #f5f6fa;
    }


    .conversation-item.selected-conversation {
        background: #eef0ff;
        border-color: #d9ddff;
    }


    .conversation-item:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }


/* =========================================================
   Conversation Content
   ========================================================= */

.conversation-item-content {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}


.conversation-item-title {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #202124;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}


.conversation-item-date {
    color: #9ca3af;
    font-size: 10px;
    line-height: 1.3;
}


/* =========================================================
   Sidebar Footer
   ========================================================= */

.sidebar-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid #eeeeee;
    color: #9ca3af;
    font-size: 12px;
}


/* =========================================================
   MAIN CHAT AREA
   ========================================================= */

.chat-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}


/* =========================================================
   Chat Header
   ========================================================= */

.chat-header {
    height: 76px;
    min-height: 76px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 28px;
    border-bottom: 1px solid #eeeeee;
    background: #ffffff;
    box-sizing: border-box;
}


.gemini-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff;
    font-size: 25px;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.25);
}


.chat-header-info {
    margin-left: 13px;
}


.chat-title {
    margin: 0;
    color: #202124;
    font-size: 18px;
    font-weight: 700;
}


.chat-status {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 12px;
}


.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}


/* =========================================================
   Chat Body
   ========================================================= */

.chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 30px 40px;
    background: #fafbff;
    box-sizing: border-box;
    scroll-behavior: smooth;
}


    .chat-body::-webkit-scrollbar {
        width: 8px;
    }


    .chat-body::-webkit-scrollbar-track {
        background: transparent;
    }


    .chat-body::-webkit-scrollbar-thumb {
        background: #cfd3dc;
        border-radius: 10px;
    }


/* =========================================================
   Welcome
   ========================================================= */

.welcome-section {
    max-width: 760px;
    margin: 100px auto 0;
    text-align: center;
}


.welcome-icon {
    margin-bottom: 18px;
    color: #667eea;
    font-size: 42px;
}


.welcome-section h2 {
    margin: 0;
    color: #202124;
    font-size: 32px;
    font-weight: 700;
}


.welcome-section p {
    margin: 12px 0 0;
    color: #6b7280;
    font-size: 15px;
}


/* =========================================================
   Suggestions
   ========================================================= */

.suggestions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}


.suggestion-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid #e1e5ec;
    border-radius: 12px;
    background: #ffffff;
    color: #374151;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
}


    .suggestion-button:hover {
        border-color: #667eea;
        background: #f4f5ff;
        color: #4f46e5;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    }


    .suggestion-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
    }


/* =========================================================
   Messages
   ========================================================= */

.message {
    display: flex;
    width: 100%;
    margin-bottom: 18px;
}


.user-message {
    justify-content: flex-end;
}


    .user-message .message-bubble {
        max-width: 75%;
        padding: 13px 17px;
        border-radius: 18px 18px 4px 18px;
        background: #667eea;
        color: #ffffff;
        font-size: 15px;
        line-height: 1.6;
        overflow-wrap: anywhere;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    }


.assistant-message {
    justify-content: flex-start;
}


    .assistant-message .message-bubble {
        max-width: 80%;
        padding: 15px 18px;
        border-radius: 18px 18px 18px 4px;
        background: #ffffff;
        border: 1px solid #e8eaf0;
        color: #30343b;
        font-size: 15px;
        line-height: 1.6;
        overflow-wrap: anywhere;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    }


/* =========================================================
   Loading
   ========================================================= */

.loading {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
}


    .loading > span:first-child {
        margin-right: 6px;
    }


.loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.2s infinite;
}


    .loading-dot:nth-child(2) {
        animation-delay: 0.15s;
    }


    .loading-dot:nth-child(3) {
        animation-delay: 0.3s;
    }


@keyframes typing {

    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}


/* =========================================================
   Input Area
   ========================================================= */

.chat-input-area {
    flex-shrink: 0;
    padding: 16px 24px 18px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
    box-sizing: border-box;
}


.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 7px 6px 16px;
    border: 1px solid #dfe3ea;
    border-radius: 16px;
    background: #fafbfc;
    box-sizing: border-box;
    transition: 0.2s ease;
}


    .chat-input-wrapper:focus-within {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }


.chat-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #202124;
    font-family: inherit;
    font-size: 15px;
}


    .chat-input::placeholder {
        color: #9ca3af;
    }


/* =========================================================
   Send Button
   ========================================================= */

.send-button {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 12px;
    background: #667eea;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s ease;
}


    .send-button:hover {
        background: #5568d9;
        transform: translateY(-1px);
    }


    .send-button:disabled {
        background: #cbd0dc;
        cursor: not-allowed;
        transform: none;
    }


/* =========================================================
   Disclaimer
   ========================================================= */

.chat-disclaimer {
    margin-top: 10px;
    text-align: center;
    color: #9ca3af;
    font-size: 11px;
}


/* =========================================================
   Error
   ========================================================= */

.chat-error {
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    background: #fff1f2;
    color: #dc2626;
    font-size: 14px;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 800px) {

    .chat-page {
        padding: 8px;
    }

    .conversation-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .chat-body {
        padding: 25px;
    }

    .welcome-section {
        margin-top: 70px;
    }
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 650px) {

    .chat-page {
        padding: 0;
    }

    .chat-container {
        border-radius: 0;
        border: none;
    }

    .conversation-sidebar {
        width: 72px;
        min-width: 72px;
    }

    .sidebar-header {
        padding: 0;
        justify-content: center;
    }

    .sidebar-brand {
        justify-content: center;
    }

        .sidebar-brand span {
            display: none;
        }

    .sidebar-brand-icon {
        width: 42px;
        height: 42px;
    }

    .sidebar-new-chat {
        padding: 0 10px 15px;
    }

    .new-chat-button {
        width: 42px;
        margin: 0 auto;
        padding: 0;
    }

        .new-chat-button span:last-child {
            display: none;
        }

    .conversation-section-title,
    .conversation-item-date,
    .sidebar-footer {
        display: none;
    }

    .conversation-section {
        padding: 0 8px;
    }

    .conversation-item {
        padding: 10px;
    }

    .conversation-item-title {
        font-size: 0;
    }

        .conversation-item-title::before {
            content: "•";
            font-size: 18px;
        }

    .chat-header {
        padding: 0 18px;
    }

    .chat-body {
        padding: 20px;
    }

    .welcome-section {
        margin-top: 50px;
    }

        .welcome-section h2 {
            font-size: 26px;
        }

    .suggestions {
        flex-direction: column;
    }

    .suggestion-button {
        width: 100%;
        justify-content: center;
    }

    .user-message .message-bubble,
    .assistant-message .message-bubble {
        max-width: 90%;
    }

    .chat-input-area {
        padding: 12px;
    }
}



/* =========================================================
   Markdown Response Styling
   ========================================================= */

.message-markdown {
    width: 100%;
    line-height: 1.7;
    color: #30343b;
    font-size: 15px;
    overflow-wrap: anywhere;
}


    /* ---------------------------------------------------------
   Paragraphs
   --------------------------------------------------------- */

    .message-markdown p {
        margin: 0 0 14px;
    }

        .message-markdown p:last-child {
            margin-bottom: 0;
        }


    /* ---------------------------------------------------------
   Headings
   --------------------------------------------------------- */

    .message-markdown h1,
    .message-markdown h2,
    .message-markdown h3,
    .message-markdown h4,
    .message-markdown h5,
    .message-markdown h6 {
        margin-top: 22px;
        margin-bottom: 10px;
        color: #202124;
        font-weight: 700;
        line-height: 1.35;
    }

    .message-markdown h1 {
        font-size: 25px;
    }

    .message-markdown h2 {
        font-size: 21px;
    }

    .message-markdown h3 {
        font-size: 18px;
    }

    .message-markdown h4 {
        font-size: 16px;
    }

    .message-markdown h5,
    .message-markdown h6 {
        font-size: 15px;
    }

    .message-markdown > h1:first-child,
    .message-markdown > h2:first-child,
    .message-markdown > h3:first-child {
        margin-top: 0;
    }


    /* ---------------------------------------------------------
   Bold / Italic
   --------------------------------------------------------- */

    .message-markdown strong {
        font-weight: 700;
        color: #202124;
    }

    .message-markdown em {
        font-style: italic;
    }


    /* ---------------------------------------------------------
   Unordered / Ordered Lists
   --------------------------------------------------------- */

    .message-markdown ul,
    .message-markdown ol {
        margin: 10px 0 16px;
        padding-left: 26px;
    }

    .message-markdown li {
        margin-bottom: 6px;
        padding-left: 3px;
    }

        .message-markdown li:last-child {
            margin-bottom: 0;
        }


    /* ---------------------------------------------------------
   Nested Lists
   --------------------------------------------------------- */

    .message-markdown ul ul,
    .message-markdown ul ol,
    .message-markdown ol ul,
    .message-markdown ol ol {
        margin-top: 6px;
        margin-bottom: 6px;
    }


    /* ---------------------------------------------------------
   Inline Code
   --------------------------------------------------------- */

    .message-markdown code {
        padding: 2px 6px;
        border-radius: 5px;
        background: #f1f3f5;
        color: #c7254e;
        font-family: Consolas, "Courier New", monospace;
        font-size: 13px;
    }


    /* ---------------------------------------------------------
   Code Blocks
   --------------------------------------------------------- */

    .message-markdown pre {
        margin: 16px 0;
        padding: 15px 17px;
        overflow-x: auto;
        border-radius: 10px;
        background: #1e1e1e;
        line-height: 1.55;
    }

        .message-markdown pre code {
            padding: 0;
            background: transparent;
            color: #f8f8f2;
            font-family: Consolas, "Courier New", monospace;
            font-size: 13px;
            white-space: pre;
        }


    /* ---------------------------------------------------------
   Blockquote
   --------------------------------------------------------- */

    .message-markdown blockquote {
        margin: 15px 0;
        padding: 10px 15px;
        border-left: 4px solid #667eea;
        background: #f5f6ff;
        color: #4b5563;
    }

        .message-markdown blockquote p {
            margin-bottom: 0;
        }


    /* ---------------------------------------------------------
   Horizontal Rule
   --------------------------------------------------------- */

    .message-markdown hr {
        margin: 20px 0;
        border: 0;
        border-top: 1px solid #e5e7eb;
    }


    /* ---------------------------------------------------------
   Links
   --------------------------------------------------------- */

    .message-markdown a {
        color: #4f46e5;
        text-decoration: none;
    }

        .message-markdown a:hover {
            text-decoration: underline;
        }


    /* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */

    .message-markdown table {
        width: 100%;
        margin: 16px 0;
        border-collapse: collapse;
        font-size: 14px;
        overflow: hidden;
    }

    .message-markdown th,
    .message-markdown td {
        padding: 9px 12px;
        border: 1px solid #e1e5ec;
        text-align: left;
        vertical-align: top;
    }

    .message-markdown th {
        background: #f4f5f8;
        color: #202124;
        font-weight: 700;
    }

    .message-markdown tr:nth-child(even) {
        background: #fafbfc;
    }


    /* ---------------------------------------------------------
   Images
   --------------------------------------------------------- */

    .message-markdown img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }


    /* ---------------------------------------------------------
   First / Last Element Spacing
   --------------------------------------------------------- */

    .message-markdown > :first-child {
        margin-top: 0;
    }

    .message-markdown > :last-child {
        margin-bottom: 0;
    }


/* ---------------------------------------------------------
   Mobile Markdown
   --------------------------------------------------------- */

@media (max-width: 700px) {

    .message-markdown {
        font-size: 14px;
    }

        .message-markdown h1 {
            font-size: 22px;
        }

        .message-markdown h2 {
            font-size: 19px;
        }

        .message-markdown h3 {
            font-size: 17px;
        }

        .message-markdown pre {
            padding: 12px;
            font-size: 12px;
        }

        .message-markdown table {
            display: block;
            overflow-x: auto;
            white-space: nowrap;
        }
}
