/* =====================================================================
   COVER BERKAS - tampilan kartu informasi yang hanya berisi berkas
   (tanpa foto). Dibuat oleh includes/cover_berkas.php dan
   js/cover-berkas.js. Dipakai halaman masyarakat dan halaman admin.
   ===================================================================== */

.cover-berkas {
    --cb-aksen: #166534;
    --cb-aksen-muda: #dcfce7;
    --cb-bg-1: #f0fdf4;
    --cb-bg-2: #dcfce7;

    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    container-type: size;
    background: linear-gradient(135deg, var(--cb-bg-1), var(--cb-bg-2));
}

/* Warna menurut jenis berkas */
.cover-berkas.cb-pdf   { --cb-aksen: #dc2626; --cb-aksen-muda: #fee2e2; --cb-bg-1: #fef2f2; --cb-bg-2: #fee2e2; }
.cover-berkas.cb-word  { --cb-aksen: #2563eb; --cb-aksen-muda: #dbeafe; --cb-bg-1: #eff6ff; --cb-bg-2: #dbeafe; }
.cover-berkas.cb-excel { --cb-aksen: #15803d; --cb-aksen-muda: #dcfce7; --cb-bg-1: #f0fdf4; --cb-bg-2: #d1fae5; }
.cover-berkas.cb-ppt   { --cb-aksen: #ea580c; --cb-aksen-muda: #ffedd5; --cb-bg-1: #fff7ed; --cb-bg-2: #ffedd5; }
.cover-berkas.cb-teks  { --cb-aksen: #475569; --cb-aksen-muda: #e2e8f0; --cb-bg-1: #f8fafc; --cb-bg-2: #e2e8f0; }
.cover-berkas.cb-zip   { --cb-aksen: #b45309; --cb-aksen-muda: #fef3c7; --cb-bg-1: #fffbeb; --cb-bg-2: #fef3c7; }

/* Pada kartu admin, cover mengisi kotak gambar */
.informasi-image > .cover-berkas {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
}

/* ---------- Lembar kertas ---------- */
.cb-tumpuk {
    position: relative;
    height: 84%;
    height: 84cqh;
    aspect-ratio: 210 / 297;
    margin-top: -5%;
    transition: transform 0.25s ease;
}

.cb-tumpuk.cb-slide {
    height: auto;
    width: 72%;
    width: 72cqw;
    aspect-ratio: 16 / 9;
}

.cover-berkas:hover .cb-tumpuk {
    transform: translateY(-2px);
}

.cb-lembar,
.cb-bayang {
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 14px 26px -12px rgba(15, 35, 26, 0.45), 0 0 0 1px rgba(15, 35, 26, 0.07);
}

.cb-lembar {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 11px;
    font-size: clamp(7px, 3.5cqh, 14px);
    color: #374151;
}

/* Lembar di belakang bila berkasnya lebih dari satu */
.cb-bayang {
    position: absolute;
    inset: 0;
    box-shadow: 0 6px 14px -8px rgba(15, 35, 26, 0.4), 0 0 0 1px rgba(15, 35, 26, 0.06);
}

.cb-bayang.b1 { transform: rotate(-6deg) translateX(-5%); }
.cb-bayang.b2 { transform: rotate(5deg) translateX(5%); }

/* Pita jenis berkas di bagian atas lembar */
.cb-pita {
    display: flex;
    align-items: center;
    flex: none;
    padding: 0.55em 0.9em;
    background: var(--cb-aksen);
    color: #fff;
    font-weight: 800;
    font-size: 0.92em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- Isi pratinjau ---------- */
.cb-konten {
    position: relative;
    flex: 1;
    min-height: 0;
    padding: 0.9em 1em 0;
    overflow: hidden;
}

/* Pudar di bawah agar potongan teks tidak terlihat kasar */
.cb-konten::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 28%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 85%);
    pointer-events: none;
}

.cb-judul {
    margin: 0 0 0.6em;
    color: #111827;
    font-size: 1.15em;
    font-weight: 800;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.cb-slide .cb-judul {
    color: var(--cb-aksen);
    font-size: 1.3em;
}

.cb-baris {
    margin: 0 0 0.35em;
    color: #4b5563;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-berkas {
    margin: 0 0 0.4em;
    padding-left: 1.5em;
    position: relative;
    color: #4b5563;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-berkas::before {
    content: "";
    position: absolute;
    left: 0.1em;
    top: 0.1em;
    width: 0.8em;
    height: 1em;
    border-radius: 1px;
    background: var(--cb-aksen-muda);
    border: 1px solid var(--cb-aksen);
}

/* Tabel mini (Excel / CSV) */
.cb-tabel {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.92em;
}

.cb-tabel th,
.cb-tabel td {
    padding: 0.25em 0.45em;
    border: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

.cb-tabel th {
    background: var(--cb-aksen-muda);
    color: #111827;
    font-weight: 700;
}

.cb-tabel td.cb-tajuk {
    padding: 0 0 0.5em;
    border: 0;
    color: #111827;
    font-size: 1.1em;
    font-weight: 800;
}

/* Garis kerangka bila isi berkas tidak bisa dibaca */
.cb-garis {
    display: block;
    height: 0.62em;
    margin-bottom: 0.7em;
    border-radius: 99px;
    background: #e5e7eb;
}

.cb-garis.tebal { height: 0.9em; background: var(--cb-aksen-muda); }
.cb-garis.w50 { width: 50%; }
.cb-garis.w60 { width: 60%; }
.cb-garis.w70 { width: 70%; }
.cb-garis.w80 { width: 80%; }
.cb-garis.w85 { width: 85%; }
.cb-garis.w90 { width: 90%; }

/* ---------- PDF: halaman pertama ---------- */
.cb-kanvas {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    background: #fff;
}

.cover-berkas.cb-siap .cb-kanvas {
    display: block;
}

.cover-berkas.cb-siap .cb-konten {
    visibility: hidden;
}

/* Setelah halaman PDF tampil, pita menjadi label kecil di pojok */
.cover-berkas.cb-siap .cb-pita {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    padding: 0.3em 0.8em;
    border-radius: 4px 0 6px 0;
    font-size: 0.8em;
}

/* ---------- Nama berkas di bawah cover ---------- */
.cb-nama {
    position: absolute;
    left: 50%;
    bottom: 4%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 88%;
    padding: 4px 11px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(15, 35, 26, 0.08);
    border-radius: 999px;
    box-shadow: 0 6px 14px -8px rgba(15, 35, 26, 0.5);
    color: #1f2937;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
}

.cb-nama svg {
    flex: none;
    color: var(--cb-aksen);
}

.cb-nama-teks {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cb-lagi {
    flex: none;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--cb-aksen);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .cb-tumpuk { transition: none; }
}
