:root {
    --woo-chat-primary: #007cba;
    --woo-chat-bg: #ffffff;
    --woo-chat-text: #333333;
    --woo-chat-border-radius: 16px;
    --woo-chat-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Chat Launcher */
#woo-chat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--woo-chat-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: transform 0.3s ease;
}

#woo-chat-launcher:hover {
    transform: scale(1.05);
}

#woo-chat-launcher.woo-chat-left {
    right: auto;
    left: 20px;
}

#woo-chat-launcher svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Chat Window */
#woo-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--woo-chat-border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
    font-family: var(--woo-chat-font);
}

#woo-chat-window.woo-chat-left {
    right: auto;
    left: 20px;
}

#woo-chat-window.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Header */
.woo-chat-header {
    padding: 15px;
    background-color: var(--woo-chat-primary);
    color: white;
    border-radius: var(--woo-chat-border-radius) var(--woo-chat-border-radius) 0 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.woo-chat-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.woo-chat-close,
.woo-chat-clear {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}

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

.woo-chat-clear svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Messages Area */
.woo-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.woo-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.woo-chat-message p {
    margin: 0 0 10px 0;
}

.woo-chat-message p:last-child {
    margin-bottom: 0;
}

.woo-chat-message ul,
.woo-chat-message ol {
    margin: 0 0 10px 20px;
    padding: 0;
}

.woo-chat-message li {
    margin-bottom: 5px;
}

.woo-chat-message-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 4px;
}

.woo-chat-message-row.user {
    justify-content: flex-end;
}

.woo-chat-message-row.assistant {
    justify-content: flex-start;
}

.woo-chat-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.woo-chat-message.user {
    /* align-self: flex-end; Removed alignment since it's handled by wrapper now */
    background-color: var(--woo-chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.woo-chat-message.assistant {
    /* align-self: flex-start; Removed alignment since it's handled by wrapper now */
    background-color: #f1f1f1;
    color: var(--woo-chat-text);
    border-bottom-left-radius: 2px;
}

/* Input Area */
.woo-chat-input-area {
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 8px;
}

#woo-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
    transition: border-color 0.2s;
}

#woo-chat-input:focus {
    border-color: var(--woo-chat-primary);
}

#woo-chat-send {
    background-color: var(--woo-chat-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

#woo-chat-send svg {
    width: 16px;
    height: 16px;
    fill: white;
}

/* Products List in Chat */
.woo-chat-product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
}

.woo-chat-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 13px;
}

.woo-chat-product-item a {
    color: var(--woo-chat-primary);
    text-decoration: none;
    font-weight: 500;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #f1f1f1;
    border-radius: 12px;
    width: fit-content;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Responsive */
/* Mobile Responsive */
@media (max-width: 600px) {
    #woo-chat-launcher {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }

    #woo-chat-launcher svg {
        width: 24px;
        height: 24px;
    }

    #woo-chat-window {
        position: fixed !important;
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        transform: none !important;
        /* Override desktop transform */
        z-index: 2147483647 !important;
        /* Maximum Z-Index */
        opacity: 0;
        /* Managed by active class */
        pointer-events: none;
    }

    #woo-chat-window.active {
        opacity: 1;
        pointer-events: all;
    }

    #woo-chat-launcher {
        z-index: 2147483647 !important;
        bottom: 15px;
        bottom: calc(15px + env(safe-area-inset-bottom));
    }

    .woo-chat-header {
        padding: 15px;
        /* Safe area */
    }

    /* Prevent iOS zoom on focus */
    #woo-chat-input {
        font-size: 16px;
    }

    .woo-chat-message-row {
        margin-bottom: 8px;
        /* More spacing */
    }

    /* Better touch targets */
    .woo-chat-close,
    .woo-chat-clear {
        padding: 5px;
        font-size: 28px;
    }
}