/* Chat Icon Styles */
.chat-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #d4757a 0%, #c05f64 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 117, 122, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
    animation: pulse 2s infinite;
}

.chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(212, 117, 122, 0.6);
}

.chat-icon i {
    font-size: 28px;
    color: white;
}

.chat-icon .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background-color: #ff4444;
    border-radius: 50%;
    border: 2px solid white;
    display: none;
}

.chat-icon .notification-dot.active {
    display: block;
    animation: blink 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(212, 117, 122, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(212, 117, 122, 0.6);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Chat Window Styles */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #d4757a 0%, #c05f64 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-delete-btn,
.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 5px;
}

.chat-delete-btn:hover,
.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-close-btn:hover {
    transform: rotate(90deg);
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #d4757a;
    border-radius: 10px;
}

/* Welcome Message */
.welcome-message {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.welcome-message h4 {
    margin: 0 0 8px 0;
    color: #d4757a;
    font-size: 14px;
}

.welcome-message p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.reply-time {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}

.reply-time i {
    font-size: 12px;
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    max-width: 70%;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.bot .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chat-message.user .message-bubble {
    background: #d4757a;
    color: white;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 5px;
}

/* File Message Styles */
.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 15px;
    background: white;
    border: 1px solid #ddd;
    margin-top: 5px;
}

.chat-message.user .message-file {
    background: rgba(212, 117, 122, 0.1);
    border-color: rgba(212, 117, 122, 0.3);
}

.file-icon {
    font-size: 24px;
    color: #d4757a;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: #999;
}

.file-download {
    background: #d4757a;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.file-download:hover {
    background: #c05f64;
}

.message-image {
    max-width: 200px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 5px;
}

/* Quick Reply Buttons */
.quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #d4757a;
    color: #d4757a;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.quick-reply-btn:hover {
    background: #d4757a;
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 15px;
    border-bottom-left-radius: 5px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #d4757a;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Footer */
.chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #d4757a;
}

.chat-input::placeholder {
    color: #aaa;
}

.chat-attach-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
    position: relative;
}

.chat-attach-btn:hover {
    color: #d4757a;
}

.chat-attach-btn input[type="file"] {
    display: none;
}

.chat-send-btn {
    background: #d4757a;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-send-btn:hover {
    background: #c05f64;
    transform: scale(1.05);
}

.chat-send-btn i {
    font-size: 16px;
}

/* File Preview in Input Area */
.file-preview {
    position: absolute;
    bottom: 70px;
    left: 15px;
    right: 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.file-preview.active {
    display: flex;
}

.file-preview-icon {
    font-size: 30px;
    color: #d4757a;
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 11px;
    color: #999;
}

.file-preview-remove {
    background: #ff4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.3s;
}

.file-preview-remove:hover {
    background: #cc0000;
}

.file-preview-image {
    max-width: 80px;
    max-height: 80px;
    border-radius: 5px;
    object-fit: cover;
}

/* SweetAlert Custom Z-Index for Mobile */
.swal2-container {
    z-index: 10000 !important;
}

.swal-on-top {
    z-index: 10000 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100% - 20px);
        height: calc(100% - 120px);
        right: 10px;
        bottom: 90px;
        border-radius: 15px 15px 0 0;
        z-index: 9999;
    }
    
    .chat-icon {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        z-index: 9998;
    }
    
    .chat-icon i {
        font-size: 26px;
    }
    
    /* Ensure SweetAlert appears above chat on mobile */
    .swal2-container {
        z-index: 10000 !important;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 80%;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .chat-body {
        padding: 15px;
    }
    
    .message-image {
        max-width: 150px;
    }
}

.delete-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 18px;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}