/* ============================================================
   ST — PDF: birlashtirish va sahifa o‘chirish

   Sahifa `sof-tilim.css` va `lugat.css` ustiga qo‘yiladi —
   yon menyu, ish maydoni va tugmalar o‘sha yerdan keladi.
   Bu yerda faqat shu bo‘limga tegishli qismlar.
   ============================================================ */

/* ---------- Bo‘limlar (tab) ---------------------------------- */

.stp-tab {
  display: flex;
  gap: 6px;
  margin: 26px 0 0;
  padding: 5px;
  background: var(--st-bg-tint);
  border-radius: var(--st-r);
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}

.stp-tab__b {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--st-ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.stp-tab__b svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.stp-tab__b:hover { color: var(--st-navy); }

.stp-tab__b.is-active {
  background: var(--st-panel);
  color: var(--st-blue);
  font-weight: 600;
  box-shadow: var(--st-shadow-1);
}

.stp-tab__b.is-active svg { opacity: 1; }

/* ---------- Panel -------------------------------------------- */

.stp-panel { margin-top: 20px; }
.stp-panel[hidden] { display: none; }

/* ---------- Fayl tashlash zonasi ----------------------------- */

.stp-tashla {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 42px 24px;
  border: 2px dashed var(--st-line);
  border-radius: var(--st-r-lg);
  background: var(--st-panel);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

/* `display: flex` brauzerning `[hidden]` qoidasidan kuchliroq —
   shuning uchun yashirish alohida yoziladi */
.stp-tashla[hidden] { display: none; }

.stp-tashla:hover,
.stp-tashla:focus-visible {
  border-color: var(--st-blue);
  background: var(--st-bg-tint);
  outline: none;
}

.stp-tashla__ic { width: 34px; height: 34px; color: var(--st-blue); margin-bottom: 4px; }
.stp-tashla b { font-size: 16px; color: var(--st-navy); font-weight: 600; }
.stp-tashla span { font-size: 13.5px; color: var(--st-muted); }

/* Fayl tanlangach zona kichrayadi */
.stp-tashla.is-kichik { padding: 20px 24px; }
.stp-tashla.is-kichik .stp-tashla__ic { width: 24px; height: 24px; margin: 0; }
.stp-tashla.is-kichik b { font-size: 14.5px; }
.stp-tashla.is-kichik span { display: none; }

/* ---------- Xato xabari -------------------------------------- */

.stp-xato {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid #F5C6C6;
  border-left: 3px solid var(--st-red);
  border-radius: var(--st-r-sm);
  background: #FDF3F3;
  color: #8C2020;
  font-size: 14px;
  line-height: 1.5;
}

.stp-xato[hidden] { display: none; }
.stp-xato b { display: block; color: var(--st-red); }

/* ---------- Birlashtirish: kartalar taxtasi ------------------ */

.stp-taxta {
  margin-top: 18px;
  border: 1px solid var(--st-line);
  border-radius: var(--st-r-lg);
  background: var(--st-panel);
  box-shadow: var(--st-shadow-1);
  overflow: hidden;
}

.stp-taxta[hidden] { display: none; }

.stp-kartalar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
}

.stp-taxta__oyoq {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--st-line-soft);
  background: var(--st-bg);
}

/* ---------- Bitta fayl kartasi ------------------------------- */

.stp-karta {
  position: relative;
  width: 168px;
  padding: 10px;
  border: 1px solid var(--st-line);
  border-radius: var(--st-r);
  background: var(--st-panel);
  cursor: grab;
}

.stp-karta:active { cursor: grabbing; }
.stp-karta.is-sudral { opacity: .4; }
.stp-karta.is-nishon { border-color: var(--st-blue); box-shadow: 0 0 0 2px var(--st-bg-tint); }

.stp-karta__bosh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.stp-karta__hajm { font-size: 12px; color: var(--st-muted); }
.stp-karta__amal { display: flex; gap: 2px; }

.stp-karta__amal button {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--st-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.stp-karta__amal button svg { width: 15px; height: 15px; }
.stp-karta__amal button:hover { background: var(--st-bg-tint); color: var(--st-navy); }
.stp-karta__amal button[data-amal="ochir"]:hover { background: #FDF3F3; color: var(--st-red); }
.stp-karta__amal button:disabled { opacity: .3; cursor: default; }
.stp-karta__amal button:disabled:hover { background: transparent; color: var(--st-muted); }

.stp-karta__rasm {
  position: relative;
  aspect-ratio: 1 / 1.414;
  border: 1px solid var(--st-line-soft);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.stp-karta__rasm img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

/* Rasmli fayl kartasi — PDFdan ajralib tursin */
.stp-karta__nishon {
  position: absolute;
  left: 6px; bottom: 6px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(2, 44, 106, .82);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
}

.stp-karta__nom {
  margin-top: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--st-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stp-karta__oyoq {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
}

.stp-karta__oyoq .bet { margin-left: auto; font-size: 11.5px; color: var(--st-muted); }

.stp-karta__yon {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 1px solid var(--st-line);
  border-radius: 6px;
  background: var(--st-panel);
  color: var(--st-ink-soft);
  cursor: pointer;
}

.stp-karta__yon svg { width: 14px; height: 14px; }
.stp-karta__yon:hover:not(:disabled) { border-color: var(--st-blue); color: var(--st-blue); }
.stp-karta__yon:disabled { opacity: .3; cursor: default; }

.stp-karta__raqam {
  min-width: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--st-blue);
}

/* ---------- «Qo‘shish» kartasi ------------------------------- */

.stp-qosh {
  width: 168px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 2px dashed var(--st-line);
  border-radius: var(--st-r);
  background: transparent;
  color: var(--st-ink-soft);
  font: inherit;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.stp-qosh:hover { border-color: var(--st-blue); background: var(--st-bg-tint); color: var(--st-blue); }
.stp-qosh__aylana {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: 1.6px solid currentColor;
  border-radius: 50%;
}
.stp-qosh__aylana svg { width: 20px; height: 20px; }

.stp-ikon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--st-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.stp-ikon svg { width: 17px; height: 17px; }
.stp-ikon:hover:not(:disabled) { background: var(--st-bg-tint); color: var(--st-navy); }
.stp-ikon--ochir:hover:not(:disabled) { background: #FDF3F3; color: var(--st-red); }
.stp-ikon:disabled { opacity: .3; cursor: default; }

/* ---------- Sahifa o‘chirish: bosh qator --------------------- */

.stp-bosh {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--st-line-soft);
}

.stp-bosh[hidden] { display: none; }
.stp-bosh__nom { font-size: 14.5px; color: var(--st-ink-soft); flex: 1 1 260px; min-width: 0; }
.stp-bosh__nom b { color: var(--st-navy); }
.stp-bosh__amal { display: flex; gap: 8px; flex-wrap: wrap; }
.stp-bosh__amal .st-btn { padding: 8px 14px; font-size: 13.5px; }

/* ---------- Sahifalar setkasi -------------------------------- */

.stp-setka {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 16px;
}

.stp-setka[hidden] { display: none; }

.stp-bet {
  position: relative;
  border: 2px solid var(--st-line);
  border-radius: var(--st-r);
  background: var(--st-panel);
  padding: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}

.stp-bet:hover { border-color: var(--st-blue); }
.stp-bet:focus-visible { outline: 2px solid var(--st-blue); outline-offset: 2px; }

/* O‘chirishga belgilangan sahifa */
.stp-bet.is-tanlangan {
  border-color: var(--st-red);
  background: #FDF5F5;
}

.stp-bet.is-tanlangan .stp-bet__rasm { opacity: .4; }

.stp-bet__rasm {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--st-line-soft);
  border-radius: 6px;
  background: #fff;
  transition: opacity .15s;
}

/* Rasm chizilgunga qadar turadigan bo‘sh joy */
.stp-bet__kutish {
  aspect-ratio: 1 / 1.414;
  border-radius: 6px;
  background: linear-gradient(100deg, var(--st-line-soft) 30%, var(--st-bg-tint) 50%, var(--st-line-soft) 70%);
  background-size: 220% 100%;
  animation: stpYaltira 1.4s ease-in-out infinite;
}

@keyframes stpYaltira {
  from { background-position: 180% 0; }
  to   { background-position: -40% 0; }
}

/* Eskiz chiqmagan holat — sahifa baribir tanlanadi */
.stp-bet__kutish.is-yoq {
  animation: none;
  background: var(--st-bg-tint);
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--st-muted);
}

.stp-bet__oyoq {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 7px;
  padding: 0 2px;
}

.stp-bet__raqam { font-size: 12.5px; color: var(--st-muted); font-weight: 500; }
.stp-bet.is-tanlangan .stp-bet__raqam { color: var(--st-red); }

.stp-bet__belgi {
  width: 18px; height: 18px;
  flex: none;
  border: 1.6px solid var(--st-line);
  border-radius: 5px;
  background: var(--st-panel);
  display: grid;
  place-items: center;
  color: transparent;
}

.stp-bet__belgi svg { width: 12px; height: 12px; }

.stp-bet.is-tanlangan .stp-bet__belgi {
  border-color: var(--st-red);
  background: var(--st-red);
  color: #fff;
}

/* ---------- Amal qatori ------------------------------------- */

.stp-amal {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--st-line-soft);
}

.stp-amal[hidden] { display: none; }
.stp-amal__izoh { flex: 1 1 auto; font-size: 14px; color: var(--st-muted); }

/* Umumiy uslublarda o‘chirilgan tugma ko‘rinishi yo‘q edi — tugma
   bosilmasa ham bosiladigandek turardi. Faqat shu bo‘limga qo‘shamiz. */
.stp-panel .st-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Natija ------------------------------------------ */

.stp-natija { margin-top: 22px; }
.stp-natija[hidden] { display: none; }

.stp-natija__quti {
  padding: 30px 26px;
  border: 1px solid #BFE3C8;
  border-radius: var(--st-r-lg);
  background: #F4FBF6;
  text-align: center;
}

.stp-natija__ic { width: 42px; height: 42px; color: var(--st-green); }
.stp-natija__quti h2 { margin: 10px 0 0; font-size: 21px; color: var(--st-navy); }
.stp-natija__quti p { margin: 6px 0 0; font-size: 14.5px; color: var(--st-ink-soft); }

.stp-natija__fayl {
  display: inline-block;
  margin: 16px 0 4px;
  padding: 9px 16px;
  border: 1px solid var(--st-line);
  border-radius: 10px;
  background: var(--st-panel);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--st-navy);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.stp-natija__tugma {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ---------- Maxfiylik izohi --------------------------------- */

.stp-maxfiy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 34px 0 0;
  padding: 14px 16px;
  border-radius: var(--st-r);
  background: var(--st-bg-tint);
  color: var(--st-ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

.stp-maxfiy svg { width: 19px; height: 19px; flex: none; color: var(--st-green); margin-top: 1px; }

/* ---------- Butun sahifaga tashlash pardasi ------------------ */

.stp-parda {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 87, 208, .12);
  backdrop-filter: blur(2px);
}

.stp-parda[hidden] { display: none; }

.stp-parda__quti {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 54px;
  border: 2px dashed var(--st-blue);
  border-radius: var(--st-r-lg);
  background: var(--st-panel);
  color: var(--st-navy);
  font-size: 17px;
  box-shadow: 0 14px 40px rgba(16, 25, 43, .16);
}

.stp-parda__quti svg { width: 38px; height: 38px; color: var(--st-blue); }

/* ---------- Eskizni kattalashtirish ------------------------- */

.stp-katta {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: rgba(16, 25, 43, .72);
}

.stp-katta[hidden] { display: none; }

.stp-katta__quti {
  margin: 0;
  max-width: min(680px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.stp-katta__quti img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: var(--st-r-sm);
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4);
}

.stp-katta__quti figcaption {
  color: #fff;
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.stp-katta__yop {
  position: absolute;
  top: 14px; right: 18px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.stp-katta__yop:hover { background: rgba(255, 255, 255, .26); }

/* ---------- Kutish pardasi ---------------------------------- */

.stp-yuk {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(16, 25, 43, .34);
  backdrop-filter: blur(2px);
}

.stp-yuk[hidden] { display: none; }

.stp-yuk__quti {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 26px;
  border-radius: var(--st-r);
  background: var(--st-panel);
  box-shadow: 0 12px 34px rgba(16, 25, 43, .2);
  font-size: 15px;
  color: var(--st-navy);
  font-weight: 500;
}

.stp-yuk__aylana {
  width: 22px; height: 22px;
  flex: none;
  border: 2.5px solid var(--st-bg-tint);
  border-top-color: var(--st-blue);
  border-radius: 50%;
  animation: stpAylan .7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .stp-yuk__aylana { animation-duration: 2s; }
  .stp-bet__kutish { animation: none; }
}

/* ---------- Kichik ekran ------------------------------------ */

@media (max-width: 620px) {
  .stp-tab { width: 100%; }
  .stp-tab__b { flex: 1 1 auto; justify-content: center; padding: 9px 10px; font-size: 13.5px; }
  .stp-tashla { padding: 30px 16px; }
  .stp-setka { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 12px; }
  .stp-amal .st-btn,
  .stp-natija__tugma .st-btn { flex: 1 1 100%; justify-content: center; }
  .stp-amal__izoh { flex: 1 1 100%; }

  /* Kartalar ikki ustunga tushadi, «qo‘shish» ham shunga moslashadi */
  .stp-kartalar { gap: 12px; padding: 14px; justify-content: center; }
  .stp-karta,
  .stp-qosh { width: calc(50% - 6px); }
  /* Oyoq qatori: izoh tepada, tanlash va savat yonma-yon,
     birlashtirish tugmasi butun kenglikda */
  .stp-taxta__oyoq { padding: 12px 14px; }
  .stp-taxta__oyoq .stp-amal__izoh { flex: 1 1 100%; order: -1; }
  .stp-taxta__oyoq .st-btn--ghost { flex: 1 1 auto; justify-content: center; }
  .stp-taxta__oyoq .st-btn--primary { flex: 1 1 100%; justify-content: center; }
  .stp-parda__quti { padding: 28px 24px; font-size: 15px; text-align: center; }
}
