/* ============================================
   CHAT WIDGET STYLES
   ============================================ */

.chat-widget {
    position: relative;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    padding: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.chat-toggle:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.6);
}

/* Float animation to match other icons */
.chat-toggle {
    animation: floatUpDown 3s ease-in-out infinite;
}

@keyframes floatUpDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-12px);
    }
}

.chat-toggle:hover {
    animation-play-state: paused;
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}

.chat-toggle.active svg {
    transform: rotate(180deg);
}

/* Chat Button Tooltip */
.chat-toggle .tooltip {
    position: absolute;
    right: 70px;
    background: #1e293b;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.chat-toggle:hover .tooltip {
    opacity: 1;
    transform: translateX(0);
}

.chat-toggle .tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 6px solid #1e293b;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Notification badge */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border: 3px solid white;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    transform: translateX(0) scale(0.8) translateY(20px);
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
}

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

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.chat-header-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.chat-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.chat-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

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

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: messageSlide 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot {
    align-self: flex-start;
    background: white;
    color: #334155;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-message-time {
    font-size: 11px;
    margin-top: 5px;
    opacity: 0.7;
    text-align: right;
}

.chat-message.bot .chat-message-time {
    text-align: left;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background: white;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    gap: 4px;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Chat Input */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #6366f1;
}

.chat-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

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

.chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Responsive */
@media (max-width: 480px) {
    /* On mobile, use fixed positioning for full-width chat window */
    .chat-window {
        position: fixed;
        bottom: 85px; /* Below the chat button (button height 55px + gap) */
        left: 10px;
        right: 10px;
        width: auto;
        height: calc(100vh - 140px);
        transform: translateY(20px) scale(0.8);
        transform-origin: bottom center;
        z-index: 10000;
    }

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

    .chat-widget {
        /* Keep the widget in the floating icons flow */
        position: relative;
    }

    .chat-toggle {
        width: 55px;
        height: 55px;
    }

    .chat-toggle svg {
        width: 24px;
        height: 24px;
    }
}

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

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

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

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