/* Chat Widget Styles */

:root {
    --chat-primary: #0d9488;
    --chat-primary-dark: #0f766e;
    --chat-primary-light: #14b8a6;
    --chat-accent: #f97316;
    --chat-bg: #ffffff;
    --chat-bg-secondary: #f8fafc;
    --chat-text: #1e293b;
    --chat-text-secondary: #64748b;
    --chat-border: #e2e8f0;
    --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --chat-radius: 16px;
}

/* Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(13, 148, 136, 0.5);
}

.chat-toggle-btn i {
    font-size: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.chat-toggle-btn.active i {
    transform: rotate(90deg);
}

.chat-toggle-btn .chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--chat-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    font-weight: 600;
    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: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 140px);
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-header-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-header-close {
    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-header-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--chat-bg-secondary);
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.user .chat-message-avatar {
    background: var(--chat-text-secondary);
}

.chat-message-content {
    background: var(--chat-bg);
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-message.user .chat-message-content {
    background: var(--chat-primary);
    color: white;
}

.chat-message-text {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message-text strong {
    font-weight: 600;
}

.chat-message-text a {
    color: var(--chat-primary);
    text-decoration: underline;
    word-break: break-all;
}

.chat-message-text a:hover {
    color: var(--chat-primary-dark);
}

.chat-message.user .chat-message-text a {
    color: rgba(255, 255, 255, 0.9);
}

.chat-message.user .chat-message-text a:hover {
    color: white;
}

.chat-message-time {
    font-size: 11px;
    color: var(--chat-text-secondary);
    margin-top: 4px;
}

.chat-message.user .chat-message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.chat-typing {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 4px;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-bg);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--chat-text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: var(--chat-bg);
    border-top: 1px solid var(--chat-border);
}

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

.chat-input {
    flex: 1;
    border: 2px solid var(--chat-border);
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--chat-primary);
}

.chat-input::placeholder {
    color: var(--chat-text-secondary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chat-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--chat-primary-dark);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: var(--chat-border);
    cursor: not-allowed;
}

.chat-send-btn i {
    font-size: 18px;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 20px;
}

.chat-welcome-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chat-primary-light) 0%, var(--chat-primary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
}

.chat-welcome h3 {
    font-size: 18px;
    color: var(--chat-text);
    margin: 0 0 8px;
}

.chat-welcome p {
    font-size: 14px;
    color: var(--chat-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Quick Actions */
.chat-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.chat-quick-btn {
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--chat-text);
    cursor: pointer;
    transition: all 0.2s;
}

.chat-quick-btn:hover {
    border-color: var(--chat-primary);
    color: var(--chat-primary);
    background: rgba(13, 148, 136, 0.05);
}

/* Error Message */
.chat-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    margin: 8px 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .chat-toggle-btn {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .chat-toggle-btn i {
        font-size: 24px;
    }
}

