/* Chat Widget Styles */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 103;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

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

.chat-header {
    background: linear-gradient(135deg, var(--sati-primary, #71c68a), var(--sati-secondary, #5fb579));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f9fafb;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

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

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

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

.chat-message {
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease-out;
}

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

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

.chat-bubble {
    width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    position: relative;
}

.chat-bubble > div {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.chat-bubble > div ul,
.chat-bubble > div ol {
    margin: 0.25rem 0;
}

.chat-bubble > div li {
    margin-bottom: 0.15rem;
}

.chat-bubble > div strong {
    font-weight: 600;
}

.chat-bubble > div em {
    font-style: italic;
}

.chat-bubble.user {
    background: var(--sati-primary, #71c68a);
    color: white;
    border-bottom-right-radius: 6px;
}

.chat-bubble.support {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
}

.chat-timestamp {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    padding: 0 0.5rem;
}

.chat-message.user .chat-timestamp {
    text-align: right;
    color: color-mix(in srgb, var(--sati-primary, #71c68a) 70%, transparent);
}

.chat-message.support .chat-timestamp {
    text-align: left;
    color: #9ca3af;
}

.chat-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    outline: none;
    resize: none;
    font-size: 0.875rem;
    line-height: 1.25rem;
    max-height: 120px;
    min-height: 40px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-input:focus {
    border-color: var(--sati-primary, #71c68a);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sati-primary, #71c68a) 10%, transparent);
}

.chat-send-button {
    width: 40px;
    height: 40px;
    background: var(--sati-primary, #71c68a);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-button:hover:not(:disabled) {
    background: var(--sati-secondary, #5fb579);
    transform: scale(1.05);
}

.chat-send-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.chat-typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    max-width: 80%;
    margin-bottom: 1rem;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: chatTypingDot 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes chatTypingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Mobile Chat */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 10px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
}
