/* =====================
   AI Chat Widget Styles
   ===================== */

/* Chat Button */
.chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    z-index: 1000;
    color: var(--bg-white);
}

.chat-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.chat-button.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chat-button svg {
    width: 28px;
    height: 28px;
}

.chat-button-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-color);
    color: var(--bg-white);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--bg-white);
}

/* Chat Container */
.chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: scale(0) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    overflow: hidden;
}

.chat-container.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Expanded state after user interaction */
.chat-container.expanded {
    /* Grow taller but remain within viewport bounds */
    height: clamp(600px, 80vh, 860px);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--bg-white);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-avatar {
    width: 45px;
    height: 45px;
    background: var(--accent-color);
    opacity: 0.2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bg-white);
}

.chat-status {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--bg-white);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.chat-close {
    background: var(--accent-color);
    opacity: 0.2;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--bg-white);
    transition: var(--transition);
}

.chat-close:hover {
    background: var(--accent-color);
    opacity: 0.4;
    transform: rotate(90deg);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-light);
    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: #cbd5e1;
    border-radius: 3px;
}

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

.chat-message {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

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

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .message-content {
    background: var(--bg-white);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.message-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.95rem;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 6px;
    display: block;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

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

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

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

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

.chat-suggestions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.suggestion-chip {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-dark);
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: var(--bg-white);
    border-color: transparent;
    transform: translateY(-2px);
}

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

.chat-input {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    transition: var(--transition);
    max-height: 120px;
    min-height: 44px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.15);
}

.chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    border: none;
    border-radius: 12px;
    color: var(--bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.chat-send:active {
    transform: translateY(0);
}

.chat-disclaimer {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 16px;
        right: 16px;
    }

    .chat-container.expanded {
        /* On small screens, use nearly full height */
        height: calc(100vh - 32px);
    }

    .chat-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

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

    .suggestion-chip {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 968px) {
    .chat-container {
        width: 380px;
        height: 550px;
    }

    .chat-container.expanded {
        height: 75vh;
    }
}
