/* =====================================================
   PAGES.CSS — Sahifa-spesifik stillari:
   hero, home grid, panel, sidebar, list layout, detail
   ===================================================== */

/* =====================================================
   BOSH SAHIFA HERO (yangi)
   ===================================================== */
.home-hero {
  position: relative;
  background: var(--color-primary);
  overflow: hidden;
  padding: 3.5rem 0 3rem;
}

/* Kitob tokchasi fon effekti — CSS orqali */
.home-hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, #0d1f35 0%, #1a3a5c 45%, #1e4a72 75%, #1a3a5c 100%);
  opacity: 1;
}

/* Dekorativ nuqtalar (kitob ranglari) */
.home-hero-bg::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184,134,11,0.12) 0%, transparent 70%);
}

.home-hero-bg::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 10%;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184,134,11,0.08) 0%, transparent 70%);
}

/* Suzib yuruvchi kitob/hujjat ikonkalari */
.hero-deco {
  position: absolute;
  opacity: 0.9;
  pointer-events: none;
}

.hero-deco--book1 {
  width: 70px; height: 95px;
  top: 12%; left: 4%;
  transform: rotate(-12deg);
}

.hero-deco--book2 {
  width: 55px; height: 75px;
  top: 55%; left: 8%;
  transform: rotate(8deg);
}

.hero-deco--book3 {
  width: 48px; height: 65px;
  top: 25%; left: 18%;
  transform: rotate(-5deg);
}

.hero-deco--doc1 {
  width: 60px; height: 78px;
  top: 10%; right: 5%;
  transform: rotate(10deg);
}

.hero-deco--doc2 {
  width: 50px; height: 65px;
  top: 50%; right: 10%;
  transform: rotate(-8deg);
}

.hero-deco--search {
  width: 52px; height: 52px;
  top: 20%; right: 22%;
  transform: rotate(5deg);
}

@media (max-width: 900px) {
  .hero-deco--book3,
  .hero-deco--search { display: none; }
  .hero-deco--book1 { left: 1%; }
  .hero-deco--doc1  { right: 1%; }
}

@media (max-width: 560px) {
  .hero-deco { display: none; }
}

.home-hero-inner {
  position: relative;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.home-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

.home-hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.72);
  margin-bottom: 2rem;
  font-style: italic;
}

.home-search-wrap {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  background: #fff;
}

.home-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: transparent;
}

.home-search-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s;
}

.home-search-btn:hover { background: var(--color-accent); }

/* =====================================================
   HOME 3-USTUNLI GRID
   ===================================================== */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 300px;
  gap: 1.5rem;
  align-items: start;
  padding: 1.75rem 0 2.5rem;
}

/* ── PANEL (O'zbek va Jahon ustunlari) ── */
.lit-panel {
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  color: #fff;
}

.panel-header--uzbek { background: var(--color-primary); }
.panel-header--world  { background: #1a4a3a; }

.panel-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.panel-header-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
}

.panel-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
}

/* Kategoriya kartochkalari panelda */
.panel-cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--color-border-light);
}

.panel-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.9rem 0.5rem;
  border-right: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
  text-decoration: none;
  color: var(--color-primary);
  transition: background 0.15s;
  text-align: center;
}

/* So'nggi elementlar past chiziqsiz */
.panel-cat-item:nth-child(4n) { border-right: none; }
.panel-cat-item:nth-last-child(-n+4) { border-bottom: none; }

.panel-cat-item:hover { background: var(--color-bg-alt); }

.panel-cat-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.3;
}

/* So'nggi obzorlar ro'yxati */
.panel-recent { padding: 0.85rem 1.1rem; }

.panel-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.panel-recent-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--color-primary);
}

.panel-recent-more {
  font-size: 0.78rem;
  color: var(--color-accent);
  font-weight: 600;
  white-space: nowrap;
}
.panel-recent-more:hover { text-decoration: underline; color: var(--color-accent); }

.panel-recent-list { display: flex; flex-direction: column; gap: 0; }

.panel-recent-item {
  border-bottom: 1px solid var(--color-border-light);
}
.panel-recent-item:last-child { border-bottom: none; }

.panel-recent-link {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.6rem 0;
  color: inherit;
  text-decoration: none;
}
.panel-recent-link:hover .panel-recent-name { color: var(--color-accent); }

.panel-recent-cat {
  font-size: 0.7rem;
  color: var(--color-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-recent-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.35;
  transition: color 0.15s;
}

.panel-recent-meta {
  font-size: 0.73rem;
  color: var(--color-text-muted);
}

.panel-empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  padding: 1.5rem 0;
}

/* ── SIDEBAR ── */
.home-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.sidebar-card {
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
}

.sidebar-card--accent {
  background: var(--color-bg-alt);
  border-color: var(--color-accent);
  text-align: center;
}

.sidebar-card-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-accent);
  display: inline-block;
  width: 100%;
}

/* Statistika ro'yxati */
.stat-list { display: flex; flex-direction: column; gap: 0; }

.stat-list-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.85rem;
}
.stat-list-item:last-child { border-bottom: none; }

.stat-list-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon--doc    { background: #e8f0fd; color: #2563eb; }
.stat-icon--author { background: #fef3e2; color: #d97706; }
.stat-icon--cat    { background: #ecfdf5; color: #059669; }
.stat-icon--eye    { background: #f5f3ff; color: #7c3aed; }
.stat-icon--dl     { background: #fff1f2; color: #e11d48; }

.stat-list-label { flex: 1; color: var(--color-text-muted); }
.stat-list-val { font-weight: 700; color: var(--color-primary); font-size: 0.9rem; }

/* Foydali bo'limlar */
.useful-links { display: flex; flex-direction: column; gap: 0; }

.useful-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0;
  font-size: 0.84rem;
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-border-light);
  text-decoration: none;
  transition: color 0.15s, padding-left 0.15s;
}

.useful-link:last-child { border-bottom: none; }
.useful-link:hover { color: var(--color-accent); padding-left: 4px; }

.useful-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--color-bg-alt);
  color: var(--color-accent);
  flex-shrink: 0;
}

/* PDF card */
.sidebar-feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.sidebar-feature-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
}

.sidebar-feature-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

/* ===================================================
   QULAY XUSUSIYATLAR (pastki bar)
   =================================================== */
.features-bar {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border-light);
  padding: 1.75rem 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-title {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--color-primary);
  margin-bottom: 0.2rem;
}

.feature-desc {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* =====================================================
   SAHIFA HERO (kichik variantlar — boshqa sahifalar)
   ===================================================== */
.page-hero {
  background: var(--color-primary);
  padding: 2.5rem 0;
  color: #fff;
}

.page-hero--small { padding: 2rem 0; }

.page-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: #fff;
  margin-bottom: 0.4rem;
}

.page-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.75);
  margin-top: 0.35rem;
}

.page-content {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* =====================================================
   BOSH SAHIFA HERO
   ===================================================== */
.hero {
  background: var(--color-primary);
  background-image: linear-gradient(135deg, #122844 0%, #1a3a5c 50%, #1e4a72 100%);
  padding: 4rem 0 3.5rem;
  overflow: hidden;
  position: relative;
}

/* Chap pastki dekoratsiya */
.hero::before {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(184,134,11,0.08);
  pointer-events: none;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-light);
  margin-bottom: 0.6rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  color: #fff;
  margin-bottom: 0.75rem;
  line-height: 1.15;
}

.hero-desc {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.65;
  max-width: 540px;
  margin-bottom: 1.75rem;
}

.hero-search-box {
  display: flex;
  max-width: 500px;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  background: #fff;
}

.hero-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: transparent;
}

.hero-search-box .btn {
  border-radius: 0 32px 32px 0;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

.hero-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-illustration img {
  max-width: 340px;
  width: 100%;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.2));
}

/* =====================================================
   SECTION (umumiy bo'lim)
   ===================================================== */
.section {
  padding: 3rem 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--color-primary);
  position: relative;
  padding-bottom: 0.5rem;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
  margin-bottom: 1.5rem;
}

.section-footer {
  text-align: center;
  margin-top: 2rem;
}

/* =====================================================
   KATEGORIYALAR GRID (bosh sahifa)
   ===================================================== */
.categories-section {
  background: var(--color-bg-alt);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-primary);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  text-align: center;
}

.category-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--color-accent);
  color: var(--color-primary);
}

/* Ikonka wrapper — template tag orqali inline style bilan keladi */
.cat-icon-wrap {
  transition: transform 0.2s;
}
.category-card:hover .cat-icon-wrap {
  transform: scale(1.08);
}

.category-name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.3;
}

.category-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* =====================================================
   STATISTIKA BANNER (bosh sahifa)
   ===================================================== */
.stats-banner {
  background: var(--color-primary);
  padding: 2.5rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.stat-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem;
}

.stat-number {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-accent-light);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

/* =====================================================
   MAQOLALAR RO'YXATI — LAYOUT (filter + main)
   ===================================================== */
.list-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
}

.filters-sidebar {
  background: #fff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 96px;
}

.filters-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border-light);
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =====================================================
   MAQOLA DETAIL SAHIFASI
   ===================================================== */
.detail-layout { display: flex; flex-direction: column; gap: 3rem; }

.detail-main { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--color-border-light); padding: 2rem; }

.detail-header { margin-bottom: 1.5rem; }

.detail-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }

.detail-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--color-primary);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.detail-meta-item a { color: var(--color-accent); font-weight: 500; }
.detail-meta-item a:hover { text-decoration: underline; }

.detail-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
}

.detail-cover-col { display: flex; flex-direction: column; gap: 1rem; }

.detail-cover {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  object-fit: cover;
  max-height: 360px;
}
.detail-cover--fallback { object-fit: contain; background: var(--color-bg-alt); }

.work-info {
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-accent);
  padding: 1rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.work-info-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
  font-family: var(--font-sans);
}

.work-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-primary);
  font-style: italic;
}

.work-author {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }

.detail-section-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border-light);
}

.description-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--color-text);
}

/* O'xshash maqolalar */
.related-section { border-top: 1px solid var(--color-border-light); padding-top: 2rem; }

.related-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 1.25rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

/* =====================================================
   QIDIRUV FORMASI
   ===================================================== */
.search-form {
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.search-form-inner {
  display: flex;
  gap: 0.75rem;
}

.search-form-input { flex: 1; }

/* =====================================================
   LATEST SECTION FONI
   ===================================================== */
.latest-section { background: var(--color-bg-alt); }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1100px) {
  /* Home grid: kichkina ekranda sidebar pastga tushadi */
  .home-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .home-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  .sidebar-card { margin: 0; }
  .features-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-illustration { display: none; }
  .hero-search-box { max-width: 100%; }

  .stats-grid { grid-template-columns: repeat(3, 1fr); }

  .list-layout { grid-template-columns: 1fr; }
  .filters-sidebar { position: static; }

  .detail-body { grid-template-columns: 200px 1fr; }

  /* Home: 1-ustun */
  .home-grid {
    grid-template-columns: 1fr;
  }
  .home-sidebar {
    grid-column: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .panel-cat-grid { grid-template-columns: repeat(4, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-body { grid-template-columns: 1fr; }

  .hero { padding: 2.5rem 0; }
  .section { padding: 2rem 0; }

  .home-hero { padding: 2.5rem 0 2rem; }
  .panel-cat-grid { grid-template-columns: repeat(3, 1fr); }
  .features-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat-number { font-size: 1.6rem; }
  .page-title { font-size: 1.5rem; }
  .detail-main { padding: 1.25rem; }
  .search-form-inner { flex-direction: column; }

  .panel-cat-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .home-search-wrap { flex-direction: column; border-radius: var(--radius-lg); }
  .home-search-btn { justify-content: center; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}
