﻿.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* messages should scroll */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0;
}

.message {
    padding: 0.6rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    width: fit-content;
    max-width: 70%;
    white-space: pre-wrap;
}

    .message.user {
        background-color: #0078ff;
        color: white;
        align-self: flex-end;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    .message.bot {
        background-color: #e5e5ea;
        color: black;
        align-self: flex-start;
        max-width: 70%;
    }

    .message.typing {
        font-style: italic;
        opacity: 0.7;
    }

/* input at bottom of container - never fixed */
.input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #ddd;
    background-color: #fff;
    box-sizing: border-box;
    flex-shrink: 0;
}

    .input-area textarea {
        flex: 1;
        padding: 0.5rem;
        border-radius: 0.5rem;
        border: 1px solid #ccc;
        resize: none;
        overflow-y: hidden;
        min-height: 40px;
        font-family: inherit;
        font-size: inherit;
        line-height: 1.5;
    }

        .input-area textarea:disabled {
            background-color: #f5f5f5;
            cursor: not-allowed;
        }

        /* Custom scrollbar for textarea */
        .input-area textarea::-webkit-scrollbar {
            width: 8px;
        }

        .input-area textarea::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }

        .input-area textarea::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 4px;
        }

            .input-area textarea::-webkit-scrollbar-thumb:hover {
                background: #555;
            }

/* File input - hidden */
.file-input-hidden {
    display: none;
}

/* File input label - paperclip icon */
.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #fff;
    color: #666;
    flex-shrink: 0;
}

    .file-input-label:hover {
        border-color: #007bff;
        background-color: #f8f9fa;
        color: #007bff;
    }

    .file-input-label:active {
        background-color: #e9ecef;
    }

.input-area button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: #1b6ec2;
    color: white;
    cursor: pointer;
    white-space: nowrap;
    align-self: flex-end;
}

    .input-area button:hover:not(:disabled) {
        background-color: #1861ac;
    }

    .input-area button:disabled {
        background-color: #ccc;
        cursor: not-allowed;
    }

/* Image attached indicator */
.image-attached-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 10px;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 0.5rem;
    font-size: 11px;
    color: #0c5460;
    position: relative;
    line-height: 1.2;
    flex-shrink: 0;
    align-self: flex-end;
}

    .image-attached-indicator span {
        display: block;
        text-align: center;
    }

.clear-attachment-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    border: 2px solid white;
    cursor: pointer;
    font-size: 12px;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

    .clear-attachment-btn:hover {
        background: #c82333;
    }

/* Message image thumbnail */
.message-image-thumbnail {
    margin-top: 8px;
    cursor: pointer;
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 400px;
    max-height: 500px;
    width: fit-content;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: block;
}

    .message-image-thumbnail:hover {
        border-color: rgba(255, 255, 255, 0.8);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .message-image-thumbnail img {
        width: 100%;
        height: 100%;
        max-height: 500px;
        object-fit: contain;
        display: block;
    }

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

    .image-modal-content img {
        max-width: 100%;
        max-height: 90vh;
        object-fit: contain;
        border-radius: 0.5rem;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }

.image-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

    .image-modal-close:hover {
        background: rgba(255, 255, 255, 0.25);
    }

/* Simple responsive - just adjust message width */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }

    .chat-container {
        padding: 0 10px;
    }

    .message-image-thumbnail {
        max-width: min(300px, 90%);
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 90%;
    }

    .message-image-thumbnail {
        max-width: 95%;
    }
}
