/* ============================================================
   chat.css — ZonaAsupan69 LiveChat
   ============================================================ */

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
    --utama:         #9069e9;
    --utama-dark:    #6d28d9;
    --utama-light:   #f0eaff;
    --bg-user:       #9069e9;
    --bg-bot:        #ffffff;
    --bg-chat:       #f9f9f9;
    --bg-footer:     rgba(255,255,255,0.96);
    --text-muted:    #667781;
    --blue-read:     #34b7f1;
    --highlight:     rgba(124,58,237,0.18);
    --radius-bubble: 18px;
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── BASE ──────────────────────────────────────────────────── */
html, body {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Lexend Deca', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: #f2f4f8;
}

/* ── BACKGROUND BLUR LAYER ─────────────────────────────────── */
.background-blur {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background-color: var(--bg-chat);
    background-size: cover;
    background-position: center;
    filter: blur(0px);
    transition: filter 0.3s;
}

/* ── CONTAINER ─────────────────────────────────────────────── */
.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%; height: 100%;
    overflow: hidden;
    position: relative;
}

@media (min-width: 768px) {
    body {
        justify-content: center;
        align-items: center;
        padding: 20px;
    }
    .chat-container {
        max-width: 450px;
        height: 90dvh;
        border-radius: 20px;
        box-shadow: 0 12px 48px rgba(0,0,0,0.18);
        overflow: hidden;
    }
}

/* ── HEADER ────────────────────────────────────────────────── */
/* Merged: base + UI compact override */
.chat-header {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #9c6ff0 0%, #7c3aed 100%);
    color: white;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 30;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.img-admin {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.foto-admin {
    width: 46px; height: 46px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15);
}

.foto-admin img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.admin-badge {
    position: absolute;
    bottom: -2px; right: -4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid white;
    background: white;
}

.admin-badge img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}

.header-info { flex: 1; }

.header-info h5 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
}

.header-status {
    font-size: 11.5px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.btn-settings {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.85;
    padding: 6px;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-settings:hover {
    opacity: 1;
    transform: rotate(45deg);
}

/* ── CHAT BODY ─────────────────────────────────────────────── */
/* Merged: base + UI compact override */
.chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(circle at top right,    rgba(144,105,233,.39), transparent 39%),
        radial-gradient(circle at bottom left,   rgba(144,105,233,.18), transparent 39%),
        radial-gradient(circle at center top,    rgba(255,255,255,.69), transparent 39%),
        linear-gradient(180deg, #f7f3ff 0%, #f3efff 45%, #efeaff 100%);
}

/* Pattern layer */
.chat-body::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(144,105,233,.18) 1.2px, transparent 1.2px);
    background-size: 28px 28px;
    opacity: .9;
    pointer-events: none;
    z-index: 0;
}

/* Glow layer */
.chat-body::before {
    content: "";
    position: absolute;
    top: -120px; left: -120px;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: radial-gradient(rgba(144,105,233,.18), transparent 69%);
    filter: blur(9px);
    pointer-events: none;
    z-index: 0;
}

/* Semua isi chat di atas layer background */
.chat-body > * {
    position: relative;
    z-index: 1;
}

/* ── DATE SEPARATOR ────────────────────────────────────────── */
.date-sep {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin: 8px 0;
}

.date-sep span {
    background: rgba(255,255,255,0.8);
    padding: 3px 12px;
    border-radius: 100px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── SCROLL TO BOTTOM BTN ──────────────────────────────────── */
#scroll-bottom-btn {
    position: absolute;
    bottom: 127px; left: 15px;
    width: 39px; height: 39px;
    background: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    cursor: pointer;
    z-index: 100;
    transition: bottom 0.3s ease;
}

#scroll-bottom-btn svg {
    width: 27px; height: 27px;
    fill: var(--utama);
}

#scroll-bottom-btn.reply-open { bottom: 189px; }

/* ── MESSAGE AVATAR ────────────────────────────────────────── */
.msg-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    align-self: flex-end;
    border: 1.5px solid rgba(124,58,237,0.25);
}

/* ── MESSAGE ROW ───────────────────────────────────────────── */
.msg-row {
    max-width: 81%;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 6px;
    transition: transform 0.15s ease-out;
    will-change: transform;
}

.msg-row .bubble {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.msg-row.out {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 81%;
}

.msg-row.in {
    align-self: flex-start;
    max-width: 81%;
}

/* Swipe to reply indicator */
.msg-row::before {
    content: '↩';
    position: absolute;
    left: -28px; top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--utama);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.msg-row.in.swiping::before { opacity: 1; }

/* ── BUBBLE ────────────────────────────────────────────────── */
/* Merged: base + UI compact override */
.bubble {
    padding: 9px 12px 6px;
    border-radius: var(--radius-bubble);
    box-shadow:
        0 4px 6px rgba(0,0,0,0.12),
        0 1px 3px rgba(0,0,0,0.08),
        inset 0 1px 0 rgba(255,255,255,0.15);
    word-break: break-word;
    overflow-wrap: break-word;
    position: relative;
}

/* Outgoing bubble */
.out .bubble {
    background: #9069E9;
    color: white;
    border-bottom-right-radius: 9px;
    align-self: flex-end;
    width: fit-content;
    min-width: 60px;
    box-shadow:
        0 3px 9px rgba(109,40,217,0.39),
        0 1px 2px rgba(0,0,0,0.12),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.15);
}

.out .bubble::after {
    content: "";
    position: absolute;
    right: -7px; bottom: 10px;
    border-width: 9px 0 0 9px;
    border-style: solid;
    border-color: transparent transparent transparent #9069E9;
    z-index: 2;
}

/* Incoming bubble */
.in .bubble {
    background: linear-gradient(160deg, #ffffff 0%, #f9f6ff 100%);
    color: #222;
    border-bottom-left-radius: 3px;
    align-self: flex-start;
    width: fit-content;
    min-width: 60px;
    box-shadow:
        0 3px 9px rgba(0,0,0,0.10),
        0 1px 2px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 -1px 0 rgba(0,0,0,0.03);
}

.in .bubble::after {
    content: "";
    position: absolute;
    left: -7px; bottom: 10px;
    border-width: 9px 9px 0 0;
    border-style: solid;
    border-color: transparent var(--bg-bot) transparent transparent;
    z-index: 2;
}

/* Highlight on scroll-to */
.msg-row.highlighted .bubble {
    background: var(--highlight) !important;
    transition: background 0.3s;
}

/* ── REPLY QUOTE ───────────────────────────────────────────── */
.reply-quote {
    border-left: 4px solid;
    padding: 5px 9px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.out .reply-quote {
    background: rgba(0,0,0,0.15);
    border-color: rgba(255,255,255,0.6);
    color: rgba(255,255,255,0.88);
}

.in .reply-quote {
    background: rgba(0,0,0,0.05);
    border-color: var(--utama);
    color: #555;
}

.reply-quote b {
    font-size: 11px;
    display: block;
    margin-bottom: 2px;
}

.out .reply-quote b { color: rgba(255,255,255,0.95); }
.in  .reply-quote b { color: var(--utama); }

/* ── IMAGE IN BUBBLE ───────────────────────────────────────── */
.img-content {
    max-width: 100%;
    width: 230px;
    border-radius: 10px;
    margin: 4px 0 2px;
    display: block;
    cursor: zoom-in;
    object-fit: cover;
}

/* ── MESSAGE TEXT & META ───────────────────────────────────── */
.msg-text {
    font-size: 14px;
    line-height: 1.5;
    display: block;
    white-space: pre-wrap;
}

/* Merged: base + UI compact override */
.msg-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 3px;
    font-size: 10px;
}

.out .msg-meta { color: rgba(255,255,255,0.7); }
.in  .msg-meta { color: var(--text-muted); }

.check {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.check.blue { color: var(--blue-read); }

/* ── TYPING INDICATOR ──────────────────────────────────────── */
.typing-bubble .bubble {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
}

.typing-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--utama);
    animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* ── REPLY PREVIEW BAR ─────────────────────────────────────── */
#reply-preview {
    display: none;
    background: #ede9fe;
    border-left: 4px solid var(--utama);
    padding: 9px 40px 9px 14px;
    position: relative;
    border-radius: 8px 8px 0 0;
    z-index: 25;
    flex-shrink: 0;
}

#reply-preview .rp-label {
    font-size: 11px;
    color: var(--utama);
    font-weight: 700;
    margin-bottom: 2px;
}

#reply-text-preview {
    font-size: 12.5px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#cancel-reply {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    padding: 5px;
    line-height: 1;
}

/* ── CHAT FOOTER ───────────────────────────────────────────── */
/* Merged: base + UI compact override */
.chat-footer {
    flex: 0 0 auto;
    background: var(--bg-footer);
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    z-index: 30;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.06);
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Merged: base + UI compact override */
#msg-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    padding: 10px 15px;
    border-radius: 100px;
    outline: none;
    font-size: 13.5px;
    font-family: inherit;
    background: white;
    color: #111;
    transition: border-color 0.2s;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
}

#msg-input:focus { border-color: var(--utama); }

.btn-attach {
    cursor: pointer;
    font-size: 22px;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.btn-attach:hover { color: var(--utama); }

/* Merged: base + UI compact override */
#send-btn {
    width: 40px; height: 40px;
    flex-shrink: 0;
    background: var(--utama);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 3px 10px rgba(124,58,237,0.35);
}

#send-btn:hover  { background: var(--utama-dark); }
#send-btn:active { transform: scale(0.92); }

#send-btn svg {
    width: 20px; height: 20px;
    fill: white;
}

/* ── POPUP OVERLAY ─────────────────────────────────────────── */
.popup-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.popup-overlay.open { display: block; }

/* ── BACKGROUND POPUP ──────────────────────────────────────── */
.bg-popup {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 18px;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.18);
    width: min(340px, 94%);
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes popup-in {
    from { transform: translate(-50%, -48%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

.bg-popup.open {
    display: block;
    animation: popup-in 0.2s ease;
}

.bg-popup h6 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--utama);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── MENU GRID ─────────────────────────────────────────────── */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.menu-grid-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 9px;
    border-radius: 15px;
    border: 1.5px solid #f0eaff;
    background: linear-gradient(160deg, #ffffff 0%, #f5f0ff 100%);
    box-shadow: 0 2px 8px rgba(144,105,233,0.10);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

.menu-grid-btn:hover  { border-color: var(--utama); background: var(--utama-light); }
.menu-grid-btn:active { transform: scale(0.96); }

.menu-grid-icon {
    position: relative;
    width: 45px; height: 45px;
    flex-shrink: 0;
}

.menu-grid-icon::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 45px; height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c4a8ff 0%, #9b6dff 100%);
    box-shadow: 0 3px 10px rgba(124,58,237,0.18);
}

.menu-grid-icon img {
    position: absolute;
    bottom: 3px; left: 50%;
    transform: translateX(-50%);
    width: 48px; height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
    z-index: 1;
}

.menu-grid-icon:not(:has(img)) {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}

.menu-grid-icon:not(:has(img))::before { content: none; }

.menu-grid-btn span {
    font-size: 12px;
    font-weight: 700;
    color: var(--utama);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

/* ── IMAGE LIGHTBOX ────────────────────────────────────────── */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#lightbox.open { display: flex; }

#lightbox img {
    max-width: 94vw;
    max-height: 88vh;
    border-radius: 10px;
    animation: lb-in 0.18s ease;
}

@keyframes lb-in {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ── TOAST ─────────────────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 90px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 9px 18px;
    border-radius: 100px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
    z-index: 999;
    white-space: nowrap;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── PRE-CHAT FORM ─────────────────────────────────────────── */
#prechat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30,10,60,0.62);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#prechat-box {
    background: #fff;
    border-radius: 22px;
    padding: 26px 22px 22px;
    width: min(360px, 96%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.28);
    animation: prechat-in 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes prechat-in {
    from { transform: scale(0.92) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0);       opacity: 1; }
}

.pc-logo { text-align: center; margin-bottom: 18px; }

.pc-logo img {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(144,105,233,0.3);
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

.pc-logo h4 {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 10px;
}

.pc-logo p {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.5;
}

.pc-field { margin-bottom: 11px; }

.pc-field label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pc-field input {
    width: 100%;
    padding: 11px 15px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 12px;
    color: #111;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.pc-field input:focus {
    border-color: var(--utama);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(144,105,233,0.12);
}

.pc-field .pc-hint {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.pc-submit {
    width: 100%;
    padding: 12px;
    background: var(--utama);
    color: white;
    border: none;
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}

.pc-submit:hover    { background: var(--utama-dark); }
.pc-submit:active   { transform: scale(0.97); }
.pc-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── IMAGE PREVIEW MODAL ───────────────────────────────────── */
#img-preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.84);
    z-index: 8000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    padding: 20px;
}

#img-preview-modal.open { display: flex; }

#img-preview-thumb {
    max-width: 90vw;
    max-height: 62vh;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: lb-in 0.18s ease;
}

.preview-caption {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

.preview-btn-wrap {
    display: flex;
    gap: 12px;
}

.preview-btn {
    padding: 12px 32px;
    border-radius: 100px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, background 0.2s;
}

.preview-btn:active  { transform: scale(0.95); }
.preview-btn.cancel  { background: rgba(255,255,255,0.14); color: white; }
.preview-btn.send    { background: var(--utama); color: white; box-shadow: 0 3px 12px rgba(124,58,237,0.4); }

/* ── PRODUCT MODAL ─────────────────────────────────────────── */
#product-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
}

#product-modal.open { display: block; }

.pm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pm-sheet {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 22px 22px 0 0;
    height: 82dvh;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    animation: sheet-up 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
    overflow: hidden;
}

@keyframes sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.pm-handle {
    width: 36px; height: 4px;
    background: #ddd;
    border-radius: 100px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.pm-header {
    padding: 12px 18px 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    gap: 10px;
}

.pm-header h6 {
    font-size: 14px;
    font-weight: 700;
    color: var(--utama);
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.5;
}

.pm-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #aaa;
    cursor: pointer;
    padding: 3px;
    line-height: 1;
    transition: color 0.2s;
    align-self: flex-start;
    margin-top: 3px;
    flex-shrink: 0;
}

.pm-close:hover { color: #666; }

/* ── VIEWS WRAPPER ─────────────────────────────────────────── */
.pm-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
    height: 100%;
}

.pm-view {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 14px 14px 20px;
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease;
    -webkit-overflow-scrolling: touch;
}

.pm-view.hidden-left  { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.pm-view.hidden-right { transform: translateX(100%);  opacity: 0; pointer-events: none; }

/* ── PRODUCT CARDS ─────────────────────────────────────────── */
.prod-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.prod-card {
    border-radius: 14px;
    border: 1.5px solid #f0eaff;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(144,105,233,0.10);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.prod-card:active { transform: scale(0.97); }
.prod-card:hover  { border-color: var(--utama); transform: translateY(-2px); }

.prod-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #c4b5fd, #7c3aed);
}

.prod-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    letter-spacing: 1px;
}

.prod-info { padding: 8px 10px 10px; }

.prod-name {
    font-size: 11.5px;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prod-price-wrap  { display: flex; flex-direction: column; gap: 1px; }
.prod-price-ori   { font-size: 10px; color: #aaa; text-decoration: line-through; }
.prod-price-promo { font-size: 12px; font-weight: 700; color: var(--utama); }

/* ── TOPUP STAR LIST ───────────────────────────────────────── */
.star-list { display: flex; flex-direction: column; gap: 8px; }

.star-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid #f0eaff;
    background: #fff;
    box-shadow: 0 1px 4px rgba(144,105,233,0.08);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, border-color 0.15s;
}

.star-item:active   { background: #f5f0ff; transform: scale(0.98); }
.star-item:hover    { border-color: var(--utama); background: #faf8ff; }
.star-item.selected { border-color: var(--utama); background: var(--utama-light); }

.star-icon  { font-size: 22px; flex-shrink: 0; }
.star-info  { flex: 1; }
.star-name  { font-size: 12px; font-weight: 700; color: #222; }
.star-price { font-size: 12px; font-weight: 600; color: var(--utama); margin-top: 2px; }

.selected-badge {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--utama);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.2s, transform 0.2s;
}

.star-item.selected .selected-badge { opacity: 1; transform: scale(1); }

/* ── MODAL ACTIONS ─────────────────────────────────────────── */
.pm-actions {
    display: flex;
    gap: 9px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fff;
}

.pm-btn {
    flex: 1;
    padding: 12px 8px;
    border-radius: 100px;
    border: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s, background 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.pm-btn:active           { transform: scale(0.97); }
.pm-btn.primary          { background: var(--utama); color: white; box-shadow: 0 3px 10px rgba(124,58,237,0.3); }
.pm-btn.secondary        { background: #f0eaff; color: var(--utama); }
.pm-btn.green            { background: #25D366; color: white; box-shadow: 0 3px 10px rgba(37,211,102,0.3); }
.pm-btn.primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ── STEP BAR ──────────────────────────────────────────────── */
.step-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.step-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s;
    flex-shrink: 0;
}

.step-dot.active { background: var(--utama); width: 24px; border-radius: 4px; }
.step-dot.done   { background: #a78bfa; }

.step-label {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    margin-left: 4px;
}

/* ── ORDER FORM ────────────────────────────────────────────── */
.pay-back {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    cursor: pointer;
    color: var(--utama);
    font-size: 12px;
    font-weight: 600;
    background: none;
    border: none;
    font-family: inherit;
    padding: 0;
}

.order-summary {
    background: linear-gradient(135deg, #faf8ff, #f0eaff);
    border: 1.5px solid #e8e0ff;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.order-summary-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--utama);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.order-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 3px 0;
}

.order-summary-row .key       { color: #888; font-weight: 400; }
.order-summary-row .val       { color: #222; font-weight: 700; }
.order-summary-row .val.price { color: var(--utama); font-size: 15px; }

.form-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--utama);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 16px 0 8px;
}

.form-section-title:first-child { margin-top: 0; }

.form-field { margin-bottom: 12px; }

.form-field label {
    font-size: 11px;
    font-weight: 700;
    color: #555;
    display: block;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    color: #111;
    outline: none;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus {
    border-color: var(--utama);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(144,105,233,0.12);
}

.form-field input.error { border-color: #ef4444; }

.form-hint {
    font-size: 10.5px;
    color: #aaa;
    margin-top: 4px;
    line-height: 1.4;
}

/* ── PAYMENT METHOD ────────────────────────────────────────── */
.pay-method-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
}

.pay-method-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 2px solid #f0eaff;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.pay-method-card:active  { transform: scale(0.98); }
.pay-method-card.selected {
    border-color: var(--utama);
    background: var(--utama-light);
}

.pay-method-icon { font-size: 28px; flex-shrink: 0; }
.pay-method-info { flex: 1; }
.pay-method-name { font-size: 12px; font-weight: 700; color: #222; }
.pay-method-desc { font-size: 11px; color: #888; margin-top: 2px; }

.pay-method-check {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid #ddd;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pay-method-card.selected .pay-method-check {
    background: var(--utama);
    border-color: var(--utama);
    color: white;
    font-size: 12px;
}

/* ── PAYMENT DETAIL CARD ───────────────────────────────────── */
.payment-detail-card {
    border-radius: 16px;
    overflow: hidden;
    border: 1.5px solid #f0eaff;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(144,105,233,0.10);
}

.payment-detail-header {
    background: linear-gradient(135deg, var(--utama), var(--utama-dark));
    padding: 14px 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.payment-detail-header .icon   { font-size: 24px; }
.payment-detail-header .info h6 { font-size: 12px; font-weight: 700; margin: 0; }
.payment-detail-header .info p  { font-size: 11px; opacity: 0.85; margin: 2px 0 0; }
.payment-detail-body            { padding: 14px 16px; }

/* ── QRIS ──────────────────────────────────────────────────── */
.qris-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.qris-img {
    width: 180px; height: 180px;
    border-radius: 12px;
    border: 3px solid var(--utama-light);
    object-fit: contain;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.qris-amount { font-size: 22px; font-weight: 700; color: var(--utama); }
.qris-note   { font-size: 11px; color: #888; text-align: center; line-height: 1.5; }

/* ── BANK / E-WALLET LIST ──────────────────────────────────── */
.bank-list { display: flex; flex-direction: column; gap: 8px; }

.bank-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
}

.bank-item-left { display: flex; align-items: center; gap: 10px; }
.bank-icon      { font-size: 22px; }
.bank-name      { font-size: 12px; font-weight: 700; color: #333; }
.bank-number    { font-size: 15px; font-weight: 700; color: var(--utama); letter-spacing: 1px; }
.bank-holder    { font-size: 10px; color: #888; margin-top: 1px; }

.copy-btn {
    padding: 6px 12px;
    border-radius: 100px;
    border: 1.5px solid var(--utama);
    background: white;
    color: var(--utama);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.copy-btn:active { background: var(--utama); color: white; }

.amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--utama-light);
    margin-top: 10px;
}

.amount-label { font-size: 12px; color: #666; font-weight: 600; }
.amount-value { font-size: 18px; font-weight: 700; color: var(--utama); }

/* ── UPLOAD AREA ───────────────────────────────────────────── */
.upload-area {
    border: 2px dashed #c4b5fd;
    border-radius: 16px;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: center;
    background: #faf8ff;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 14px;
}

.upload-area:hover    { border-color: var(--utama); background: var(--utama-light); }
.upload-area.has-file { border-style: solid; border-color: var(--utama); }

.upload-icon     { font-size: 36px; }
.upload-title    { font-size: 14px; font-weight: 700; color: #333; }
.upload-subtitle { font-size: 12px; color: #888; }

.upload-preview {
    width: 100%;
    max-height: 200px;
    border-radius: 10px;
    object-fit: contain;
    display: none;
}

.upload-area.has-file .upload-preview  { display: block; }
.upload-area.has-file .upload-icon,
.upload-area.has-file .upload-title,
.upload-area.has-file .upload-subtitle { display: none; }

/* ── SUCCESS VIEW ──────────────────────────────────────────── */
.success-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 20px;
    height: 100%;
}

.success-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ade80, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin-bottom: 18px;
    box-shadow: 0 8px 24px rgba(74,222,128,0.4);
    animation: pop-in 0.4s cubic-bezier(0.34, 1.6, 0.64, 1);
}

@keyframes pop-in {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.success-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 8px; }
.success-desc  { font-size: 12px; color: #666; line-height: 1.6; margin-bottom: 22px; }

/* ── TOMBOL TUTUP 3D ───────────────────────────────────────── */
.btn-tutup-3d {
    width: auto !important;
    flex: none !important;
    min-width: 180px !important;
    max-width: 240px !important;
    padding: 12px 39px !important;
    font-size: 15.9px !important;
    font-weight: 700 !important;
    border-radius: 15px !important;
    letter-spacing: 0.03em;
    margin-top: 9px;
    position: relative;
    top: 0;
    background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 60%, #6d28d9 100%) !important;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.39) inset,
        0 -2px 0 rgba(0,0,0,0.27) inset,
        0 5px 0 #4c1d95,
        0 8px 18px rgba(109,40,217,0.45),
        0 2px 4px rgba(0,0,0,0.18) !important;
    transition: transform 0.1s ease, box-shadow 0.1s ease !important;
}

.btn-tutup-3d:hover {
    background: linear-gradient(180deg, #c4b5fd 0%, #8b5cf6 60%, #7c3aed 100%) !important;
}

.btn-tutup-3d:active {
    transform: translateY(4px) !important;
    top: 3px;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.25) inset,
        0 -1px 0 rgba(0,0,0,0.3) inset,
        0 1px 0 #4c1d95,
        0 3px 9px rgba(109,40,217,0.3) !important;
}

/* ── ORDER TOAST ───────────────────────────────────────────── */
#order-toast {
    position: fixed;
    bottom: 100px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 9px 18px;
    border-radius: 100px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9999;
    white-space: nowrap;
    pointer-events: none;
}

#order-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── QUICK REPLY BUTTONS ───────────────────────────────────── */
.qr-grid-wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 9px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.qr-grid-wrap::-webkit-scrollbar { display: none; }

.qr-text-btn {
    padding: 8px 16px;
    border-radius: 100px;
    border: 1.5px solid var(--utama);
    background: white;
    color: var(--utama);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    white-space: nowrap;
}

.qr-text-btn:hover  { background: var(--utama-light); }
.qr-text-btn:active { transform: scale(0.96); background: var(--utama); color: white; }

/* ── QUICK MENU PERSISTENT ─────────────────────────────────── */
#quick-menu {
    flex: 0 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(144,105,233,0.09);
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: max-height 0.2s ease;
}


#quick-menu:empty          { display: none; border-top: none; }
#quick-menu::-webkit-scrollbar { display: none; }

#quick-menu .qr-grid-wrap {
    padding: 7px 12px 9px 12px;
}
/* ── PRECHAT SELECT ────────────────────────────────────────── */
.pc-select {
    width: 100%;
    padding: 11px 15px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 12px;
    color: #111;
    background: #fafafa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%239069e9' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 14px center;
    background-size: 18px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pc-select:focus {
    border-color: var(--utama);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(144,105,233,0.39);
}