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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #0b141a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
}

/* ===== Chat Container ===== */
#chat-container {
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #0b141a;
    position: relative;
}

/* ===== Header ===== */
#chat-header {
    background: #1f2c34;
    color: #e9edef;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    flex-shrink: 0;
    z-index: 10;
}

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #00a884;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.header-info {
    display: flex;
    flex-direction: column;
}

.header-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.header-status {
    font-size: 12px;
    color: #8696a0;
    line-height: 1.3;
}

.header-actions {
    display: flex;
    gap: 4px;
}

.header-actions button {
    background: none;
    border: none;
    color: #aebac1;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.header-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== Chat Messages Area ===== */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #0b141a;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5c1.5 0 2.5 1 2.5 2.5S31.5 10 30 10s-2.5-1-2.5-2.5S28.5 5 30 5zm-15 15c1.5 0 2.5 1 2.5 2.5S16.5 25 15 25s-2.5-1-2.5-2.5S13.5 20 15 20zm30 0c1.5 0 2.5 1 2.5 2.5S46.5 25 45 25s-2.5-1-2.5-2.5S43.5 20 45 20zm-15 15c1.5 0 2.5 1 2.5 2.5S31.5 40 30 40s-2.5-1-2.5-2.5S28.5 35 30 35z' fill='%23111b21' fill-opacity='0.4'/%3E%3C/svg%3E");
}

/* ===== Message Bubbles ===== */
.message {
    max-width: 85%;
    padding: 6px 8px 8px;
    border-radius: 8px;
    position: relative;
    line-height: 1.4;
    font-size: 14.5px;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease;
}

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

.message-bot {
    background: #1f2c34;
    color: #e9edef;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.message-user {
    background: #005c4b;
    color: #e9edef;
    align-self: flex-end;
    border-top-right-radius: 0;
}

.message-time {
    font-size: 11px;
    color: rgba(233, 237, 239, 0.45);
    text-align: right;
    margin-top: 2px;
}

.message-user .message-time {
    color: rgba(233, 237, 239, 0.5);
}

.message-text {
    white-space: pre-wrap;
}

.message-text a {
    color: #53bdeb;
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.message-text strong {
    font-weight: 600;
}

/* ===== Promo Image ===== */
.message-image {
    max-width: 100%;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
    align-self: flex-start;
    background: #1f2c34;
    padding: 12px 16px;
    border-radius: 8px;
    border-top-left-radius: 0;
    display: flex;
    gap: 4px;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #8696a0;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ===== Quick Reply Buttons ===== */
#quick-replies {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 16px;
    background: #0b141a;
    flex-shrink: 0;
}

#quick-replies:empty {
    display: none;
    padding: 0;
}

.quick-reply-btn {
    background: transparent;
    color: #53bdeb;
    border: 1px solid #2a3942;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
    width: 100%;
}

.quick-reply-btn:hover {
    background: #1a2930;
    border-color: #53bdeb;
}

.quick-reply-btn:active {
    background: #1f3640;
}

/* ===== Input Area ===== */
#chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1f2c34;
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    color: #e9edef;
    font-size: 15px;
    font-family: inherit;
    outline: none;
}

#chat-input::placeholder {
    color: #8696a0;
}

#btn-send {
    background: #00a884;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #0b141a;
    flex-shrink: 0;
    transition: background 0.2s;
}

#btn-send:hover {
    background: #00c49a;
}

/* ===== Date Separator ===== */
.date-separator {
    align-self: center;
    background: #182229;
    color: rgba(233, 237, 239, 0.65);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 8px;
    margin: 8px 0;
}

/* ===== Scrollbar ===== */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #374045;
    border-radius: 3px;
}

/* ===== Desktop ===== */
@media (min-width: 481px) {
    body {
        background: #222e35;
    }

    #chat-container {
        max-height: 100dvh;
        border-left: 1px solid #2a3942;
        border-right: 1px solid #2a3942;
    }
}

/* ===== Small Mobile ===== */
@media (max-width: 360px) {
    .message {
        max-width: 90%;
        font-size: 14px;
    }

    .quick-reply-btn {
        font-size: 13px;
        padding: 8px 12px;
    }
}
