/* Claude WooCommerce Chatbot */
#cwc-chatbot-root *,
#cwc-chatbot-root *::before,
#cwc-chatbot-root *::after {
    box-sizing: border-box;
}

#cwc-chatbot-root {
    --cwc-color: #0084FF;
    --cwc-radius: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    z-index: 99990;
}

/* ── Toggle Button ── */
#cwc-chatbot-root .cwc-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: var(--cwc-color);
    border: none !important;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    max-height: none !important;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

#cwc-chatbot-root .cwc-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

#cwc-chatbot-root .cwc-toggle:focus-visible {
    outline: 3px solid var(--cwc-color);
    outline-offset: 3px;
}

#cwc-chatbot-root .cwc-toggle svg {
    width: 28px !important;
    height: 28px !important;
    fill: #fff;
    transition: opacity 0.15s;
    display: block;
    flex-shrink: 0;
}

#cwc-chatbot-root .cwc-toggle .cwc-icon-close {
    display: none;
}

#cwc-chatbot-root .cwc-toggle.cwc-active .cwc-icon-chat {
    display: none;
}

#cwc-chatbot-root .cwc-toggle.cwc-active .cwc-icon-close {
    display: block;
}

/* ── Badge ── */
#cwc-chatbot-root .cwc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #E53935;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: cwc-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#cwc-chatbot-root .cwc-badge.cwc-visible {
    display: flex;
}

@keyframes cwc-badge-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ── Chat Window ── */
#cwc-chatbot-root .cwc-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 390px;
    max-height: 630px;
    background: #fff;
    border-radius: var(--cwc-radius);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 99998;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#cwc-chatbot-root .cwc-window.cwc-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
#cwc-chatbot-root .cwc-header {
    padding: 16px 18px;
    background: var(--cwc-color);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#cwc-chatbot-root .cwc-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

#cwc-chatbot-root .cwc-header-info {
    flex: 1;
    min-width: 0;
}

#cwc-chatbot-root .cwc-header-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#cwc-chatbot-root .cwc-header-status {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 1px;
}

#cwc-chatbot-root .cwc-header-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4CAF50;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

#cwc-chatbot-root .cwc-close {
    background: none !important;
    border: none !important;
    color: #fff;
    cursor: pointer;
    opacity: 0.8;
    font-size: 22px;
    line-height: 1;
    padding: 4px !important;
    flex-shrink: 0;
    transition: opacity 0.15s;
    box-shadow: none !important;
}

#cwc-chatbot-root .cwc-close:hover {
    opacity: 1;
}

/* ── Messages Area ── */
#cwc-chatbot-root .cwc-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f8fa;
}

#cwc-chatbot-root .cwc-messages::-webkit-scrollbar {
    width: 5px;
}

#cwc-chatbot-root .cwc-messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

/* ── Message Bubbles ── */
#cwc-chatbot-root .cwc-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
    animation: cwc-msg-in 0.25s ease;
}

@keyframes cwc-msg-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

#cwc-chatbot-root .cwc-msg-bot {
    background: #fff;
    border: 1px solid #e8e8ee;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #1a1a1a;
}

#cwc-chatbot-root .cwc-msg-user {
    background: var(--cwc-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ── Bot message rich content ── */
#cwc-chatbot-root .cwc-msg-bot p {
    margin: 0 0 8px;
    line-height: 1.55;
}

#cwc-chatbot-root .cwc-msg-bot p:last-child {
    margin-bottom: 0;
}

#cwc-chatbot-root .cwc-msg-bot ul,
#cwc-chatbot-root .cwc-msg-bot ol {
    padding-left: 18px;
    margin: 6px 0;
}

#cwc-chatbot-root .cwc-msg-bot li {
    margin-bottom: 4px;
}

#cwc-chatbot-root .cwc-msg-bot strong {
    font-weight: 600;
}

#cwc-chatbot-root .cwc-msg-bot a {
    color: var(--cwc-color);
    text-decoration: underline;
    word-break: break-all;
}

#cwc-chatbot-root .cwc-msg-bot a:hover {
    text-decoration: none;
}

/* ── Typing Indicator ── */
#cwc-chatbot-root .cwc-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 12px 16px;
}

#cwc-chatbot-root .cwc-typing span:not(.cwc-typing-text) {
    width: 7px;
    height: 7px;
    background: #bbb;
    border-radius: 50%;
    animation: cwc-dot 1.2s infinite ease-in-out;
}

#cwc-chatbot-root .cwc-typing span:nth-child(2) { animation-delay: 0.15s; }
#cwc-chatbot-root .cwc-typing span:nth-child(3) { animation-delay: 0.3s; }

#cwc-chatbot-root .cwc-typing-text {
    font-size: 12px;
    color: #999;
    margin-left: 6px;
}

@keyframes cwc-dot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ── Input Area ── */
#cwc-chatbot-root .cwc-input-area {
    padding: 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
    align-items: center;
}

#cwc-chatbot-root .cwc-input {
    flex: 1;
    border: 1px solid #ddd !important;
    border-radius: 24px !important;
    padding: 10px 16px !important;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    color: #1a1a1a;
    background: #fff !important;
    min-width: 0;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

#cwc-chatbot-root .cwc-input:focus {
    border-color: var(--cwc-color) !important;
    outline: none;
}

#cwc-chatbot-root .cwc-input::placeholder {
    color: #999;
}

#cwc-chatbot-root .cwc-send {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: var(--cwc-color) !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    box-shadow: none !important;
    line-height: 1 !important;
    appearance: none;
    -webkit-appearance: none;
}

#cwc-chatbot-root .cwc-send:hover {
    opacity: 0.85;
}

#cwc-chatbot-root .cwc-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#cwc-chatbot-root .cwc-send svg {
    width: 18px !important;
    height: 18px !important;
    fill: #fff;
    display: block;
    flex-shrink: 0;
}

/* ── Responsive: Mobile ── */
@media (max-width: 600px) {
    #cwc-chatbot-root .cwc-window {
        width: calc(100vw - 24px);
        right: 12px;
        left: 12px;
        bottom: 90px;
        max-height: 70vh;
    }

    #cwc-chatbot-root .cwc-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px !important;
        height: 56px !important;
    }
}

/* ── Responsive: Very Small ── */
@media (max-width: 380px) {
    #cwc-chatbot-root .cwc-window {
        right: 5px;
        width: calc(100vw - 10px);
        bottom: 80px;
        border-radius: 12px;
    }

    #cwc-chatbot-root .cwc-header {
        padding: 12px 14px;
    }

    #cwc-chatbot-root .cwc-messages {
        padding: 12px;
    }
}
