/* CS AI Chat - widget styles */

.csai-chat-container {
    display: flex;
    flex-direction: column;
    height: var(--csai-height, 600px);
    max-width: 800px;
    margin: 20px auto;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    font-family: -apple-system, "Segoe UI", Tahoma, sans-serif;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.csai-chat-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, #2c5530 0%, #4a7c4e 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.csai-chat-title {
    font-size: 16px;
}

.csai-chat-status {
    font-size: 12px;
    opacity: 0.85;
}

.csai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.csai-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 14px;
}

.csai-message.user {
    align-self: flex-start;
    background: #2c5530;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.csai-message.assistant {
    align-self: flex-end;
    background: #fff;
    color: #222;
    border: 1px solid #e0e3e8;
    border-bottom-left-radius: 4px;
}

.csai-message.system {
    align-self: center;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    font-size: 13px;
    max-width: 95%;
}

.csai-message a {
    color: inherit;
    text-decoration: underline;
}

.csai-message.user a {
    color: #d4f1d7;
}

.csai-message-content {
    /* container for the actual message body */
}

.csai-message-disclaimer {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fef7e6;
    border-right: 3px solid #d4a96a;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #6b5530;
    font-style: normal;
}

.csai-typing {
    align-self: flex-end;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
}

.csai-typing span {
    width: 7px;
    height: 7px;
    background: #888;
    border-radius: 50%;
    animation: csai-bounce 1.2s infinite;
}

.csai-typing span:nth-child(2) { animation-delay: 0.15s; }
.csai-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes csai-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.csai-chat-suggestions {
    padding: 0 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.csai-suggestion-chip {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #c8d2cc;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    color: #2c5530;
    transition: background 0.15s;
}

.csai-suggestion-chip:hover {
    background: #e8f0ea;
}

.csai-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e0e3e8;
}

.csai-chat-input {
    flex: 1;
    resize: none;
    padding: 10px 12px;
    border: 1px solid #c8d2cc;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.csai-chat-input:focus {
    outline: none;
    border-color: #2c5530;
}

.csai-chat-send {
    padding: 0 22px;
    background: #2c5530;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s;
}

.csai-chat-send:hover:not(:disabled) { background: #3a6b3e; }
.csai-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.csai-error {
    padding: 12px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
}

@media (max-width: 600px) {
    .csai-chat-container {
        height: 80vh;
        margin: 10px;
        border-radius: 8px;
    }
    .csai-message { max-width: 92%; }
}
