/* =========================================================
 * WP Welcomer Live Chat - Fitur Tambahan (v2.5.0)
 * Media (gambar/video), Lightbox, Kartu Produk, Toolbar Admin
 * ========================================================= */

/* ---------- Lampiran Gambar & Video ---------- */
.welcomer-attach-wrap {
    margin-top: 6px;
}

.welcomer-chat-thumb {
    display: block;
    max-width: 200px;
    max-height: 220px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #334155;
    cursor: zoom-in;
    background: #0b1329;
}

.welcomer-chat-video {
    display: block;
    width: 240px;
    max-width: 100%;
    max-height: 260px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #000;
}

/* ---------- Lightbox ---------- */
.welcomer-lightbox {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483000;
    background: rgba(2, 6, 23, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
}

.welcomer-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    cursor: default;
}

.welcomer-lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
    border: 1px solid #334155;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 24px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

/* ---------- Indikator Upload ---------- */
.welcomer-upload-progress {
    align-self: flex-end;
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    min-width: 180px;
    max-width: 84%;
}

.welcomer-upload-progress-text {
    display: block;
    margin-bottom: 6px;
}

.welcomer-upload-progress-bar {
    display: block;
    height: 5px;
    background: #0f172a;
    border-radius: 3px;
    overflow: hidden;
}

.welcomer-upload-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--welcomer-primary, #2563eb);
    transition: width 0.2s ease;
}

/* ---------- Status Gagal Terkirim + Kirim Ulang ---------- */
.welcomer-send-failed {
    align-self: flex-end;
    max-width: 84%;
    background: #2a1215;
    border: 1px solid #f87171;
    color: #fecaca;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    text-align: left;
}

.welcomer-send-failed-text {
    color: #f8fafc;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 4px;
}

.welcomer-send-failed-status {
    font-size: 11px;
    font-weight: 600;
    color: #fca5a5;
}

.welcomer-send-retry-btn {
    margin-top: 6px;
    background: #dc2626;
    color: #ffffff;
    border: 0;
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.welcomer-send-retry-btn:hover { background: #b91c1c; }

/* ---------- Kartu Produk ---------- */
.welcomer-product-card {
    display: flex;
    gap: 10px;
    width: 260px;
    max-width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 8px;
    color: #f8fafc;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
    box-sizing: border-box;
}

.welcomer-product-card.welcomer-product-unavailable {
    display: block;
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 12px;
}

.welcomer-product-card .welcomer-pc-thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    text-decoration: none !important;
}

.welcomer-product-card .welcomer-pc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    border: 0;
}

.welcomer-product-card .welcomer-pc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.welcomer-product-card a.welcomer-pc-name {
    color: #f8fafc !important;
    font-weight: 700 !important;
    font-size: 13px;
    text-decoration: none !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.welcomer-product-card .welcomer-pc-price {
    color: #38bdf8;
    font-weight: 700;
    font-size: 13px;
}

.welcomer-product-card .welcomer-pc-price del {
    color: #94a3b8;
    font-weight: 400;
    font-size: 11px;
    margin-right: 4px;
    opacity: 0.85;
}

.welcomer-product-card .welcomer-pc-price ins {
    text-decoration: none;
    background: none;
    color: #38bdf8;
}

.welcomer-product-card .welcomer-pc-price .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
}

.welcomer-product-card .welcomer-pc-stock {
    font-size: 11px;
    font-weight: 600;
}

.welcomer-product-card .welcomer-pc-stock.stock-in { color: #4ade80; }
.welcomer-product-card .welcomer-pc-stock.stock-backorder { color: #fbbf24; }
.welcomer-product-card .welcomer-pc-stock.stock-out { color: #f87171; }

.welcomer-product-card .welcomer-pc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.welcomer-product-card a.welcomer-pc-btn {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.2;
    text-decoration: none !important;
    word-break: normal !important;
    white-space: nowrap;
    background: #1e293b;
    color: #e2e8f0 !important;
    border: 1px solid #334155;
}

.welcomer-product-card a.welcomer-pc-btn.primary {
    background: var(--welcomer-primary, #2563eb);
    border-color: var(--welcomer-primary, #2563eb);
    color: #ffffff !important;
}

.welcomer-product-card a.welcomer-pc-btn:hover {
    filter: brightness(1.12);
}

/* ---------- Tombol "Tanyakan Produk Ini" (Pelanggan) ---------- */
.welcomer-product-ask-bar {
    padding: 6px 10px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
}

.welcomer-product-ask-btn {
    width: 100%;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px dashed var(--welcomer-primary, #2563eb);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcomer-product-ask-btn:hover { background: #26344d; }
.welcomer-product-ask-btn:disabled { opacity: 0.6; cursor: wait; }

/* ---------- Toolbar Admin (Template / Media / Produk) ---------- */
.welcomer-admin-tools {
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 6px 10px 0;
}

.welcomer-admin-tools .welcomer-hidden {
    display: none !important;
}

.welcomer-admin-tools-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 6px;
}

.welcomer-tool-btn {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
}

.welcomer-tool-btn:hover {
    border-color: #2563eb;
    color: #ffffff;
}

.welcomer-tool-panel {
    background: #0b1329;
    border: 1px solid #1e293b;
    border-radius: 8px;
    max-height: 190px;
    overflow-y: auto;
    margin-bottom: 6px;
    padding: 6px;
}

.welcomer-tool-hint {
    color: #94a3b8;
    font-size: 12px;
    margin: 6px 4px;
}

.welcomer-tpl-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 5px;
    cursor: pointer;
    color: #e2e8f0;
}

.welcomer-tpl-item:hover { border-color: #2563eb; }

.welcomer-tpl-item strong {
    display: block;
    font-size: 12px;
    color: #38bdf8;
}

.welcomer-tpl-item span {
    display: block;
    font-size: 11px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcomer-product-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #f8fafc;
    font-size: 12px;
    margin-bottom: 6px;
}

.welcomer-product-result {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 5px 6px;
    margin-bottom: 5px;
    cursor: pointer;
    color: #e2e8f0;
}

.welcomer-product-result:hover { border-color: #2563eb; }
.welcomer-product-result.is-sending { opacity: 0.6; cursor: wait; }

.welcomer-product-result img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    background: #fff;
    flex: 0 0 36px;
}

.welcomer-pr-info {
    flex: 1;
    min-width: 0;
}

.welcomer-pr-info strong {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcomer-pr-info small {
    display: block;
    font-size: 10px;
    color: #94a3b8;
}

.welcomer-pr-send {
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    background: #2563eb;
    border-radius: 10px;
    padding: 3px 8px;
    flex: 0 0 auto;
}

/* ---------- Layar HP ---------- */
@media (max-width: 480px) {
    .welcomer-chat-thumb {
        max-width: 170px;
        max-height: 190px;
    }

    .welcomer-chat-video {
        width: 200px;
    }

    .welcomer-product-card {
        width: 230px;
        gap: 8px;
    }

    .welcomer-product-card .welcomer-pc-thumb {
        flex-basis: 60px;
        width: 60px;
        height: 60px;
    }

    .welcomer-product-card a.welcomer-pc-btn {
        padding: 6px 8px;
    }
}
