:root {
    --bg-color: #b2c7d9;
    --chat-bg-color: #b2c7d9;
    --user-bubble-color: #FEE500;
    --ai-bubble-color: #FFFFFF;
    --text-color: #000000;
    --control-bar-height: 80px;
    /* Expandable based on content */
}

body {
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll, handle in chat-container */
}

/* Chat Header (Optional, for realism) */
header {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    /* Darker grey for header text */
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(5px);
    z-index: 10;
}

/* Main Chat Area */
#chat-container {
    flex: 1;
    /* Fills remaining space */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 20px;
    /* Space above controls */
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-start;
    max-width: 80%;
    margin-bottom: 5px;
    animation: fadeIn 0.3s ease;
}

.message.ai {
    align-self: flex-start;
}

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

.profile-pic {
    width: 40px;
    /* Fixed size */
    height: 40px;
    min-width: 40px;
    /* Prevent shrinking */
    background-color: #fff;
    border-radius: 40%;
    /* IOS style rounded square/circle */
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 16px;
    line-height: 1.4;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    position: relative;
    max-width: 100%;
}

.message.ai .message-content {
    background-color: var(--ai-bubble-color);
    color: #000;
    border-top-left-radius: 2px;
}

.message.user .message-content {
    background-color: var(--user-bubble-color);
    color: #000;
    margin-right: 0;
    border-top-right-radius: 2px;
}

.sender-name {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    margin-left: 2px;
}

/* Image in Bubble */
.bubble-image {
    max-width: 200px;
    border-radius: 10px;
    display: block;
    margin-top: 5px;
}

.bubble-image.result {
    max-width: 100%;
    /* Larger for results */
    width: 240px;
}

/* Bottom Control Area (Fixed 2-Story) */
#input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #FFF;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 1st Floor: Presets */
#preset-scroll-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 15px;
    background-color: #F7F7F7;
    /* Light grey background for presets */
    white-space: nowrap;
    scrollbar-width: none;
    border-bottom: 1px solid #ECECEC;
}

#preset-scroll-container::-webkit-scrollbar {
    display: none;
}

.preset-btn {
    flex: 0 0 auto;
    padding: 8px 16px;
    background-color: #FFF;
    border: 1px solid #DDD;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s;
}

.preset-btn:active {
    background-color: #EFEFEF;
    transform: scale(0.98);
}

/* 2nd Floor: Chat Input */
#chat-input-box {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #FFF;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#customPromptInput {
    flex: 1;
    border: none;
    background-color: #F2F2F2;
    padding: 12px 16px;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
}

.send-btn {
    background-color: #FEE500;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
}

/* Adjustment for Chat Container to not be hidden */
#chat-container {
    padding-bottom: 150px;
    /* Make space for the 2-story footer */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loader in bubble */
.bubble-loader {
    display: flex;
    gap: 5px;
    padding: 5px 0;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #aaa;
    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);
    }
}