@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Noto+Sans+TC:wght@400;700&display=swap');

:root {
    --primary-color: #6a5af9;
    --primary-hover: #5a49e9;
    --visitor-bubble-bg: var(--primary-color);
    --visitor-bubble-text: #ffffff;
    --bot-bubble-bg: #f1f2f6;
    --bot-bubble-text: #2c3e50;
    --header-bg: #ffffff;
    --text-color: #2c3e50;
    --text-light: #576574;
    --border-color: #e0e0e0;
    --font-family-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --background-blur: 5px;
    --bg-opacity: 0.4;
}

body {
    font-family: var(--font-family-sans);
    background-color: transparent;
    margin: 0;
    font-size: 16px;
    transition: font-size 0.2s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.font-small {
    font-size: 14px;
}
body.font-medium {
    font-size: 16px;
}
body.font-large {
    font-size: 18px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, var(--bg-opacity));
    backdrop-filter: blur(var(--background-blur));
    -webkit-backdrop-filter: blur(var(--background-blur));
    z-index: -1;
    transition: all 0.3s ease-out;
}

.language-selection-page {
    display: flex;
    flex-grow: 1;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}
.language-selection-page.hidden {
    display: none;
}

.lang-selector-container {
    padding: 20px;
    border-radius: 8px;
    background-color: var(--header-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 90%;
}

.lang-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lang-button {
    flex: 1 1 calc(50% - 10px);
    max-width: 200px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    color: var(--text-color);
    transition: background-color 0.2s, color 0.2s;
}
@media (max-width: 380px) {
    .lang-button {
        flex: 1 1 100%;
    }
}
.lang-button:hover {
    background-color: var(--primary-color);
    color: white;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-logo {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.header-title {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-color);
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-controls {
    display: flex;
    align-items: center;
}

.font-button, .close-button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    margin-left: 5px;
    width: 30px;
    height: 30px;
    font-size: 1em;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.font-button:hover, .close-button:hover {
    background-color: #f1f2f6;
}

.close-button {
    font-size: 1.2em;
    line-height: 1;
}

.chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.chat-box.hidden {
    display: none;
}


.message {
    display: flex;
    max-width: 85%;
}

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

.bubble {
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}
.bubble strong {
    font-weight: 700;
}


.bot-message {
    align-self: flex-start;
}
.bot-message .bubble {
    background-color: var(--bot-bubble-bg);
    color: var(--bot-bubble-text);
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
}
.user-message .bubble {
    background-color: var(--visitor-bubble-bg);
    color: var(--visitor-bubble-text);
    border-bottom-right-radius: 4px;
}

.input-area {
    display: flex;
    align-items: center; /* Center items vertically */
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: #f8f9fa;
    flex-shrink: 0;
}
.input-area.hidden {
    display: none;
}

#message-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 1em;
    margin-right: 10px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 90, 249, 0.15);
}

/* --- START: NEW STYLES FOR ICON BUTTON --- */
#send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: var(--primary-color);
    border: none;
    color: white;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

#send-button svg {
    margin-left: 2px; /* Small visual adjustment */
}
/* --- END: NEW STYLES FOR ICON BUTTON --- */

#send-button:hover {
    background-color: var(--primary-hover);
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 5px 0;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: #a4b0be;
    border-radius: 50%;
    display: inline-block;
    animation: bounceTyping 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounceTyping { 
    0%, 80%, 100% { transform: scale(0); } 
    40% { transform: scale(1.0); } 
}

.hidden {
    display: none !important;
}

.chat-footer {
    flex-shrink: 0;
    padding: 5px 15px;
    text-align: center;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
}
.chat-footer.hidden {
    display: none;
}

.chat-footer p {
    font-size: 11px;
    color: var(--text-light);
    margin: 0;
}