/* ==========================================================================
   ui.css — komponen tambahan untuk front-end yang dikendalikan server.
   (CSS utama aplikasi tetap ada di dalam main.php, tidak diubah)
   Palet mengikuti yang sudah ada: #667eea -> #764ba2, abu #f5f5f5, radius 12px
   ========================================================================== */

.header-sub {
    font-size: 11px;
    color: #999;
    margin-left: 8px;
    font-weight: normal;
}

/* ---------- judul section + tombol muat lagi ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.section-note {
    font-size: 11px;
    color: #999;
}

.btn-load {
    display: block;
    width: 100%;
    margin: 12px 0 20px;
    padding: 10px;
    border: 1px dashed #c9c9d6;
    border-radius: 10px;
    background: #fafaff;
    color: #6a5acd;
    font-size: 13px;
    cursor: pointer;
}

.btn-load:hover { background: #f2f0ff; }
.btn-load[disabled] { opacity: .5; cursor: default; }

/* ---------- pesan dari server di dalam modal ---------- */
.flow-status {
    display: none;
    margin-bottom: 12px;
    padding: 9px 12px;
    border-left: 3px solid #667eea;
    background: #f4f3ff;
    color: #4b4b6a;
    font-size: 12.5px;
    border-radius: 8px;
    line-height: 1.45;
}

.flow-status.show { display: block; }
.flow-status.err { border-left-color: #e74c3c; background: #fdf1f0; color: #a3352b; }
.flow-status .fs-action { color: #8e8ea8; font-size: 11px; display: block; margin-top: 3px; }

/* ---------- baris info (kolom read-only hasil pilihan sebelumnya) ---------- */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    font-size: 13px;
}

.info-label { color: #8a8a9e; }
.info-value { color: #2d2d3a; font-weight: 600; text-align: right; word-break: break-all; }

/* ---------- bantuan / catatan pada input ---------- */
.field-help { font-size: 11.5px; color: #8a8a9e; margin-top: 5px; line-height: 1.45; }
.field-note { font-size: 11.5px; color: #b07d2b; margin-top: 5px; line-height: 1.45; }

.form-input.invalid, .form-select.invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, .12);
}

/* ---------- stepper qty ---------- */
.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e4e4ee;
    border-radius: 10px;
    overflow: hidden;
}

.qty-stepper button {
    width: 38px;
    height: 38px;
    border: 0;
    background: #f7f7fc;
    color: #4b4b6a;
    font-size: 18px;
    cursor: pointer;
}

.qty-stepper button:hover { background: #efeffa; }
.qty-stepper input {
    width: 54px;
    height: 38px;
    border: 0;
    text-align: center;
    font-size: 15px;
    color: #2d2d3a;
}

/* ---------- radio list (daftar pendek dari server) ---------- */
.radio-list { display: flex; flex-direction: column; gap: 8px; }

.radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #e8e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 13.5px;
    color: #2d2d3a;
}

.radio-item input { accent-color: #667eea; }
.radio-item em { margin-left: auto; font-style: normal; color: #667eea; font-weight: 600; }
.radio-item.selected { border-color: #667eea; background: #f6f5ff; }

/* ---------- tombol gaya telegram (paginasi + checklist) ---------- */
.tg {
    border: 1px solid #ececf5;
    border-radius: 12px;
    padding: 10px;
    background: #fbfbff;
}

.tg-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

.tg-search {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e4e4ee;
    border-radius: 9px;
    font-size: 13px;
    background: #fff;
}

.tg-count { font-size: 11px; color: #8a8a9e; white-space: nowrap; }

.tg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 7px;
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tg-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid #e4e4ee;
    border-radius: 10px;
    background: #fff;
    color: #2d2d3a;
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
}

.tg-btn em { font-style: normal; font-size: 11px; color: #9a9ab0; }

.tg-btn:hover { border-color: #b9b3f0; background: #f8f7ff; }

.tg-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.tg-btn.selected em { color: #e6e3ff; }

.tg-btn .tg-check { display: none; float: right; }
.tg-btn.selected .tg-check { display: inline; }

.tg-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 9px;
}

.tg-pager button {
    padding: 7px 12px;
    border: 1px solid #e4e4ee;
    border-radius: 9px;
    background: #fff;
    color: #4b4b6a;
    font-size: 12px;
    cursor: pointer;
}

.tg-pager button:hover:not([disabled]) { border-color: #667eea; color: #667eea; }
.tg-pager button[disabled] { opacity: .4; cursor: default; }
.tg-page { font-size: 11.5px; color: #8a8a9e; }

/* ---------- tombol di pratinjau: 3 tombol, biar rapi ---------- */
.preview-actions { flex-wrap: wrap; }
.preview-actions .btn-secondary,
.preview-actions .btn-primary { flex: 1 1 42%; min-width: 110px; }

/* ---------- tombol yang dimatikan server harus kelihatan mati ---------- */
.btn-primary[disabled], .btn-secondary[disabled] { opacity: .45; cursor: default; }

/* ---------- panel pratinjau: harus DI ATAS modal pembelian (z-index 3000) ---------- */
.order-preview { z-index: 3100; }

/* ---------- tombol kembali satu langkah (di kanan header modal) ---------- */
.btn-back {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid #e4e4ee;
    border-radius: 999px;
    background: #fff;
    color: #4b4b6a;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-back:hover { border-color: #667eea; color: #667eea; }

.purchase-header .btn-back { margin-left: auto; }   /* selalu di kanan judul */

/* ---------- rincian jumlah di keranjang (qty × harga satuan) ---------- */
.cart-item-qty {
    font-size: 11.5px;
    color: #6b6b85;
    margin-bottom: 3px;
}

/* ---------- (blok "detail teknis" sudah dihapus: data mentah tidak pernah
   dirender, hanya tersedia di console lewat TOKO_TERAKHIR / TOKO_LOG) ---------- */

/* ---------- pratinjau bawah tidak boleh menutupi kolom terakhir (qty) ----------
   .purchase-modal yang menggulir, jadi ruangnya ditaruh sebagai elemen kosong
   DI DALAM area gulir (#previewSpacer) yang tingginya diisi app.js sesuai
   tinggi panel pratinjau. */
.preview-spacer { height: 0; }

/* ---------- spinner kecil ---------- */
.spin {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid #d9d6f5;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: -2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- kartu hasil order ---------- */
.order-card {
    border: 1px solid #e8e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}

.order-card.ok { border-left: 4px solid #2ecc71; }
.order-card.fail { border-left: 4px solid #e74c3c; }

.order-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    padding: 3px 0;
    color: #4b4b6a;
}

.order-row b { color: #2d2d3a; font-weight: 600; text-align: right; word-break: break-all; }
.order-uuid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

/* ---------- panel daftar produk per kategori ---------- */
.cat-panel { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #e8e8f0;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.cat-item:hover { border-color: #667eea; background: #f8f7ff; }
.cat-item-icon { font-size: 20px; }
.cat-item-body { flex: 1; }
.cat-item-name { font-size: 13.5px; color: #2d2d3a; font-weight: 600; }
.cat-item-desc { font-size: 11.5px; color: #9a9ab0; }
.cat-item-price { font-size: 12.5px; color: #667eea; font-weight: 600; white-space: nowrap; }
