/* =========================================================
   Austin Ryu (1/25/2025)
   This CSS styles a floating chat widget, including the chat 
   button, message container, input field, and file upload preview.
   ========================================================= */

   .chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000; /* Ensures the widget stays on top */
}
.chat-image-preview {
    max-width: 200px; /* or 100% of container */
    height: auto;
  }
  
/* =========================================================
   2. Chat Button Styling
   ========================================================= */
#chatButton {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #007bff; /* Blue background */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, background-color 0.3s;
}

#chatButton:hover {
    transform: scale(1.1); /* Slightly enlarge on hover */
    background-color: #0056b3; /* Darker blue on hover */
}

#chatButton svg {
    width: 30px;
    height: 30px;
    fill: #ffffff; /* White icon color */
}

/* =========================================================
   3. Chat Form Styling
   ========================================================= */
#chatForm {
    width: 350px;
    max-height: 500px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none; /* Hidden by default */
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#chatForm.active {
    display: flex; /* Show when active */
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================
   4. Chat Header Styling
   ========================================================= */
#chatHeader {
    background-color: #007bff;
    color: #ffffff;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
    background-color: #ffffff; /* Placeholder background */
}

.title-status {
    display: flex;
    flex-direction: column;
}

.title-status div:first-child {
    font-size: 1.1em;
    font-weight: bold;
}

.online-status {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    margin-top: 3px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #28a745; /* Green dot */
    border-radius: 50%;
    margin-right: 5px;
}

/* Close Chat Button Styling */
#closeChatButton {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2em;
    cursor: pointer;
    transition: color 0.3s;
}

#closeChatButton:hover {
    color: #cccccc;
}

/* =========================================================
   5. Chat Messages Styling
   ========================================================= */
#chatMessages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    word-wrap: break-word;
    padding: 10px 15px;
    border-radius: 20px;
    position: relative;
    clear: both;
}

.message.user {
    background-color: #dcf8c6;
    align-self: flex-end;
    margin-left: auto;
}

.message.system {
    background-color: #e6e6e6;
    align-self: flex-start;
    margin-right: auto;
}

/* Optional: Add Tail Tail Tail Pointers */
.message.user::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: -10px;
    width: 0;
    height: 0;
    border-top: 10px solid #dcf8c6;
    border-left: 10px solid transparent;
}

.message.system::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 0;
    height: 0;
    border-top: 10px solid #e6e6e6;
    border-right: 10px solid transparent;
}

/* =========================================================
   6. Typing Indicator Styling
   ========================================================= */
#typingIndicator {
    padding: 10px 15px;
    font-style: italic;
    color: #555;
    background-color: #f1f1f1;
}

/* =========================================================
   7. Chat Input Container Styling
   ========================================================= */
#chatInputContainer {
    display: flex;
    align-items: center;
    padding: 10;
    width:10%;
    border-top: 1px solid #ccc;
    position: relative;
    background-color: #f1f1f1;
}

#chatInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    font-size: 1em;
    transition: border-color 0.3s;
}

#chatInput:focus {
    border-color: #007bff;
}

#sendMessage {
    margin-left: 10px;
    padding: 10px 20px;
    background-color: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

#sendMessage:disabled {
    background-color: #a0c4ff;
    cursor: not-allowed;
}

#sendMessage:hover:not(:disabled) {
    background-color: #0056b3;
}

/* =========================================================
   8. File Preview Container Styling
   ========================================================= */
#filePreview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #fafafa;
    margin-top: 10px;
}

#filePreview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 5px;
    object-fit: cover;
}

#filePreview .file-info {
    display: flex;
    flex-direction: column;
}

#filePreview .file-info p {
    margin: 0;
    font-size: 0.9em;
    color: #555;
    word-break: break-all;
}

#filePreview .file-info pre {
    margin: 5px 0 0 0;
    font-size: 0.8em;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #f1f1f1;
    padding: 5px;
    border-radius: 5px;
}

/* =========================================================
   9. Drag Overlay Styling
   ========================================================= */
#dragOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 123, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #007bff;
    border-radius: 8px;
    pointer-events: none; /* Allows clicks to pass through */
    opacity: 0;
    transition: opacity 0.3s;
}

#chatInputContainer.dragover #dragOverlay {
    opacity: 1;
}

#dragOverlay p {
    color: #007bff;
    font-size: 1em;
    font-weight: bold;
}

/* =========================================================
   10. File Upload Button Styling
   ========================================================= */
#uploadButton {
  
    padding: 10px 15px;
    background-color: #6c757d; /* Gray background */
    color: #ffffff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

#uploadButton:hover {
    background-color: #5a6268;
}

/* =========================================================
   11. Responsive Design
   ========================================================= */
@media (max-width: 480px) {
    #chatForm {
        width: 90%;
        max-height: 80vh;
    }

    #chatInputContainer {
        flex-direction: column;
        align-items: stretch;
    }

    #sendMessage, #uploadButton {
        width: 50%;
        margin: 10px 0 0 0;
    }

    #filePreview {
        flex-direction: column;
        align-items: flex-start;
    }

    #filePreview img {
        max-width: 50%;
        height: auto;
    }
}
