/**
 * Public chat widget styles
 */

.wca-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Widget Position */
.wca-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.wca-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle Button – golden theme to match site branding */
.wca-chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(
        145deg,
        var(--wca-accent_1, #d4af37) 0%,
        var(--wca-accent_2, #b8960c) 50%,
        var(--wca-accent_3, #9a7b0a) 100%
    );
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(var(--wca-accent_shadow_rgb, 184 150 12) / 0.4);
    transition: all 0.3s ease;
    color: white;
}

.wca-chat-toggle:hover {
    background: linear-gradient(
        145deg,
        var(--wca-accent_hover_1, #e6c04a) 0%,
        var(--wca-accent_hover_2, #c9a227) 50%,
        var(--wca-accent_hover_3, #b8960c) 100%
    );
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(var(--wca-accent_shadow_rgb, 184 150 12) / 0.5);
}

/* Chat Window (hidden until .wca-open) */
.wca-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.wca-chat-widget.wca-open .wca-chat-window {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.wca-position-bottom-left .wca-chat-window {
    left: 0;
}

.wca-position-bottom-right .wca-chat-window {
    right: 0;
}

/* Chat Header */
.wca-chat-header {
    background: linear-gradient(
        145deg,
        var(--wca-accent_1, #d4af37) 0%,
        var(--wca-accent_2, #b8960c) 50%,
        var(--wca-accent_3, #9a7b0a) 100%
    );
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wca-chat-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wca-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wca-chat-clear,
.wca-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.wca-chat-clear svg,
.wca-chat-close svg {
    pointer-events: none;
}

.wca-chat-clear:hover,
.wca-chat-close:hover {
    opacity: 1;
}

/* Messages Container */
.wca-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f5f5;
}

.wca-message {
    display: flex;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

.wca-message-user {
    align-self: flex-end;
    margin-left: auto;
}

.wca-message-bot {
    align-self: flex-start;
}

.wca-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.wca-message-user .wca-message-content {
    background: linear-gradient(
        145deg,
        var(--wca-accent_1, #d4af37) 0%,
        var(--wca-accent_2, #b8960c) 50%,
        var(--wca-accent_3, #9a7b0a) 100%
    );
    color: white;
    border-bottom-right-radius: 4px;
}

.wca-message-bot .wca-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Product Cards */
.wca-product-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wca-product-card img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.wca-product-card h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
}

.wca-product-card .wca-product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--wca-accent_2, #b8960c);
    margin-bottom: 8px;
}

.wca-product-card a {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(
        145deg,
        var(--wca-accent_1, #d4af37) 0%,
        var(--wca-accent_2, #b8960c) 50%,
        var(--wca-accent_3, #9a7b0a) 100%
    );
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.wca-product-card a:hover {
    background: linear-gradient(
        145deg,
        var(--wca-accent_hover_1, #e6c04a) 0%,
        var(--wca-accent_hover_2, #c9a227) 50%,
        var(--wca-accent_hover_3, #b8960c) 100%
    );
}

/* Input Container */
.wca-chat-input-container {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
}

.wca-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.wca-chat-input:focus {
    border-color: var(--wca-accent_2, #b8960c);
}

.wca-chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(
        145deg,
        var(--wca-accent_1, #d4af37) 0%,
        var(--wca-accent_2, #b8960c) 50%,
        var(--wca-accent_3, #9a7b0a) 100%
    );
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

/* Force send icon size (override theme/cache); button is 44px so icon fills it well */
#wca-chat-widget .wca-chat-send svg,
button#wca-chat-send svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    min-height: 18px;
}

.wca-chat-send:hover:not(:disabled) {
    background: linear-gradient(
        145deg,
        var(--wca-accent_hover_1, #e6c04a) 0%,
        var(--wca-accent_hover_2, #c9a227) 50%,
        var(--wca-accent_hover_3, #b8960c) 100%
    );
}

.wca-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading Indicator */
.wca-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.wca-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.wca-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.wca-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .wca-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 80px;
        left: 10px !important;
        right: 10px !important;
    }
    
    .wca-position-bottom-right,
    .wca-position-bottom-left {
        bottom: 10px;
        right: 10px;
        left: auto;
    }
}

