* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Times New Roman', Times, serif;
}

html,
body {
    height: 100vh;
    width: 100%;
    background-color: rgb(45, 52, 59);
    display: flex;
    flex-direction: column;
}

/* Chat Area */
.chat-container {
    flex: 1;
    width: 100%;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 18px;
    overflow-y: auto;
    margin-bottom: 80px;
    /* space for fixed input */
}

/* Common Chat Row */
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 80%;
}

/* User Messages */
.user-chat-box {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-chat-area {
    padding: 12px 18px;
    background-color: black;
    color: rgba(255, 255, 255, 0.9);
    border-radius: 20px 0px 20px 20px;
    box-shadow: 2px 2px 10px black;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* AI Messages */
.ai-chat-box {
    align-self: flex-start;
}

.ai-chat-area {
    padding: 12px 18px;
    background-color: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 0px 20px 20px 20px;
    box-shadow: 2px 2px 10px black;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Attached image inside a message bubble */
.chooseimg {
    display: block;
    width: 100%;
    max-width: 280px;
    max-height: 280px;
    height: auto;
    border-radius: 15px;
    margin-top: 8px;
    object-fit: cover;
}

/* Avatars */
#userImage {
    flex-shrink: 0;
    filter: drop-shadow(2px 2px 10px black);
    border-radius: 50%;
    height: 65px;
    width: 65px;
    object-fit: cover;
}

#aiImage {
    flex-shrink: 0;
    filter: drop-shadow(2px 2px 10px black);
    border-radius: 50%;
    height: 40px;
    width: 45px;
    object-fit: cover;
}

/* Input Area (Fixed Bottom) */
.prompt-area {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background-color: rgb(45, 52, 59);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.prompt-area input {
    flex: 1;
    min-width: 0;
    height: 55px;
    background-color: black;
    outline: none;
    border: none;
    border-radius: 28px;
    padding: 0 20px;
    color: white;
    font-size: 17px;
    box-shadow: 2px 2px 10px black;
}

/* Buttons */
.prompt-area button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: black;
    border: none;
    box-shadow: 2px 2px 10px black;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-area button:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

/* ---------- Image button preview FIX ---------- */
/* Keep image strictly inside circular button */
#image {
    position: relative;
    overflow: hidden;
    /* clip inside circle */
}

/* Default icon size (when no image chosen) */
#image img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    /* keep SVG/logo nicely */
    border-radius: 50%;
}

/* After choosing a photo, JS adds .choose -> fill the circle and crop */
#image img.choose {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* crop to circle */
    border-radius: 50%;
}

/* ----------------- Responsive ----------------- */
@media (max-width: 768px) {
    .chat-container {
        font-size: 17px;
        padding: 12px;
        gap: 12px;
    }

    .user-chat-area,
    .ai-chat-area {
        font-size: 16px;
        padding: 12px 16px;
    }

    .chat-avatar,
    #userImage,
    #aiImage {
        height: 55px;
        width: 55px;
    }

    .chooseimg {
        max-width: 70vw;
        max-height: 70vw;
    }

    .prompt-area input {
        height: 55px;
        font-size: 16px;
    }

    .prompt-area button {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        font-size: 16px;
    }

    .user-chat-area,
    .ai-chat-area {
        font-size: 15px;
        padding: 10px 14px;
    }


    #userImage {
        height: 50px;
        width: 65px;
    }

    #aiImage {
        height: 40px;
        width: 45px;
    }

    .chooseimg {
        max-width: 80vw;
        max-height: 65vw;
    }

    .prompt-area input {
        height: 50px;
        font-size: 15px;
    }

    .prompt-area button {
        width: 50px;
        height: 50px;
    }
}