/* Chat Widget Styles - Modern Professional Design */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.contact {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1001;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.contact:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.contact::before {
    content: '💬';
    font-size: 32px;
    pointer-events: none;
}

.chat-container {
    display: none;
    flex-direction: column;
    width: 420px;
    height: 550px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    z-index: 1002;
    visibility: visible;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f1f5f9;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 20px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.5;
    position: relative;
    animation: fadeInUp 0.3s ease-out;
}

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

.message > div:not(.nickname):not(.timestamp),
.message > p {
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.message .nickname {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
    letter-spacing: 0.3px;
}

.message .timestamp {
    font-size: 10px;
    opacity: 0.7;
    font-weight: 500;
    margin-left: auto;
    line-height: 1.2;
    margin-top: 4px;
}

/* Customer Messages - Right aligned, Blue gradient */
.human-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    text-align: right;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.human-message .nickname {
    color: rgba(255, 255, 255, 0.95);
}

.human-message .timestamp {
    color: rgba(255, 255, 255, 0.8);
}

/* Agent Messages - Left aligned, White with subtle border */
.agent-message {
    background: #ffffff;
    color: #2d3748;
    margin-right: auto;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.agent-message .nickname {
    color: #667eea;
}

.agent-message .timestamp {
    color: #718096;
}

/* Bot Messages - Centered, Green theme */
.bot-message {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    max-width: 85%;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.bot-message .nickname {
    color: rgba(255, 255, 255, 0.95);
    justify-content: flex-start;
}

.bot-message .timestamp {
    color: rgba(255, 255, 255, 0.8);
}

/* System Messages - Centered, Amber theme */
.system-message {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    margin: 8px auto;
    text-align: left;
    font-size: 12px;
    padding: 10px 16px;
    max-width: 85%;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(246, 173, 85, 0.3);
    font-weight: 500;
}

.system-message .timestamp {
    color: rgba(255, 255, 255, 0.8);
}

.message-attachment {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    line-height: 1.4;
    display: inline-block;
}

.message-attachment a {
    color: inherit;
    text-decoration: none;
0    font-weight: 500;
}

.message-attachment a:hover {
    text-decoration: underline;
}

.quick-reply-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.quick-reply-button {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.quick-reply-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(4px);
}

.chat-input-area {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.file-info {
    font-size: 13px;
    color: #667eea;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-weight: 500;
}

.file-upload-progress {
    margin-top: 10px;
    display: none;
}

.file-upload-progress.active {
    display: block;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    font-size: 12px;
    color: #718096;
    margin-top: 6px;
    font-weight: 500;
}

.input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#messageInput {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 15px;
    resize: none;
    font-family: inherit;
    min-height: 48px;
    max-height: 120px;
    transition: all 0.2s;
    background: #f7fafc;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-buttons {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.file-button, .send-button {
    padding: 14px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-button {
    background: #f7fafc;
    color: #667eea;
    border: 2px solid #e2e8f0;
}

.file-button:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: scale(1.05);
}

.send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    box-shadow: none;
}

#fileInput {
    display: none;
}

.typing-indicator-area {
    padding: 12px 20px;
    min-height: 32px;
}

#typingIndicator {
    font-size: 13px;
    color: #718096;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f7fafc;
    border-radius: 16px;
    width: fit-content;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#typingIndicator::before {
    content: '●';
    animation: typingDot 1.4s infinite;
    font-size: 8px;
}

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

@media (max-width: 480px) {
    .chat-container {
        width: 100%;
        height: 70%;
        border-radius: 16px 16px 0 0;
        position: fixed;
        top: auto;
        left: 0;
        bottom: 0;
        right: 0;
    }

    .chat-widget {
        bottom: 12px;
        right: 12px;
    }

    .contact {
        width: 56px;
        height: 56px;
    }
}
