/* Chat Widget Variables */
:root {
    --chat-primary: var(--accent-primary, #DC233C);
    --chat-bg: rgba(20, 20, 20, 0.95);
    --chat-text: #ffffff;
    --chat-radius: 1.5rem;
}

.chat-widget-container {
    position: relative;
    z-index: 1000;
    font-family: var(--font-primary, sans-serif);
    display: flex;
    justify-content: flex-end;
}

.chat-toggle-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-window {
    position: absolute;
    bottom: 4.5rem;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: var(--chat-primary);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8f9fa;
}

/* Name Gate */
.chat-name-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    color: #1a1a1a;
    flex: 1;
}

.chat-name-gate p {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.chat-name-gate .chat-input {
    max-width: 220px;
    width: 100%;
    margin-bottom: 0.75rem;
    background-color: #fff !important;
    color: #1a1a1a !important;
    border: 1px solid #dee2e6;
}

.chat-name-gate .chat-send-btn {
    width: 100%;
    max-width: 220px;
    height: auto;
    border-radius: 1.5rem;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message.assistant {
    align-self: flex-start;
    background: white;
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 0.25rem;
}

.chat-input-area {
    padding: 0.75rem;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 1.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    background-color: white !important;
    color: #1a1a1a !important;
}

.chat-input:focus {
    border-color: var(--chat-primary);
}

.chat-send-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Typing Indicator */
.typing-indicator {
    padding: 10px 14px;
    background: #e9ecef;
    border-radius: 1rem;
    display: none;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-bottom: 10px;
    margin-left: 0;
    align-self: flex-start;
}

.typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #6c757d;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Animations */
@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: messageIn 0.3s ease forwards;
}