/* ContentReply AI - Frontend Widget Styles */

.wpsc-widget {
    position: fixed;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wpsc-bottom-right {
    bottom: 24px;
    right: 24px;
}

.wpsc-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* Toggle Button */
.wpsc-toggle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 0;
    overflow: hidden;
}

.wpsc-bottom-left .wpsc-toggle-btn {
    right: auto;
    left: 0;
}

.wpsc-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.wpsc-toggle-btn img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

/* When chat is open - show close icon on green bg */
.wpsc-toggle-btn.wpsc-open {
    background: var(--wpsc-primary, #2e7d32);
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.3);
}

.wpsc-toggle-btn.wpsc-open svg {
    stroke: #ffffff;
}

/* Chat Window */
.wpsc-chat-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wpscSlideUp 0.3s ease;
}

.wpsc-bottom-left .wpsc-chat-window {
    right: auto;
    left: 0;
}

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

/* Header */
.wpsc-chat-header {
    background: var(--wpsc-primary, #2e7d32);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.wpsc-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wpsc-bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wpsc-bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.wpsc-bot-name {
    font-size: 15px;
    font-weight: 600;
}

.wpsc-bot-status {
    font-size: 12px;
    opacity: 0.85;
}

.wpsc-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.wpsc-close-btn:hover {
    opacity: 1;
}

/* Messages Area */
.wpsc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wpsc-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.wpsc-msg-bot {
    background: #f3f4f6;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.wpsc-msg-user {
    background: var(--wpsc-primary, #2e7d32);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.wpsc-msg-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    color: #6b7280;
}

.wpsc-msg-sources a {
    color: var(--wpsc-primary, #2e7d32);
    text-decoration: none;
    font-weight: 500;
}

.wpsc-msg-sources a:hover {
    text-decoration: underline;
}

/* Typing indicator */
.wpsc-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 14px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.wpsc-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: wpscBounce 1.4s infinite both;
}

.wpsc-typing span:nth-child(2) { animation-delay: 0.2s; }
.wpsc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wpscBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.wpsc-input-area {
    padding: 14px 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.wpsc-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.wpsc-input:focus {
    border-color: var(--wpsc-primary, #2e7d32);
    background: #ffffff;
}

.wpsc-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--wpsc-primary, #2e7d32);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wpsc-send-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .wpsc-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 140px);
        bottom: 76px;
        right: -8px;
    }

    .wpsc-bottom-left .wpsc-chat-window {
        left: -8px;
    }
}
