:root {
    --popi-primary: #FF0043; 
    --popi-primary-dark: #cc0035; 
    --bg-color: #f0f2f5;
    --chat-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
}

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

body, html {
    height: 100dvh; 
    font-family: 'Kalpurush', 'Inter', 'Noto Sans Bengali', 'Arial', sans-serif;
    background-color: var(--bg-color);
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--chat-bg);
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* Header */
.chat-header {
    background-color: var(--popi-primary);
    color: white;
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.header-info { display: flex; align-items: center; gap: 12px; }
.avatar { transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out; width: 40px; height: 40px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; justify-content: center; align-items: center; }
.avatar svg { width: 24px; height: 24px; }
.header-text h1 { font-size: 18px; font-weight: 600; }
.header-text .status { font-size: 12px; opacity: 0.9; display: flex; align-items: center; gap: 5px; }
.header-text .status::before { content: ''; width: 8px; height: 8px; background: #4cd137; border-radius: 50%; display: inline-block; }
.clear-btn { background: none; border: none; color: white; cursor: pointer; opacity: 0.8; transition: 0.3s; }
.clear-btn:hover { opacity: 1; transform: scale(1.1); }

/* Chat Box */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px; 
    background-image: url('data:image/svg+xml,%3Csvg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="%23FF0043" fill-opacity="0.04" fill-rule="evenodd"%3E%3Ccircle cx="3" cy="3" r="3"/%3E%3Ccircle cx="13" cy="13" r="3"/%3E%3C/g%3E%3C/svg%3E');
}

.message-row {
    display: flex;
    align-items: flex-end; 
    gap: 8px;
    width: 100%;
}

.message-row.user {
    flex-direction: row-reverse; 
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
}

.msg-avatar svg {
    width: 18px;
    height: 18px;
}

.avatar-bot {
    background-color: var(--popi-primary);
    color: white;
}

.avatar-user {
    background-color: #6c757d;
    color: white;
}

.message {
    max-width: 75%;
    padding: 10px 14px; 
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5; 
    word-wrap: break-word;
}

.message-bot { 
    background: #f0f2f5; 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
    border-bottom-left-radius: 4px; 
}

.message-user { 
    background: var(--popi-primary); 
    color: white; 
    border-bottom-right-radius: 4px;
}

[data-theme="dark"] .message-bot {
    background: #2a2a2a; 
    border-color: #333333;
}
.message strong { font-weight: 600; color: inherit; }
.message a { color: #0056b3; font-weight: 600; text-decoration: none; }
.message-user a { color: #fff; text-decoration: underline; }

/* Suggestions */
.suggestions-tray {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    overflow-x: auto;
    background: #fafafa;
    border-top: 1px solid var(--border-color);
    scrollbar-width: none;
}
.suggestions-tray::-webkit-scrollbar { display: none; }
.chip {
    background: white; border: 1px solid var(--popi-primary); color: var(--popi-primary);
    padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; white-space: nowrap; transition: 0.2s;
}
.chip:hover { background: var(--popi-primary); color: white; }

.chat-input-area {
    position: relative;
    padding: 15px 20px;
    background: white;
    border-top: 1px solid var(--border-color);
}
.input-wrapper {
    display: flex; 
    align-items: flex-end; 
    gap: 12px; 
    background: var(--bg-color);
    border-radius: 26px; 
    padding: 6px 8px 6px 20px; 
    border: 1px solid var(--popi-primary); 
    animation: colorBorderAnim 5s infinite linear; 
}
.input-wrapper:focus-within { 
    background: white; 
    animation: colorBorderAnimFocus 4s infinite linear; 
}

[data-theme="dark"] .input-wrapper {
    animation: colorBorderAnimDark 6s infinite linear;
}
[data-theme="dark"] .input-wrapper:focus-within {
    background: #1e1e1e;
    animation: colorBorderAnimFocusDark 5s infinite linear;
}

@keyframes colorBorderAnim {
    0% { border-color: rgba(255,0,67,0.7); }
    33% { border-color: rgba(0,123,255,0.7); }
    66% { border-color: rgba(40,167,69,0.7); }
    100% { border-color: rgba(255,0,67,0.7); }
}

@keyframes colorBorderAnimFocus {
    0% { border-color: #FF0043; box-shadow: 0 0 3px rgba(255,0,67,0.15); }
    33% { border-color: #007bff; box-shadow: 0 0 3px rgba(0,123,255,0.15); }
    66% { border-color: #28a745; box-shadow: 0 0 3px rgba(40,167,69,0.15); }
    100% { border-color: #FF0043; box-shadow: 0 0 3px rgba(255,0,67,0.15); }
}

@keyframes colorBorderAnimDark {
    0% { border-color: rgba(255,0,67,0.3); }
    33% { border-color: rgba(0,123,255,0.3); }
    66% { border-color: rgba(40,167,69,0.3); }
    100% { border-color: rgba(255,0,67,0.3); }
}

@keyframes colorBorderAnimFocusDark {
    0% { border-color: rgba(255,0,67,0.6); box-shadow: 0 0 2px rgba(255,0,67,0.1); }
    33% { border-color: rgba(0,123,255,0.6); box-shadow: 0 0 2px rgba(0,123,255,0.1); }
    66% { border-color: rgba(40,167,69,0.6); box-shadow: 0 0 2px rgba(40,167,69,0.1); }
    100% { border-color: rgba(255,0,67,0.6); box-shadow: 0 0 2px rgba(255,0,67,0.1); }
}

textarea {
    flex: 1; 
    border: none; 
    background: transparent; 
    outline: none; 
    font-size: 15px;
    font-family: inherit; 
    resize: none; 
    max-height: 120px; 
    padding: 8px 0; 
    line-height: 1.4; 
    overflow-y: auto;
}

#send-btn {
    background: var(--popi-primary); 
    color: white; 
    border: none; 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    transition: 0.2s; 
    flex-shrink: 0; 
    margin-bottom: 0px; 
}

#send-btn:disabled { background: #cccccc; cursor: not-allowed; }
#send-btn svg { 
    width: 17px; 
    fill: white; 
    margin-left: 2px; 
}
.footer-note { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.typing { display: flex; gap: 5px; padding: 5px 0; }
.dot { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
.chat-input-area {
    padding: 10px 20px; 
    background: white;
    border-top: 1px solid var(--border-color);
}

.auto-suggest-box {
    position: absolute;
    bottom: 100%;
    left: 20px;
    right: 20px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    max-height: 180px;
    overflow-y: auto;
    display: none; 
    z-index: 100;
    flex-direction: column;
}

.suggest-item {
    padding: 12px 15px;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.suggest-item:hover {
    background-color: #fff0f4; 
    color: var(--popi-primary);
    padding-left: 20px;
}

.suggest-item::before {
    content: '🔍';
    font-size: 12px;
    opacity: 0.6;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --chat-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #999999;
    --border-color: #333333;
}


body, .app-container, .chat-input-area, .chat-box, .message, .input-wrapper, textarea {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}
textarea {
    flex: 1; border: none; background: transparent; outline: none; font-size: 15px;
    font-family: inherit; resize: none; max-height: 120px; 
    padding: 6px 0;
    overflow-y: auto;
}

/* ডার্ক মোডে বট মেসেজ এবং ইনপুট এর ব্যাকগ্রাউন্ড ফিক্স */
[data-theme="dark"] .message-bot { background: #2a2a2a; }
[data-theme="dark"] .chat-input-area { background: #1e1e1e; }
[data-theme="dark"] .suggestions-tray { background: #1a1a1a; }
[data-theme="dark"] .input-wrapper { background: #121212; }
[data-theme="dark"] .input-wrapper:focus-within { background: #1e1e1e; }
[data-theme="dark"] .suggest-item:hover {
    background-color: #33141c; 
}

[data-theme="dark"] textarea {
    color: #ffffff; 
}

[data-theme="dark"] textarea::placeholder {
    color: #aaaaaa;
}

.suggestions-tray {
    cursor: grab;
}
.suggestions-tray:active {
    cursor: grabbing; 
}
.suggestions-tray .chip {
    user-select: none; 
}
/* Custom Thin Scrollbar Design */

::-webkit-scrollbar {
    width: 6px; 
    height: 6px; 
}

::-webkit-scrollbar-track {
    background: transparent; 
}

::-webkit-scrollbar-thumb {
    background: rgba(160, 160, 160, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(160, 160, 160, 0.7);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}
/*Scroll Hint Arrow Animation (All Views) */
.scroll-hint-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--popi-primary);
    padding-left: 8px; 
    animation: moveLeft 1.5s infinite alternate; 
    user-select: none;
    flex-shrink: 0;
}

.scroll-hint-icon svg {
    transform: rotate(180deg);
}

[data-theme="dark"] .scroll-hint-icon {
    color: #ffffff;
}

@keyframes moveLeft {
    0% { transform: translateX(0px); opacity: 0.5; }
    100% { transform: translateX(-4px); opacity: 1; }
}

.related-questions-container {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    padding-top: 10px;
}
.related-title {
    font-size: 12px;
    color: var(--text-muted);
    width: 100%;
    margin-bottom: 2px;
    font-weight: 600;
}
.related-chip {
    background: #ffffff;
    border: 1px solid var(--popi-primary);
    color: var(--popi-primary);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.related-chip:hover {
    background: var(--popi-primary);
    color: #ffffff;
}

[data-theme="dark"] .related-questions-container {
    border-top: 1px dashed rgba(255,255,255,0.1);
}
[data-theme="dark"] .related-chip {
    background: #2a2a2a;
}
/* Dark Mode Auto-Suggest Box Fix*/
[data-theme="dark"] .auto-suggest-box {
    background-color: #2b2b2b; 
    border-color: #444444;
}

[data-theme="dark"] .suggest-item {
    color: #e0e0e0;
    border-bottom: 1px solid #3d3d3d;
}

[data-theme="dark"] .suggest-item:hover {
    background-color: #3a3a3a; 
    color: var(--popi-primary);
}
/*Date & Time Stamp Styling  */
.msg-time {
    font-size: 11px;
    font-weight: 400;
    margin-top: 6px;
    display: block;
    text-align: right;
    user-select: none;
}

.time-bot {
    color: var(--text-muted);
}

.time-user {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .time-bot {
    color: #999999;
}
/* Marquee Notice Styling */
.marquee-container {
    width: 100%;
    background-color: #fff0f4; 
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    padding: 3px 0; 
}

.marquee-text {
    display: inline-block;
    padding-left: 100%; 
    animation: marquee-scroll 40s linear infinite; 
    font-size: 12px;
    font-weight: 600;
    color: var(--popi-primary);
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

[data-theme="dark"] .marquee-container {
    background-color: #2a1118;
    border-bottom-color: #333333;
}
[data-theme="dark"] .marquee-text {
    color: #ffffff;
}

/* Mobile View Fixes (Smartphone Only)*/
@media screen and (max-width: 600px) {
    .header-text h1 {
        font-size: 13px !important;
        white-space: nowrap !important; 
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-text .status {
        white-space: nowrap !important;
        font-size: 11px;
    }
    
    .header-info {
        gap: 8px;
    }

}

@keyframes moveLeft {
    0% { transform: translateX(0px); opacity: 0.5; }
    100% { transform: translateX(-4px); opacity: 1; }
}