/* Chat Widget Styles */
:root {
    --primary-cyan: #00E5CC;
    --primary-teal: #00BFA5;
    --dark-teal: #00695C;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --border-color: #e9ecef;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Chat Widget Button */
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-teal) 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 229, 204, 0.4);
}

.chat-widget-btn:active {
    transform: scale(0.95);
}

.chat-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--dark-teal) 0%, #00524D 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-status {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, rgba(232, 245, 243, 0.3) 0%, rgba(240, 249, 247, 0.3) 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #cbd5e0;
}

/* Chat Message */
.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: white;
    padding: 4px;
    border: 2px solid var(--border-color);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    max-width: 75%;
}

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.bot-message .message-bubble {
    background: white;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-teal) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.user-message .message-time {
    text-align: right;
}

/* Quick Replies */
.quick-replies {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-reply-btn {
    background: linear-gradient(135deg, rgba(0, 229, 204, 0.1) 0%, rgba(0, 191, 165, 0.1) 100%);
    border: 1px solid var(--primary-cyan);
    color: var(--dark-teal);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-teal) 100%);
    color: white;
    transform: translateY(-2px);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 10px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.typing-dots {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 12px 16px;
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-teal);
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Agent Handoff Notice */
.agent-handoff-notice {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
    border: 1px solid #3b82f6;
    border-radius: 12px;
    padding: 16px;
    margin: 0 20px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.handoff-icon {
    font-size: 32px;
}

.handoff-text strong {
    color: #1e40af;
    display: block;
    margin-bottom: 4px;
}

.handoff-text p {
    margin: 0;
    font-size: 13px;
    color: var(--text-light);
}

/* Chat Input */
.chat-input-container {
    border-top: 1px solid var(--border-color);
    background: white;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.chat-form {
    padding: 16px;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 12px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-cyan);
}

.attach-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex-shrink: 0;
}

.attach-btn:hover {
    color: var(--primary-teal);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px;
    font-family: inherit;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input::-webkit-scrollbar {
    width: 4px;
}

.chat-input::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.send-btn {
    background: linear-gradient(135deg, var(--primary-cyan) 0%, var(--primary-teal) 100%);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.1);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-footer {
    padding: 0 16px 12px;
    text-align: center;
}

.chat-footer small {
    color: var(--text-light);
    font-size: 11px;
}

/* File Upload Preview */
.file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-preview-icon {
    color: var(--primary-teal);
}

.file-preview-info {
    flex: 1;
    font-size: 13px;
}

.file-preview-name {
    font-weight: 600;
    color: var(--text-dark);
}

.file-preview-size {
    color: var(--text-light);
    font-size: 11px;
}

.file-preview-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
}

.file-preview-remove:hover {
    color: #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-widget {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-widget-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .message-content {
        max-width: 80%;
    }
}

/* Minimized State */
.chat-widget.minimized {
    height: 60px;
    overflow: hidden;
}

.chat-widget.minimized .chat-messages,
.chat-widget.minimized .typing-indicator,
.chat-widget.minimized .agent-handoff-notice,
.chat-widget.minimized .chat-input-container {
    display: none;
}
