/* Chat Modal Component */
.chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-modal.is-open {
    display: flex;
}

.chat-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.chat-modal__container {
    position: relative;
    width: 90%;
    max-width: 600px;
    height: 70vh;
    max-height: 700px;
    background: var(--bg-primary, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-modal__header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary, #f5f5f5);
}

.chat-modal__header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.chat-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary, #666);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.chat-modal__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    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__bubble {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    word-wrap: break-word;
}

.chat-message--user .chat-message__bubble {
    background: var(--accent-color, #007bff);
    color: white;
}

.chat-message--assistant .chat-message__bubble {
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-primary, #333);
}

.chat-message__typing {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.chat-message__typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary, #999);
    animation: typing 1.4s infinite;
}

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

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

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

.chat-modal__input {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    gap: 0.75rem;
    background: var(--bg-primary, #ffffff);
}

.chat-modal__input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-modal__input input:focus {
    border-color: var(--accent-color, #007bff);
}

.chat-modal__input button {
    padding: 0.75rem 1.5rem;
    background: var(--accent-color, #007bff);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-modal__input button:hover {
    background: var(--accent-color-hover, #0056b3);
}

.chat-modal__input button:disabled {
    background: var(--bg-disabled, #ccc);
    cursor: not-allowed;
}

.chat-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color, #007bff);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 9998;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .chat-modal__container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .chat-fab {
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
    }
}
