/* ═══════════════════════════════════════════════════════
   WELIA CHATBOT WIDGET — style.css
   ═══════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --wc-green:       #25a244;
    --wc-green-dark:  #1a7a33;
    --wc-green-light: #e8f7ed;
    --wc-orange:      #f68b1e;
    --wc-bg:          #f0f2f5;
    --wc-white:       #ffffff;
    --wc-text:        #1a1a2e;
    --wc-grey:        #6c757d;
    --wc-radius:      16px;
    --wc-shadow:      0 8px 32px rgba(0,0,0,.18);
    --wc-z:           9999;
}

/* ── Floating Button ────────────────────────────────────── */
.welia-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--wc-z);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wc-green), var(--wc-green-dark));
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37,162,68,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform .2s, box-shadow .2s;
    outline: none;
}
.welia-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37,162,68,.65);
}
.welia-fab .wc-fab-icon-open  { display: block; }
.welia-fab .wc-fab-icon-close { display: none; }
.welia-fab.is-open .wc-fab-icon-open  { display: none; }
.welia-fab.is-open .wc-fab-icon-close { display: block; }

/* Badge */
.wc-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: #e63946;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px;
    border: 2px solid #fff;
    animation: wcBadgePop .4s ease;
}
.wc-badge.hidden { display: none; }
@keyframes wcBadgePop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Pulse ring */
.welia-fab::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(37,162,68,.4);
    animation: wcPulse 2.2s ease-out infinite;
}
@keyframes wcPulse {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.55); }
}

/* ── Chat Window ────────────────────────────────────────── */
.wc-window {
    position: fixed;
    bottom: 94px;
    right: 24px;
    z-index: var(--wc-z);
    width: 370px;
    max-height: 560px;
    display: flex;
    flex-direction: column;
    background: var(--wc-white);
    border-radius: var(--wc-radius);
    box-shadow: var(--wc-shadow);
    overflow: hidden;
    transform: scale(.92) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
    transform-origin: bottom right;
}
.wc-window.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────── */
.wc-header {
    background: linear-gradient(135deg, var(--wc-green-dark), var(--wc-green));
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.wc-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    position: relative;
}
.wc-online-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 10px; height: 10px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid var(--wc-green-dark);
}
.wc-header-info { flex: 1; min-width: 0; }
.wc-header-name {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wc-header-status { font-size: 11px; opacity: .85; }
.wc-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.wc-btn-wa {
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}
.wc-btn-wa:hover { background: rgba(255,255,255,.35); color: #fff; }
.wc-btn-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}
.wc-btn-close:hover { background: rgba(255,255,255,.3); }

/* ── WA strip under header ──────────────────────────────── */
.wc-wa-strip {
    background: #f0fdf4;
    border-bottom: 1px solid #d1fae5;
    padding: 7px 14px;
    font-size: 12px;
    color: var(--wc-green-dark);
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}
.wc-wa-strip a {
    color: var(--wc-green-dark);
    font-weight: 700;
    text-decoration: none;
}
.wc-wa-strip a:hover { text-decoration: underline; }

/* ── Messages area ──────────────────────────────────────── */
.wc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    background: var(--wc-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.wc-messages::-webkit-scrollbar { width: 4px; }
.wc-messages::-webkit-scrollbar-track { background: transparent; }
.wc-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Bubble wrapper */
.wc-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 7px;
}
.wc-msg-row.bot  { justify-content: flex-start; }
.wc-msg-row.user { justify-content: flex-end; }

/* Bot mini avatar */
.wc-msg-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--wc-green);
    color: #fff;
    font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}

/* Bubble */
.wc-bubble {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}
.wc-msg-row.bot  .wc-bubble {
    background: var(--wc-white);
    border-bottom-left-radius: 5px;
    color: var(--wc-text);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.wc-msg-row.user .wc-bubble {
    background: linear-gradient(135deg, var(--wc-green), var(--wc-green-dark));
    color: #fff;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 8px rgba(37,162,68,.3);
}

/* Typing indicator */
.wc-typing {
    display: flex; gap: 5px;
    padding: 12px 16px;
    background: var(--wc-white);
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    width: fit-content;
}
.wc-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #bbb;
    animation: wcDot 1.2s infinite ease-in-out;
}
.wc-typing span:nth-child(2) { animation-delay: .2s; }
.wc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes wcDot {
    0%, 60%, 100% { transform: translateY(0); background: #bbb; }
    30%            { transform: translateY(-5px); background: var(--wc-green); }
}

/* ── Product cards ──────────────────────────────────────── */
.wc-products-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.wc-product-card {
    display: flex;
    gap: 10px;
    background: var(--wc-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.09);
    padding: 8px;
    align-items: center;
    transition: box-shadow .2s;
}
.wc-product-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.13); }
.wc-product-img {
    width: 60px; height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f5f5f5;
}
.wc-product-info { flex: 1; min-width: 0; }
.wc-product-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--wc-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}
.wc-product-price {
    font-size: 13px;
    font-weight: 800;
    color: var(--wc-green-dark);
    margin-top: 3px;
}
.wc-product-old-price {
    font-size: 11px;
    color: #aaa;
    text-decoration: line-through;
    margin-left: 4px;
    font-weight: 400;
}
.wc-product-stock {
    font-size: 10.5px;
    font-weight: 700;
    margin-top: 3px;
}
.wc-stock-out { color: #d92d20; }
.wc-stock-low { color: #e08a00; }
.wc-product-out { opacity: .72; }
.wc-product-out .wc-product-img { filter: grayscale(.4); }
.wc-product-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}
.wc-btn-view, .wc-btn-buy {
    border: none;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .2s, transform .1s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.wc-btn-view {
    background: #f0f2f5;
    color: var(--wc-text);
}
.wc-btn-view:hover { background: #e2e5ea; color: var(--wc-text); }
.wc-btn-buy {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
}
.wc-btn-buy:hover { opacity: .88; transform: scale(1.03); }

/* ── Quick replies ──────────────────────────────────────── */
.wc-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 12px 4px;
    flex-shrink: 0;
    background: var(--wc-bg);
}
.wc-qr {
    border: 1.5px solid var(--wc-green);
    color: var(--wc-green-dark);
    background: #fff;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, color .18s;
    white-space: nowrap;
}
.wc-qr:hover {
    background: var(--wc-green);
    color: #fff;
}

/* ── WA action button (inside message) ─────────────────── */
.wc-wa-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    text-decoration: none;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    margin-top: 8px;
    transition: opacity .2s, transform .15s;
    box-shadow: 0 3px 10px rgba(18,140,126,.3);
}
.wc-wa-action:hover { opacity: .88; transform: translateY(-1px); color: #fff; }

/* ── Footer / Input ─────────────────────────────────────── */
.wc-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: var(--wc-white);
    flex-shrink: 0;
}
.wc-input {
    flex: 1;
    border: 1.5px solid #dde1e7;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13.5px;
    outline: none;
    background: var(--wc-bg);
    color: var(--wc-text);
    transition: border-color .2s, background .2s;
}
.wc-input:focus {
    border-color: var(--wc-green);
    background: #fff;
}
.wc-input::placeholder { color: #b0b8c1; }
.wc-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wc-green), var(--wc-green-dark));
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: transform .15s, box-shadow .15s;
}
.wc-send:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(37,162,68,.4);
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .wc-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 88vh;
        border-radius: var(--wc-radius) var(--wc-radius) 0 0;
    }
    .welia-fab {
        bottom: 18px;
        right: 18px;
    }
}
