/*
 * docx2html.css — tampilan antarmuka web docx2html
 * ================================================
 * Memuat gaya untuk: halaman kesalahan, beranda (formulir unggah + "File Terbaru"), halaman unduh,
 * dan lapisan animasi konversi. Berkas ini dimuat lewat <link rel="stylesheet"> oleh uiHead() di
 * docx2html.php; letakkan di folder assets/ di samping index.php / docx2html.php.
 *
 * - Warna dan ukuran utama ada di :root (ubah --brand / --brand2 untuk mengganti warna merek).
 * - Logo merek di header adalah berkas assets/logo-docx2html.svg yang dimuat lewat <img> (.brand img).
 * - Halaman sengaja tidak memakai gaya sebaris (style="..."): CSP server mengatur style-src 'self',
 *   jadi semua gaya harus ada di berkas ini.
 * - Tata letak responsif: lebar memakai min()/clamp(); kolom runtuh menjadi satu di bawah 560px.
 */

:root {
  color-scheme: light;
  --ink: #0f172a;
  --mute: #475569;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand2: #1d4ed8;
  --ok: #16a34a;
  --err: #dc2626;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(900px 500px at 10% 0%, #1e3a5f 0%, transparent 60%),
              radial-gradient(700px 500px at 95% 100%, #1d4ed8 0%, transparent 55%),
              #0f172a;
}

.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.topbar {
  width: min(100%, 760px);
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  width: min(100%, 640px);
  padding: clamp(1.3rem, 4vw, 2.2rem);
}

main.card {
  width: min(100%, 760px);
}

h1 {
  font-size: clamp(1.3rem, 4.5vw, 1.75rem);
  margin: 0 0 .4rem;
  color: var(--ink);
}

h2 {
  font-size: 1.15rem;
  margin: 0;
}

p {
  line-height: 1.6;
}

p.sub {
  color: var(--mute);
  font-size: clamp(.88rem, 2.8vw, .97rem);
  margin: .2rem 0 1.2rem;
}

.hint {
  color: var(--mute);
  font-size: .85rem;
  margin: 0 0 1rem;
}

code {
  background: #f1f5f9;
  border-radius: 6px;
  padding: .1rem .35rem;
  font-size: .9em;
  word-break: break-word;
}

/* --- tombol --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .85rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: clamp(.95rem, 3vw, 1.05rem);
  font-family: inherit;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform .15s, background .15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand2);
}

.btn-ghost {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .4);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, .22);
  transform: none;
}

.btn-light {
  background: #f1f5f9;
  color: var(--ink);
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

/* --- logo / merek (berkas assets/logo-docx2html.svg) --- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
}

.brand img {
  width: 38px;
  height: 38px;
  flex: none;
  display: block;
}

.bname {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: .01em;
}

.bname b {
  color: #93c5fd;
  font-weight: 800;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.hero .brand img {
  width: 60px;
  height: 60px;
}

.hero .bname {
  font-size: clamp(1.6rem, 6vw, 2.1rem);
}

.btag {
  margin: 0;
  color: #cbd5e1;
  font-size: clamp(.86rem, 2.8vw, .95rem);
}

/* --- beranda: formulir unggah --- */
.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  border: 2px dashed #94a3b8;
  border-radius: 14px;
  padding: clamp(1.2rem, 5vw, 2rem);
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, background .2s, transform .2s;
}

.drop:hover,
.drop.over {
  border-color: var(--brand);
  background: #eff6ff;
  transform: scale(1.01);
}

.drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop b {
  font-size: clamp(.95rem, 3vw, 1.05rem);
}

.drop span {
  color: var(--mute);
  font-size: clamp(.82rem, 2.7vw, .9rem);
}

.feat {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.feat li {
  font-size: .8rem;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 999px;
  padding: .3rem .7rem;
}

#sum {
  font-weight: 600;
  margin: 1rem 0 .5rem;
  font-size: .95rem;
}

.flist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  max-height: 34vh;
  overflow: auto;
}

.flist li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: .6rem;
  align-items: center;
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: .9rem;
}

.flist .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.flist .sz {
  color: var(--mute);
  white-space: nowrap;
}

.flist .rm {
  border: 0;
  background: #fee2e2;
  color: #991b1b;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

.notice {
  margin: .8rem 0 0;
  padding: .7rem .9rem;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: .85rem;
  line-height: 1.5;
}

.go {
  margin-top: 1.2rem;
}

.note {
  margin: 1.2rem 0 0;
  font-size: .8rem;
  color: var(--mute);
  line-height: 1.6;
}

.note code.cli {
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
  vertical-align: bottom;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.2rem;
}

/* umpan (honeypot): tak terlihat, bot akan mengisinya */
.hp {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  left: 0;
  top: 0;
}

/* --- riwayat / file terbaru --- */
.recent {
  margin-top: 1rem;
}

.rhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .4rem .8rem;
  flex-wrap: wrap;
  margin-bottom: .7rem;
}

.rnote {
  color: var(--mute);
  font-size: .8rem;
}

.rlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .6rem;
}

.ritem {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .9rem;
  align-items: center;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.ritem.err {
  border-color: #fecaca;
  background: #fff7f7;
}

.ritem .ficon {
  width: 36px;
  height: 42px;
  border-radius: 6px;
  font-size: .56rem;
}

.ritem .faction {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 0;
}

.ritem .btn,
.del .btn {
  padding: .55rem .85rem;
  font-size: .86rem;
  border-radius: 9px;
}

.rempty {
  margin: 0;
  color: var(--mute);
  font-size: .9rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: .9rem 1rem;
  text-align: center;
}

.rmsg {
  margin-top: .7rem;
  padding: .7rem .9rem;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: .85rem;
}

/* --- halaman unduh --- */
.files {
  display: grid;
  gap: .9rem;
}

.fcard {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  animation: rise .4s ease-out both;
}

/* kartu hasil muncul bergantian (70 ms per kartu; maksimal 10 file = 10 kartu) */
.fcard:nth-child(2) { animation-delay: 70ms; }
.fcard:nth-child(3) { animation-delay: 140ms; }
.fcard:nth-child(4) { animation-delay: 210ms; }
.fcard:nth-child(5) { animation-delay: 280ms; }
.fcard:nth-child(6) { animation-delay: 350ms; }
.fcard:nth-child(7) { animation-delay: 420ms; }
.fcard:nth-child(8) { animation-delay: 490ms; }
.fcard:nth-child(9) { animation-delay: 560ms; }
.fcard:nth-child(10) { animation-delay: 630ms; }

.fcard.err {
  border-color: #fecaca;
  background: #fff7f7;
}

.ficon {
  width: 48px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(160deg, #eff6ff, #dbeafe);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #1d4ed8;
  font-size: .72rem;
}

.fcard.err .ficon,
.ritem.err .ficon {
  background: #fee2e2;
  color: #991b1b;
}

.fmain {
  min-width: 0;
  word-break: break-word;
}

.fname {
  font-weight: 600;
}

.pill {
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  vertical-align: middle;
  margin-left: .4rem;
  white-space: nowrap;
}

.pill.err {
  background: #fee2e2;
  color: #991b1b;
}

.fmeta {
  color: var(--mute);
  font-size: .88rem;
  margin-top: .2rem;
}

.fstats {
  font-size: .85rem;
  margin-top: .3rem;
}

.warn {
  margin-top: .4rem;
  font-size: .85rem;
  color: #92400e;
}

.warn ul {
  margin: .3rem 0 0;
  padding-left: 1.1rem;
}

.faction {
  margin-top: .7rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

.gone {
  text-align: center;
  padding: 1.5rem .5rem;
}

/* --- halaman kesalahan (fail) --- */
.errpage h1 {
  color: #b91c1c;
}

/* --- lapisan animasi konversi --- */
.ov {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .82);
  backdrop-filter: blur(6px);
}

.ov[hidden] {
  display: none;
}

.ovcard {
  --p: 0;
  width: min(94vw, 540px);
  max-height: 94vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: clamp(1.1rem, 4vw, 1.8rem);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: pop .35s ease-out;
  text-align: center;
}

.scene {
  position: relative;
  width: 84px;
  height: 104px;
  margin: 0 auto 1rem;
}

.sheet {
  position: absolute;
  inset: 0;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
}

.sheet::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 14px;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  box-shadow: 0 16px 0 #e2e8f0, 0 32px 0 #e2e8f0, 0 48px 0 #e2e8f0;
}

.scan {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0), rgba(37, 99, 235, .4), rgba(37, 99, 235, 0));
  animation: scan 1.6s ease-in-out infinite;
}

.sym {
  position: absolute;
  font: 700 15px/1 'Times New Roman', serif;
  color: #1d4ed8;
  opacity: 0;
  animation: blip 1.6s ease-in-out infinite;
}

.s1 { left: -22px; top: 10px; }
.s2 { right: -22px; top: 34px; animation-delay: .4s; }
.s3 { left: -20px; bottom: 14px; animation-delay: .8s; }
.s4 { right: -20px; bottom: 6px; animation-delay: 1.2s; }

.ringrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}

.ring {
  flex: none;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e2e8f0 0);
  display: grid;
  place-items: center;
  position: relative;
  transition: background .3s;
}

.ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fff;
}

.ring b {
  position: relative;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.indet .ring {
  background: conic-gradient(transparent 0 70%, var(--brand) 85%, #93c5fd 100%);
  animation: spin 1s linear infinite;
}

.stage {
  min-width: 0;
}

.stage p {
  margin: .2rem 0 0;
  color: var(--mute);
  font-size: .92rem;
}

.stage .cur {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 1rem 0 0;
}

.bar i {
  display: block;
  height: 100%;
  width: calc(var(--p) * 1%);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #60a5fa);
  transition: width .35s ease;
}

.indet .bar i {
  width: 35% !important;
  animation: slide 1.1s ease-in-out infinite;
}

.steps {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  display: grid;
  gap: .5rem;
  text-align: left;
}

.steps li {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #94a3b8;
  font-size: .93rem;
  transition: color .25s;
}

.steps .ic {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 700;
}

.steps li.on {
  color: var(--ink);
}

.steps li.on .ic {
  border-color: var(--brand);
  color: var(--brand);
  animation: pulse 1s ease-in-out infinite;
}

.steps li.ok {
  color: var(--ok);
}

.steps li.ok .ic {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
  animation: pop .3s ease-out;
}

.ovfiles {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  max-height: 26vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}

.ovfiles li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .55rem;
  align-items: center;
  padding: .5rem .7rem;
  border-top: 1px solid var(--line);
  font-size: .88rem;
}

.ovfiles li:first-child {
  border-top: 0;
}

.ovfiles .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ovfiles .st {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .65rem;
  color: #fff;
  flex: none;
}

.ovfiles .st.work {
  border-color: var(--brand);
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}

.ovfiles .st.done {
  background: var(--ok);
  border-color: var(--ok);
}

.ovfiles .st.done::after {
  content: "✓";
}

.ovfiles .st.error {
  background: var(--err);
  border-color: var(--err);
}

.ovfiles .st.error::after {
  content: "✕";
}

.ovfiles .mini {
  grid-column: 2/4;
  height: 4px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}

.ovfiles .mini i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .3s;
}

.ovmsg {
  margin-top: 1rem;
  padding: .9rem;
  border-radius: 12px;
  background: #fef2f2;
  color: #991b1b;
  font-size: .92rem;
  text-align: left;
}

.ovmsg .actions {
  margin-top: .7rem;
}

/* --- animasi --- */
@keyframes scan {
  0%, 100% { top: 4px; }
  50% { top: 74px; }
}

@keyframes blip {
  0%, 100% { opacity: 0; transform: scale(.6); }
  30%, 60% { opacity: 1; transform: scale(1); }
}

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

@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* --- layar sempit (ponsel) --- */
@media (max-width: 560px) {
  .flist li { grid-template-columns: auto 1fr auto; }
  .flist .sz { display: none; }
  .fcard { grid-template-columns: 1fr; }
  .ficon { width: 44px; height: 50px; }
  .ritem { grid-template-columns: auto 1fr; }
  .ritem .faction { grid-column: 1/3; justify-content: flex-start; }
}

/* --- pengguna mematikan animasi di sistem operasi --- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
