/* Chat Bubble Button */
#chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e40af 0%, #dc2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    z-index: 9998;
}

#chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#chat-bubble svg {
    width: 32px;
    height: 32px;
    color: white;
}

/* Chat Window */
#chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transform: translateY(100%) scale(0.8);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    pointer-events: none;
}

#chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: #dc2626;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.chat-title {
    font-weight: 700;
    font-size: 16px;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-visitor {
    align-self: flex-end;
    align-items: flex-end;
}

.message-admin {
    align-self: flex-start;
    align-items: flex-start;
}

.message-system {
    align-self: center;
    align-items: center;
    max-width: 90%;
}

.message-sender {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    padding: 0 8px;
}

.message-text {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-visitor .message-text {
    background: #1e40af;
    color: white;
}

.message-admin .message-text {
    background: white;
    border: 2px solid #1e40af;
    color: #1e40af;
}

.message-system .message-text {
    background: #f3f4f6;
    color: #666;
    font-size: 13px;
    font-style: italic;
    text-align: center;
}

.message-time {
    font-size: 10px;
    color: #999;
    padding: 0 8px;
}

/* Chat Input */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
}

#chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #1e40af;
}

#chat-send {
    padding: 10px 20px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#chat-send:hover {
    background: #1e3a8a;
}

#chat-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Welcome Prompt */
.welcome-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    height: 100%;
}

.welcome-prompt h3 {
    color: #1e40af;
    font-size: 24px;
    margin-bottom: 12px;
}

.welcome-prompt p {
    color: #666;
    margin-bottom: 24px;
    line-height: 1.5;
}

.welcome-prompt input {
    width: 100%;
    max-width: 280px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.welcome-prompt input:focus {
    border-color: #1e40af;
}

.welcome-prompt button {
    padding: 12px 32px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.welcome-prompt button:hover {
    background: #1e3a8a;
}

/* Responsive */
@media (max-width: 480px) {
    #chat-window {
        width: calc(100% - 40px);
        height: calc(100% - 40px);
        bottom: 20px;
        right: 20px;
    }

    #chat-bubble {
        bottom: 15px;
        right: 15px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
