/* Popup "Customer Posts" bersama - dipakai beranda, /customer_post, dan halaman
 * produk. Markup + JS: application/modules/customer_post/views/popup.php dan
 * assets/js/customer_post_popup.js. Kelas cp-* hanya untuk popup ini.
 * Konten dibuat hanya untuk post yang dibuka. -Y */
/* One responsive Customer Posts popup is shared by desktop and mobile. */
.overlay.show-customer-post {
    position: fixed;
    inset: 0;
    z-index: 10004;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px 40px;
    overflow: hidden;
    background: rgba(0, 0, 0, .7);
}
.overlay.show-customer-post .cp-content {
    width: 100%;
    height: auto;
}
body.cp-open { overflow: hidden; }
[data-cp-id]:focus-visible,
.cp-modal :focus-visible { outline: 2px solid #E2072C; outline-offset: 3px; }
.cp-modal {
    position: relative;
    width: 100%;
    max-width: 1180px;
    color: #333;
}
.cp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.cp-close:hover { background: #E2072C; color: #fff; }
/* Kartu desktop diperbesar (2026-09-07): maks 1180px, foto separuh kartu
   dan ditampilkan utuh (object-fit contain, latar abu), kolom isi bergulir
   sendiri bila caption + daftar produk lebih tinggi dari foto. */
.cp-view {
    display: flex;
    overflow: hidden;
    max-height: calc(100vh - 48px);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .14);
}
.cp-foto { flex: 0 0 50%; max-width: 50%; background: #f6f6f8; }
.cp-foto a { display: block; height: 100%; }
.cp-foto img {
    width: 100%;
    height: 100%;
    min-height: min(560px, calc(100vh - 48px));
    max-height: calc(100vh - 48px);
    object-fit: contain;
    display: block;
}
.cp-isi {
    flex: 1 1 auto;
    min-width: 0;
    padding: 26px 30px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
}
.cp-user { margin-bottom: 12px; font-family: "PoppinsSemiBold"; font-size: 14px; }
.cp-user a { color: #333; text-decoration: underline !important; }
.cp-user i,
.cp-user svg { margin-right: 3px; color: #E2072C; fill: #E2072C; }
.cp-user svg { width: .8em; height: auto; }
.cp-bubble {
    position: relative;
    max-height: 260px;
    margin: 0 0 18px;
    padding: 12px 15px;
    overflow-y: auto;
    border-radius: 4px 14px 14px 14px;
    background: #f6f6f8;
    color: #333;
    font-size: 13.5px;
    line-height: 1.55;
    scrollbar-width: thin;
    white-space: pre-line;
}
.cp-label { margin: auto 0 8px; color: #7a7a7a; font-family: "PoppinsSemiBold"; font-size: 12.5px; }
/* daftar kartu produk: satu post bisa punya beberapa produk */
.cp-produk-list { display: flex; flex-direction: column; gap: 8px; }
.cp-produk {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid #ececef;
    border-radius: 12px;
    color: #333;
    transition: box-shadow .15s ease;
}
.cp-produk:hover { color: #333; box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }
.cp-produk-img { position: relative; flex: 0 0 86px; }
.cp-produk-img .produk {
    width: 86px;
    height: 86px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.cp-produk-logo {
    position: absolute;
    top: 4px;
    left: 4px;
    width: auto;
    max-width: 30px;
    height: 14px;
    object-fit: contain;
}
.cp-badge-habis {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    color: #555;
    font-family: "PoppinsSemiBold";
    font-size: 10px;
    text-align: center;
}
.cp-produk-info { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.cp-produk-nama {
    display: -webkit-box;
    margin-bottom: 3px;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 12.5px;
    word-break: break-word;
}
.cp-produk-harga { font-family: "PoppinsBold"; font-size: 15px; }
.cp-produk-disc { display: flex; gap: 7px; align-items: center; margin-top: 2px; }
.cp-strike { position: relative; color: #aeabb3; font-size: 12px; }
.cp-strike::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -2px;
    left: -2px;
    border-top: 2px solid #FF0000;
    transform: translateY(-50%);
}
.cp-disc {
    padding: 2px 4px;
    background: #EB0000;
    color: #fff;
    font-family: "PoppinsSemiBold";
    font-size: 11px;
    line-height: 1.2;
}
.cp-disc-special {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 5px;
    background: #ffd8de;
    color: #E2072C;
    font-family: "PoppinsSemiBold";
    font-size: 11px;
}
.cp-produk-meta { display: flex; gap: 8px; align-items: center; margin-top: 5px; color: #7a7a7a; font-size: 11px; }
.cp-chip { padding: 1px 8px; border: 1px solid #ececef; border-radius: 999px; font-size: 10.5px; }
/* HP/tablet (2026-09-07): popup memenuhi layar DI BAWAH header situs -
   jarak atasnya (--cp-top) diukur JS dari tinggi header saat dibuka.
   Foto tampil utuh selebar layar (tinggi mengikuti gambar, tidak
   dipotong), isi digulir vertikal, tombol tutup menempel di kanan atas. */
@media (max-width: 768px) {
    .overlay.show-customer-post {
        top: var(--cp-top, 0px);
        height: auto;
        padding: 0;
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    /* lembar putih = .cp-modal (min-height penuh); latar overlay tetap gelap
       supaya sisa area di bawah konten pendek tidak memperlihatkan halaman */
    .cp-modal { max-width: none; min-height: 100%; background: #fff; }
    .cp-close { position: fixed; top: calc(var(--cp-top, 0px) + 10px); right: 10px; }
    .cp-view { flex-direction: column; max-height: none; overflow: visible; border-radius: 0; box-shadow: none; }
    .cp-foto { flex: 0 0 auto; max-width: 100%; }
    .cp-foto img { height: auto; min-height: 0; max-height: none; }
    .cp-isi { padding: 18px 16px 28px; overflow: visible; }
    .cp-bubble { max-height: none; overflow: visible; }
    .cp-label { margin-top: 0; }
}
