/* 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; }
}
