/* MUFG Online Customer Service Chat Styles */

/* Chat Button (Floating) */
.chat-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dc143c 0%, #b91c3c 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.6);
}

.chat-button.active {
    background: linear-gradient(135deg, #b91c3c 0%, #dc143c 100%);
}

.chat-button i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #dc143c 0%, #b91c3c 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #dc143c;
    border-radius: 3px;
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #dc143c 0%, #b91c3c 100%);
    color: white;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message-content p {
    margin: 0;
    padding: 12px 15px;
    border-radius: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.bot-message .message-content p {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    align-items: flex-end;
}

.user-message .message-content p {
    background: linear-gradient(135deg, #dc143c 0%, #b91c3c 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    padding: 0 5px;
}

/* Chat Input Container */
.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: inherit;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input:focus {
    border-color: #dc143c;
}

.chat-input::-webkit-scrollbar {
    width: 4px;
}

.chat-input::-webkit-scrollbar-thumb {
    background: #dc143c;
    border-radius: 2px;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dc143c 0%, #b91c3c 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* Typing Indicator */
.chat-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    align-items: center;
}

.chat-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc143c;
    animation: typing 1.4s infinite;
}

.chat-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
    }
    
    .chat-button {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

/* Accessibility */
.chat-button:focus,
.chat-close-btn:focus,
.chat-send-btn:focus {
    outline: 2px solid #dc143c;
    outline-offset: 2px;
}

/* Loading State */
.chat-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #dc143c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.chat-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 10px;
    margin: 10px 20px;
    font-size: 14px;
    text-align: center;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.chat-welcome i {
    font-size: 48px;
    color: #dc143c;
    margin-bottom: 10px;
}

/* Badge for unread messages */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}
