/* public/css/chat.css — on-site customer chat widget (官網聊聊) */

.ezchat-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary, #0d6efd);
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ezchat-launcher:hover { transform: scale(1.08) translateY(-2px); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); }
.ezchat-launcher svg { width: 30px; height: 30px; }
.ezchat-launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    background: #dc3545;
    color: #fff;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
.ezchat-launcher-badge[hidden] { display: none; }

.ezchat-panel {
    position: fixed;
    bottom: 96px;
    left: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
}
.ezchat-panel[hidden] { display: none; }

.ezchat-header {
    background: var(--primary, #0d6efd);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
}
.ezchat-title { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.ezchat-title small { display: block; font-weight: 400; font-size: 0.72rem; opacity: 0.85; }
.ezchat-close { background: transparent; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 0 4px; }

.ezchat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ezchat-empty { margin: auto; color: #9aa1ac; font-size: 0.85rem; text-align: center; padding: 20px; }

.ezchat-row { display: flex; flex-direction: column; max-width: 82%; }
.ezchat-row.mine { align-self: flex-end; align-items: flex-end; }
.ezchat-row.theirs { align-self: flex-start; align-items: flex-start; }
.ezchat-agentname { font-size: 0.68rem; color: #7a828d; margin: 0 4px 2px; }
.ezchat-msg {
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.ezchat-row.theirs .ezchat-msg { background: #fff; color: #222; border: 1px solid #e6e9f0; border-bottom-left-radius: 4px; }
.ezchat-row.mine .ezchat-msg { background: var(--primary, #0d6efd); color: #fff; border-bottom-right-radius: 4px; }
.ezchat-msg a { color: inherit; text-decoration: underline; }
.ezchat-msg.media { padding: 4px; }
.ezchat-msg img, .ezchat-msg video { max-width: 220px; max-height: 260px; border-radius: 10px; display: block; cursor: pointer; }
.ezchat-meta { font-size: 0.66rem; color: #9aa1ac; margin: 2px 4px 0; }

.ezchat-composer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #eee;
    background: #fff;
    flex: 0 0 auto;
}
.ezchat-composer textarea {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid #dcdfe6;
    border-radius: 18px;
    padding: 8px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 100px;
    outline: none;
    font-family: inherit;
}
.ezchat-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--primary, #0d6efd);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.ezchat-send { background: var(--primary, #0d6efd); color: #fff; }
.ezchat-send:disabled { opacity: 0.5; cursor: default; }

.ezchat-uploading { align-self: center; font-size: 0.75rem; color: #7a828d; padding: 4px; }

@media (max-width: 480px) {
    .ezchat-panel {
        left: 0; right: 0; bottom: 0;
        width: 100%; max-width: 100%;
        height: 100%; max-height: 100%;
        border-radius: 0;
    }
    .ezchat-launcher { bottom: 16px; left: 16px; }
}

/* ---- 我買過的商品(widget 右欄;窄螢幕退化為 📦 叫出的覆蓋層)---- */
.ezchat-cols {
    flex: 1;
    display: flex;
    min-height: 0;      /* let children scroll instead of overflowing the fixed panel */
    position: relative; /* the mobile overlay anchors to this box */
}
.ezchat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.ezchat-orders {
    /* mobile default: full overlay over the chat column, toggled by the 📦 button */
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 5;
    display: flex;
    flex-direction: column;
}
.ezchat-orders[hidden] { display: none; }
.ezchat-orders-head {
    padding: 10px 14px 6px;
    font-weight: 700;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}
.ezchat-orders-hint {
    padding: 0 14px 8px;
    color: #9aa1ac;
    font-size: 0.72rem;
    border-bottom: 1px solid #eef0f4;
    flex: none;
}
/* 桌面(夠寬):視窗加寬成雙欄,右欄常駐直接看到清單,📦/關閉鈕都不需要 */
@media (min-width: 760px) {
    .ezchat-panel { width: 660px; }
    .ezchat-orders {
        position: static;
        display: flex !important; /* overrides the [hidden] attribute — the column is always on */
        width: 258px;
        flex: none;
        border-left: 1px solid #eef0f4;
        background: #fafbfd;
    }
    .ezchat-orders-close { display: none; }
    #ezchat-orders-btn { display: none; }
}
.ezchat-orders-close {
    margin-left: auto;
    border: none; background: none;
    font-size: 1.3rem; line-height: 1;
    color: #9aa1ac; cursor: pointer; padding: 0 2px;
}
.ezchat-orders-list { flex: 1; overflow-y: auto; padding: 10px 12px; }
.ezchat-order {
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}
.ezchat-order-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.ezchat-order-head b { font-size: 0.8rem; }
.ezchat-order-head span { color: #9aa1ac; font-size: 0.72rem; white-space: nowrap; }
.ezchat-order-item {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0;
    border-top: 1px dashed #f0f1f5;
}
.ezchat-oi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ezchat-ask {
    flex: none;
    border: 1px solid var(--primary, #0d6efd);
    color: var(--primary, #0d6efd);
    background: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
    padding: 2px 10px;
    cursor: pointer;
}
.ezchat-ask:hover { background: var(--primary, #0d6efd); color: #fff; }
.ezchat-order-foot {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px dashed #f0f1f5;
    padding-top: 6px; margin-top: 2px;
    color: #6b7280; font-size: 0.78rem;
}
.ezchat-ask-order { border-color: #c9ced9; color: #6b7280; }
.ezchat-ask-order:hover { background: #f3f4f6; color: #374151; border-color: #c9ced9; }
.ezchat-login-link {
    display: inline-block;
    margin-top: 4px;
    padding: 6px 18px;
    border-radius: 999px;
    background: var(--primary, #0d6efd);
    color: #fff !important;
    text-decoration: none;
    font-size: 0.85rem;
}
