/* ==========================================================================
   Ta'lim Darsliklar — sayt qismi
   Asosiy rang mavzudagi --primary-color dan olinadi (bo'lmasa #264DB1).
   ========================================================================== */

.tdl {
  --tdl-primary: var(--primary-color, #264db1);
  --tdl-primary-dark: #1b3a8a;
  --tdl-tint: #eaf0fb;
  --tdl-ink: #15203f;
  --tdl-muted: #5a6684;
  --tdl-line: #d9e0ef;
  --tdl-paper: #ffffff;
  --tdl-desk: #e6eaf3;
  --tdl-radius: 10px;

  color: var(--tdl-ink);
  font-family: inherit;
  line-height: 1.5;
}
.tdl *,
.tdl *::before,
.tdl *::after {
  box-sizing: border-box;
}
.tdl img {
  max-width: 100%;
}
.tdl [hidden] {
  display: none !important;
}

.tdl .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tdl-wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

.tdl :focus-visible {
  outline: 3px solid rgba(38, 77, 177, 0.45);
  outline-offset: 2px;
}

/* Mavzudagi umumiy tugma stillarini bekor qilish */
.tdl button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  font: inherit;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Tugmalar
   -------------------------------------------------------------------------- */
.tdl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.tdl-btn--primary {
  background: var(--tdl-primary);
  color: #fff !important;
}
.tdl-btn--primary:hover {
  background: var(--tdl-primary-dark);
}
.tdl-btn--ghost {
  background: var(--tdl-paper);
  color: var(--tdl-primary) !important;
  border-color: var(--tdl-line);
}
.tdl-btn--ghost:hover {
  border-color: var(--tdl-primary);
  background: var(--tdl-tint);
}
.tdl-btn--lg {
  padding: 13px 22px;
  font-size: 16px;
  border-radius: 10px;
}
.tdl-btn__note {
  font-weight: 400;
  opacity: 0.8;
  margin-left: 4px;
}

/* --------------------------------------------------------------------------
   Katalog: bosh qism
   -------------------------------------------------------------------------- */
.tdl-hero {
  background: var(--tdl-primary);
  color: #fff;
  padding: 52px 0 84px;
}
.tdl-hero__title {
  margin: 0;
  color: #fff;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.tdl-hero__lead {
  margin: 12px 0 28px;
  font-size: clamp(16px, 2vw, 19px);
  opacity: 0.9;
  max-width: 34em;
}

.tdl-search {
  position: relative;
  max-width: 640px;
}
.tdl-search__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tdl-muted);
  pointer-events: none;
}
.tdl .tdl-search__input {
  width: 100%;
  height: 58px;
  padding: 0 52px 0 54px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--tdl-ink);
  font: inherit;
  font-size: 17px;
  box-shadow: 0 8px 24px -10px rgba(10, 20, 60, 0.5);
  -webkit-appearance: none;
  appearance: none;
}
.tdl .tdl-search__input::placeholder {
  color: #8a94ae;
}
.tdl .tdl-search__input:focus {
  outline: 3px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}
.tdl-search__input::-webkit-search-cancel-button {
  display: none;
}
.tdl .tdl-search__clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tdl-muted);
  display: grid;
  place-items: center;
  padding: 0;
}
.tdl .tdl-search__clear:hover {
  background: var(--tdl-tint);
  color: var(--tdl-ink);
}

/* --------------------------------------------------------------------------
   Sinflar qatori — sahifaning asosiy elementi
   -------------------------------------------------------------------------- */
.tdl-grades {
  margin-top: -46px;
  position: relative;
  z-index: 1;
}
.tdl-grades__row {
  display: flex;
  gap: 6px;
  padding: 10px;
  background: var(--tdl-paper);
  border-radius: 14px;
  box-shadow: 0 12px 32px -16px rgba(21, 32, 63, 0.45),
    0 0 0 1px var(--tdl-line);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.tdl-grades__row::-webkit-scrollbar {
  display: none;
}

.tdl .tdl-grade {
  flex: 1 0 64px;
  min-width: 64px;
  height: 78px;
  padding: 6px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--tdl-ink);
  scroll-snap-align: start;
  transition: background-color 0.15s, color 0.15s;
}
.tdl .tdl-grade:hover:not(:disabled) {
  background: var(--tdl-tint);
}
.tdl .tdl-grade[aria-pressed="true"] {
  background: var(--tdl-primary);
  color: #fff;
}
.tdl .tdl-grade:disabled {
  opacity: 0.32;
  cursor: default;
}
.tdl-grade__num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.tdl-grade__label {
  font-size: 12px;
  opacity: 0.75;
}
.tdl .tdl-grade--all {
  flex-basis: 84px;
  min-width: 84px;
}
.tdl-grade--all .tdl-grade__num {
  font-size: 20px;
}

/* --------------------------------------------------------------------------
   Filtrlar
   -------------------------------------------------------------------------- */
.tdl-catalog__body {
  padding-top: 28px;
  padding-bottom: 64px;
}
.tdl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-start;
  justify-content: space-between;
}
.tdl-fans {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 520px;
}
.tdl .tdl-chip {
  padding: 7px 14px;
  border: 1px solid var(--tdl-line);
  border-radius: 999px;
  background: var(--tdl-paper);
  color: var(--tdl-ink);
  font-size: 14px;
  line-height: 1.3;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.tdl .tdl-chip:hover {
  border-color: var(--tdl-primary);
}
.tdl .tdl-chip[aria-pressed="true"] {
  background: var(--tdl-tint);
  border-color: var(--tdl-primary);
  color: var(--tdl-primary);
  font-weight: 600;
}

.tdl-til select {
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--tdl-line);
  border-radius: 8px;
  background: var(--tdl-paper);
  color: var(--tdl-ink);
  font: inherit;
  font-size: 14px;
}

.tdl-count {
  margin: 22px 0 0;
  color: var(--tdl-muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Sinf bo'limlari va kitoblar to'ri
   -------------------------------------------------------------------------- */
.tdl-shelf {
  margin-top: 36px;
}
.tdl .tdl-shelf__title {
  margin: 0 0 22px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--tdl-line);
  font-size: 22px;
  font-weight: 700;
  color: var(--tdl-ink);
  line-height: 1.2;
}
.tdl-shelf__num {
  color: var(--tdl-primary);
  font-size: 1.35em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tdl .tdl-books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 34px 24px;
}

.tdl-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.tdl-card::before {
  content: none;
}

/* Muqova — haqiqiy kitobga o'xshatib: chap tomonda muqova bukilishi, o'ngda varaqlar qirrasi */
.tdl-card__cover {
  position: relative;
  display: block;
  aspect-ratio: 7 / 10;
  border-radius: 3px 6px 6px 3px;
  background: var(--tdl-tint);
  box-shadow: 2px 2px 0 #fff, 3px 3px 0 var(--tdl-line), 5px 5px 0 #fff,
    6px 6px 0 var(--tdl-line), 0 14px 24px -12px rgba(21, 32, 63, 0.5);
  transition: transform 0.2s ease;
}
.tdl-card__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.tdl-card__cover::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8%;
  border-radius: 3px 0 0 3px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.22),
    rgba(255, 255, 255, 0.18) 55%,
    rgba(0, 0, 0, 0.06)
  );
}
.tdl-card:hover .tdl-card__cover {
  transform: translateY(-4px);
}

.tdl-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 14px 12px 20px;
  border-radius: inherit;
  color: #fff;
  background: var(--tdl-primary);
}
.tdl-ph__fan {
  order: -1;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
}
.tdl-ph__num {
  font-size: 72px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
  opacity: 0.9;
}

.tdl-card__body {
  padding-top: 16px;
  flex: 1 1 auto;
}
.tdl .tdl-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}
.tdl .tdl-card__title a {
  color: var(--tdl-ink);
  text-decoration: none;
}
.tdl .tdl-card__title a:hover {
  color: var(--tdl-primary);
}
.tdl .tdl-card__meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--tdl-muted);
}
.tdl-lang {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--tdl-tint);
  color: var(--tdl-primary);
  font-size: 12px;
  font-weight: 600;
}

.tdl-card__actions {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.tdl-card__actions .tdl-btn {
  width: 100%;
  padding: 8px 10px;
}
.tdl-soon {
  font-size: 13px;
  color: var(--tdl-muted);
}

/* Bo'sh holat */
.tdl-empty {
  margin: 40px 0;
  padding: 40px 24px;
  text-align: center;
  border: 2px dashed var(--tdl-line);
  border-radius: var(--tdl-radius);
  color: var(--tdl-muted);
}
.tdl-empty p {
  margin: 0 0 8px;
}
.tdl .tdl-empty__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--tdl-ink);
}
.tdl-empty .tdl-btn {
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Darslik sahifasi
   -------------------------------------------------------------------------- */
.tdl-single {
  padding: 24px 0 64px;
}
.tdl-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--tdl-muted);
}
.tdl-crumbs a {
  color: var(--tdl-primary);
  text-decoration: none;
}
.tdl-crumbs a:hover {
  text-decoration: underline;
}

.tdl-single__head {
  padding: 14px 0 6px;
  box-shadow: none;
}
.tdl .tdl-single__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--tdl-ink);
}
.tdl-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
}
.tdl-facts > div {
  position: relative;
  padding: 14px 16px 14px 20px;
  background: var(--tdl-paper);
  border: 1px solid var(--tdl-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(21, 32, 63, 0.06),
    0 8px 20px -12px rgba(21, 32, 63, 0.28);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
/* Chap tomondagi asosiy rangli chiziq */
.tdl-facts > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--tdl-primary);
  opacity: 0.85;
}
.tdl-facts > div:hover {
  transform: translateY(-2px);
  border-color: rgba(38, 77, 177, 0.35);
  box-shadow: 0 2px 4px rgba(21, 32, 63, 0.06),
    0 14px 28px -14px rgba(38, 77, 177, 0.45);
}
.tdl-facts dt {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--tdl-muted);
}
.tdl-facts dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--tdl-ink);
  line-height: 1.35;
  word-break: break-word;
}

@media (max-width: 640px) {
  .tdl-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .tdl-facts > div {
    padding: 8px 8px 8px 16px;
  }
  .tdl-facts dd {
    font-size: 15px;
  }
}
.tdl-single__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   Onlayn o'quvchi
   -------------------------------------------------------------------------- */
.tdl-reader {
  margin: 32px 0 0;
  scroll-margin-top: 20px;
}

.tdl-reader__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px max(12px, calc((100% - 1160px) / 2));
  background: var(--tdl-paper);
  border-bottom: 1px solid var(--tdl-line);
}
.tdl-reader__group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tdl .tdl-tool {
  height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--tdl-ink);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.tdl .tdl-tool:hover {
  background: var(--tdl-tint);
  color: var(--tdl-primary);
}
.tdl .tdl-tool:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}
.tdl .tdl-icon {
  padding: 0;
  width: 38px;
}
.tdl-reader__modes {
  background: var(--tdl-desk);
  border-radius: 10px;
  padding: 3px;
}
.tdl .tdl-mode {
  height: 32px;
}
.tdl .tdl-mode[aria-pressed="true"] {
  background: var(--tdl-paper);
  color: var(--tdl-primary);
  box-shadow: 0 1px 3px rgba(21, 32, 63, 0.18);
}

.tdl-pageno {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--tdl-muted);
}
.tdl .tdl-pageno__input {
  width: 64px;
  height: 34px;
  margin: 0;
  padding: 0 6px;
  text-align: center;
  border: 1px solid var(--tdl-line);
  border-radius: 7px;
  background: var(--tdl-paper);
  color: var(--tdl-ink);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.tdl-pageno__input::-webkit-outer-spin-button,
.tdl-pageno__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tdl-pageno__total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tdl-reader[data-mode="book"] .tdl-zoom-in,
.tdl-reader[data-mode="book"] .tdl-zoom-out {
  display: none;
}

.tdl-reader__stage {
  position: relative;
  padding: 24px 12px;
  min-height: 420px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #fff;
}

.tdl-reader__msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--tdl-muted);
  text-align: center;
  padding: 24px;
}
.tdl-reader__msg .tdl-btn {
  margin-top: 4px;
}
.tdl-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--tdl-line);
  border-top-color: var(--tdl-primary);
  animation: tdl-spin 0.8s linear infinite;
}
@keyframes tdl-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Kitob ko'rinishi (StPageFlip) */
.tdl-book {
  margin: 0 auto;
}
.tdl-book .stf__parent {
  position: relative;
  display: block;
  transform: translateZ(0);
  touch-action: pan-y;
}
.tdl-book .stf__wrapper {
  position: relative;
  width: 100%;
}
.tdl-book .stf__block {
  position: absolute;
  width: 100%;
  height: 100%;
  perspective: 2000px;
}
.tdl-book .stf__item {
  display: none;
  position: absolute;
  transform-style: preserve-3d;
}
.tdl-book .stf__outerShadow,
.tdl-book .stf__innerShadow,
.tdl-book .stf__hardShadow,
.tdl-book .stf__hardInnerShadow {
  position: absolute;
  left: 0;
  top: 0;
}

.tdl-pg {
  background: #fff;
  overflow: hidden;
}
.tdl-pg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.tdl-pg::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7%;
  pointer-events: none;
}
.tdl-pg.--left::after {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0));
}
.tdl-pg.--right::after {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0));
}

.tdl-pg__wait,
.tdl-sp__wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #a3acc2;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.tdl-pg.is-ready .tdl-pg__wait,
.tdl-sp.is-ready .tdl-sp__wait {
  display: none;
}

/* Varaqlar ko'rinishi (pastga aylantirib o'qish, kattalashtirish ishlaydi) */
.tdl-scroll {
  position: relative;
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.tdl-scroll__inner {
  margin: 0 auto;
  padding: 4px 0 12px;
}
.tdl-sp {
  position: relative;
  margin: 0 auto 16px;
  background: #fff;
  box-shadow: 0 6px 18px -10px rgba(21, 32, 63, 0.45);
}
.tdl-sp img {
  display: block;
  width: 100%;
  height: 100%;
}
.tdl-sp__no {
  position: absolute;
  right: 0;
  bottom: -2px;
  transform: translateY(100%);
  font-size: 12px;
  color: var(--tdl-muted);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.tdl-resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  padding: 10px 16px;
  background: var(--tdl-ink);
  color: #fff;
  font-size: 14px;
}
.tdl .tdl-resume__btn {
  border: 0;
  background: transparent;
  color: #fff;
  text-decoration: underline;
  padding: 4px;
  font-size: 14px;
}

/* To'liq ekran */
.tdl-reader:fullscreen {
  margin: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border: 0;
}
.tdl-reader.is-full {
  position: fixed;
  inset: 0;
  z-index: 999999;
  margin: 0;
  border: 0;
  display: flex;
  flex-direction: column;
}
.tdl-reader:fullscreen .tdl-reader__stage,
.tdl-reader.is-full .tdl-reader__stage {
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
}
html.tdl-lock,
html.tdl-lock body {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Matn va boshqa darsliklar
   -------------------------------------------------------------------------- */
.tdl-single__content {
  margin: 40px 0 0;
  font-size: 17px;
  line-height: 1.65;
}
.tdl-single__content #darslik-yuklab-olish {
  display: none;
}
.tdl-related {
  margin-top: 56px;
}
.tdl .tdl-related__title {
  margin: 0 0 24px;
  font-size: 24px;
  font-weight: 700;
}
.tdl-more {
  display: inline-block;
  margin-top: 28px;
  color: var(--tdl-primary);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Telefon
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .tdl-wrap {
    padding: 0 14px;
  }
  .tdl-hero {
    padding: 36px 0 74px;
  }
  .tdl .tdl-search__input {
    height: 52px;
    font-size: 16px;
  }
  .tdl .tdl-grade {
    flex: 0 0 56px;
    min-width: 56px;
    height: 68px;
  }
  .tdl-grade__num {
    font-size: 26px;
  }
  .tdl .tdl-grade--all {
    flex: 0 0 72px;
  }

  .tdl-fans {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -14px;
    padding: 2px 14px 6px;
    scrollbar-width: none;
  }
  .tdl-fans::-webkit-scrollbar {
    display: none;
  }
  .tdl .tdl-chip {
    flex: 0 0 auto;
  }

  .tdl .tdl-books {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 16px;
  }
  .tdl .tdl-card__title {
    font-size: 14px;
  }

  .tdl-reader__bar {
    padding: 6px 8px;
  }
  .tdl-reader__nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .tdl-reader__stage {
    padding: 14px 6px;
  }
  .tdl .tdl-tool {
    padding: 0 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tdl *,
  .tdl *::before,
  .tdl *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
  }
  .tdl-card:hover .tdl-card__cover {
    transform: none;
  }
}
