/* Chat Widget Container */
.wpsc-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Chat Button */
#wpsc-chat-button {
    width: 60px;
    height: 60px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

#wpsc-chat-button:hover {
    transform: scale(1.1);
}

.wpsc-chat-icon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Chat Window */
#wpsc-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 350px;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

#wpsc-chat-window.active {
    opacity: 1;
    transform: translateY(0);
}

/* Chat Header */
.wpsc-chat-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.wpsc-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.wpsc-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.wpsc-close-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
#wpsc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

.wpsc-message {
    margin-bottom: 15px;
    display: flex;
    animation: message-fade-in 0.3s ease;
}

@keyframes message-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpsc-bot-message {
    justify-content: flex-start;
}

.wpsc-user-message {
    justify-content: flex-end;
}

.wpsc-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.wpsc-bot-message .wpsc-message-content {
    background-color: #f0f2f5;
    color: #1c1e21;
    border-bottom-left-radius: 4px;
}

.wpsc-user-message .wpsc-message-content {
    background-color: #0084ff;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Input Area */
.wpsc-input-area {
    padding: 15px;
    background-color: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.wpsc-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 20px;
}

#wpsc-message-input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    background-color: transparent;
    color: inherit;
    transition: all 0.3s ease;
}

#wpsc-message-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

#wpsc-send-button {
    background: none;
    border: none;
    color: #0084ff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#wpsc-send-button:hover {
    background-color: rgba(0, 132, 255, 0.1);
}

/* Toolbar */
.wpsc-toolbar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 0 8px;
}

.wpsc-toolbar-button {
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.wpsc-toolbar-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #0084ff;
}

/* Loading Animation */
.wpsc-loading {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 18px;
    width: fit-content;
}

.wpsc-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: wpsc-loading 1.4s infinite;
}

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

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

@keyframes wpsc-loading {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Media Attachments */
.wpsc-image-message img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    object-fit: cover;
}

.wpsc-voice-message audio {
    max-width: 240px;
}

/* Responsive Design */
@media (max-width: 480px) {
    #wpsc-chat-window {
        width: calc(100% - 32px);
        height: calc(100% - 100px);
        bottom: 80px;
    }

    #wpsc-chat-button {
        width: 50px;
        height: 50px;
    }

    .wpsc-image-message img {
        max-width: 160px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #wpsc-message-input::placeholder {
        color: rgba(255, 255, 255, 0.5);
    }

    .wpsc-toolbar-button {
        color: rgba(255, 255, 255, 0.5);
    }

    .wpsc-toolbar-button:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .wpsc-loading {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .wpsc-loading span {
        background-color: rgba(255, 255, 255, 0.5);
    }
}
