:root {
    --primary-color: #0084FF;
    /* Messenger Blue-ish */
    --primary-gradient: linear-gradient(135deg, #0084FF 0%, #00C6FF 100%);
    --bg-color: #f0f2f5;
    --chat-bg: #ffffff;
    --text-primary: #050505;
    --text-secondary: #65676B;
    --bot-msg-bg: #E4E6EB;
    --user-msg-bg: #0084FF;
    --user-msg-text: #ffffff;
    --input-bg: #F0F2F5;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: 480px;
    /* Mobile-first constraint */
    height: 100vh;
    /* Full height on mobile */
    max-height: 900px;
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

@media (min-width: 480px) {
    .chat-container {
        height: 90vh;
        /* Floating card on desktop */
        border-radius: 16px;
    }
}

/* HEADER */
.chat-header {
    padding: 16px;
    background: #ffffff;
    border-bottom: 1px solid #E4E6EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    position: relative;
    width: 45px;
    height: 45px;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #31A24C;
    border: 2px solid #fff;
    border-radius: 50%;
}

.header-info h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-actions button:hover {
    background-color: #f0f2f5;
}

/* MESSAGES */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #fff;
    scroll-behavior: smooth;
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.bot-id {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    margin-left: 4px;
}

.bot-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.bot-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}


.message.bot .message-content {
    background-color: var(--bot-msg-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message.user .message-content {
    background: var(--primary-gradient);
    color: var(--user-msg-text);
    border-bottom-right-radius: 4px;
}

.message-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.message-time {
    font-size: 11px;
    color: #B0B3B8;
    margin-left: 4px;
}

.message.user .message-time {
    margin-right: 4px;
}

/* Translate Button */
.translate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid #B0B3B8;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 11px;
    color: #65676B;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.translate-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.translate-btn:hover svg {
    stroke: white;
}

.translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.translate-btn svg {
    stroke: #65676B;
    flex-shrink: 0;
}

/* Responsive adjustments for translate button */
@media (max-width: 360px) {
    .message-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .translate-btn {
        padding: 4px 12px;
        font-size: 12px;
    }
}

/* INPUT AREA */
.chat-input-area {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #E4E6EB;
}

.suggestion-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-width: none;
    /* Hide scrollbar */
}

.suggestion-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.chip:hover {
    background-color: var(--primary-color);
    color: white;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--input-bg);
    padding: 8px 16px;
    border-radius: 24px;
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    outline: none;
    padding: 8px 0;
    color: var(--text-primary);
}

.input-wrapper button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.input-wrapper button:hover {
    transform: scale(1.1);
}

.typing-indicator {
    padding: 12px 16px;
    background-color: var(--bot-msg-bg);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 12px;
    display: none;
    /* Hidden by default */
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: #90949C;
    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);
    }
}