/* RID COD AI Customer Chat — Storefront Widget */
.rid-cod-ai-chat-widget {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: inherit;
}

.rid-cod-ai-chat-widget--right {
    right: 24px;
}

.rid-cod-ai-chat-widget--left {
    left: 24px;
}

.rid-cod-ai-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--rid-ai-chat-color, #6a3de8);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.rid-cod-ai-chat-toggle:hover {
    transform: scale(1.05);
}

.rid-cod-ai-chat-panel {
    position: absolute;
    bottom: 68px;
    width: 340px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* display:flex above overrides the native [hidden] rule — keep panel closable */
.rid-cod-ai-chat-panel[hidden] {
    display: none !important;
}

.rid-cod-ai-chat-widget--right .rid-cod-ai-chat-panel {
    right: 0;
}

.rid-cod-ai-chat-widget--left .rid-cod-ai-chat-panel {
    left: 0;
}

.rid-cod-ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--rid-ai-chat-color, #6a3de8);
    color: #fff;
    font-weight: 600;
}

.rid-cod-ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.rid-cod-ai-chat-messages {
    height: 320px;
    overflow-y: auto;
    padding: 12px;
    background: #f9fafb;
}

.rid-cod-ai-chat-msg-bubble {
    margin-bottom: 10px;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.rid-cod-ai-chat-msg-bubble--in {
    background: #fff;
    border: 1px solid #e5e7eb;
    margin-right: auto;
    border-bottom-right-radius: 4px;
}

.rid-cod-ai-chat-msg-bubble--out {
    background: var(--rid-ai-chat-color, #6a3de8);
    color: #fff;
    margin-left: auto;
    border-bottom-left-radius: 4px;
}

.rid-cod-ai-chat-msg-bubble--order-success {
    background: #059669;
    border: 1px solid #047857;
}

.rid-cod-ai-chat-product-card {
    margin-top: 6px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
}

.rid-cod-ai-chat-product-card a {
    color: var(--rid-ai-chat-color, #6a3de8);
    text-decoration: none;
    font-weight: 600;
}

.rid-cod-ai-chat-input-wrap {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

.rid-cod-ai-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
}

.rid-cod-ai-chat-send {
    background: var(--rid-ai-chat-color, #6a3de8);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.rid-cod-ai-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rid-cod-ai-chat-typing {
    font-size: 12px;
    color: #6b7280;
    padding: 4px 12px;
}

@media (max-width: 480px) {
    .rid-cod-ai-chat-panel {
        width: calc(100vw - 32px);
    }
}
