/* Floating Chat Button */
.chat-widget-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 60px;
    height: 60px;
    background-color: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2147483647 !important; /* Maximum z-index */
    transition: transform 0.3s ease;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
}

.chat-widget-btn i {
    font-size: 24px;
}

/* Chat Box Container */
.chat-widget-box {
    position: fixed !important;
    bottom: 100px !important;
    right: 30px !important;
    width: 350px;
    height: 500px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483647 !important;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.chat-widget-box.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* Chat Header */
.chat-header {
    background-color: #000;
    color: #fff;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background-color: #000;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.chat-message.admin {
    align-self: flex-start;
    background-color: #e5e5e5;
    color: #000;
    border-bottom-left-radius: 2px;
}

.chat-message img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
}

.chat-timestamp {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    background-color: #fff;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 40px;
    display: block;
}

.chat-input:focus {
    border-color: #000;
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    font-size: 18px;
    padding: 5px;
    transition: color 0.2s;
}

.chat-btn:hover {
    color: #000;
}

.chat-send-btn {
    background-color: #000;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background-color: #333;
}

/* Hidden File Input */
#chat-file-input {
    display: none;
}

/* Admin Recall (Delete) Button */
.chat-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff3b30;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    border: none;
}

.chat-message:hover .chat-delete-btn {
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-widget-box {
        bottom: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        transform: translateY(100%);
    }

    .chat-widget-box.active {
        transform: translateY(0);
    }
    
    .chat-widget-btn {
        bottom: 20px !important;
        right: 20px !important;
    }

    .chat-messages {
        height: calc(100% - 130px); /* Adjust based on header + input height */
    }
}
