/* ============================================
   SensationToys Chatbot Widget
   ============================================ */

/* --- Reset & Variables --- */
.stc-widget,
.stc-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.stc-widget {
    --stc-primary: #2d2d2d;
    --stc-accent: #c2185b;
    --stc-accent-hover: #ad1457;
    --stc-bg: #f5f5f5;
    --stc-white: #ffffff;
    --stc-text: #1a1a1a;
    --stc-text-light: #666666;
    --stc-border: #e0e0e0;
    --stc-radius: 12px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
}

.stc-hidden { display: none !important; }

/* --- Floating Bubble --- */
.stc-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--stc-accent);
    color: var(--stc-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background 0.2s ease;
}

.stc-bubble:hover {
    transform: scale(1.08);
    background: var(--stc-accent-hover);
}

.stc-bubble svg {
    width: 28px;
    height: 28px;
}

/* --- Chat Window --- */
.stc-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--stc-white);
    border-radius: var(--stc-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: stc-slide-up 0.25s ease-out;
}

@keyframes stc-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Header --- */
.stc-header {
    background: var(--stc-primary);
    color: var(--stc-white);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.stc-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stc-header-title {
    font-size: 15px;
    font-weight: 600;
}

.stc-header-status {
    font-size: 11px;
    opacity: 0.7;
}

.stc-close {
    background: none;
    border: none;
    color: var(--stc-white);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.stc-close:hover { opacity: 1; }

/* --- Messages Area --- */
.stc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--stc-bg);
}

.stc-messages::-webkit-scrollbar { width: 4px; }
.stc-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* --- Message Bubbles --- */
.stc-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--stc-radius);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.stc-msg-user {
    align-self: flex-end;
    background: var(--stc-accent);
    color: var(--stc-white);
    border-bottom-right-radius: 4px;
}

.stc-msg-bot {
    align-self: flex-start;
    background: var(--stc-white);
    color: var(--stc-text);
    border: 1px solid var(--stc-border);
    border-bottom-left-radius: 4px;
}

/* --- Typing Indicator --- */
.stc-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--stc-white);
    border-radius: var(--stc-radius);
    border: 1px solid var(--stc-border);
}

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

.stc-typing-dot:nth-child(1) { animation-delay: 0s; }
.stc-typing-dot:nth-child(2) { animation-delay: 0.16s; }
.stc-typing-dot:nth-child(3) { animation-delay: 0.32s; }

@keyframes stc-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* --- Product Cards --- */
.stc-products {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scroll-snap-type: x mandatory;
}

.stc-products::-webkit-scrollbar { height: 3px; }
.stc-products::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.stc-product-card {
    flex: 0 0 160px;
    scroll-snap-align: start;
    background: var(--stc-white);
    border: 1px solid var(--stc-border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--stc-text);
    transition: box-shadow 0.2s;
}

.stc-product-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.stc-product-img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: #fafafa;
    padding: 8px;
}

.stc-product-info {
    padding: 8px 10px;
}

.stc-product-name {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.stc-product-brand {
    font-size: 10px;
    color: var(--stc-text-light);
    margin-bottom: 4px;
}

.stc-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--stc-accent);
}

.stc-product-btn {
    display: block;
    text-align: center;
    padding: 6px;
    background: var(--stc-accent);
    color: var(--stc-white);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.stc-product-btn:hover {
    background: var(--stc-accent-hover);
}

/* --- Input Area --- */
.stc-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--stc-white);
    border-top: 1px solid var(--stc-border);
    flex-shrink: 0;
}

.stc-input {
    flex: 1;
    border: 1px solid var(--stc-border);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.stc-input:focus {
    border-color: var(--stc-accent);
}

.stc-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--stc-accent);
    color: var(--stc-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.stc-send:hover { background: var(--stc-accent-hover); }
.stc-send:disabled { background: #ccc; cursor: not-allowed; }

.stc-send svg {
    width: 18px;
    height: 18px;
}

/* --- Mobile Responsive --- */
@media (max-width: 540px) {
    .stc-widget {
        bottom: 12px;
        right: 12px;
    }

    .stc-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 99999;
    }

    .stc-bubble {
        width: 52px;
        height: 52px;
    }

    .stc-bubble svg {
        width: 24px;
        height: 24px;
    }
}
