@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  --primary: #1a3a5c;
  --primary-dark: #0d2440;
  --accent: #e8a020;
  --accent2: #2980b9;
  --light: #f4f8fc;
  --white: #ffffff;
  --text: #1e2d3d;
  --muted: #6b7c8d;
  --border: #d0dce8;
  --success: #27ae60;
  --danger: #e74c3c;
  --shadow: 0 4px 24px rgba(26,58,92,0.10);
  --shadow-lg: 0 10px 40px rgba(26,58,92,0.15);
  --max-w: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

/* ===== NAVBAR ===== */
nav {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(0,0,0,0.22);
  width: 100%;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}
.nav-logo {
  color: var(--accent);
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 900;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  line-height: 1.2;
  min-width: 0;
}
.nav-logo .logo-sub {
  color: rgba(255,255,255,0.55);
  font-family: 'Nunito', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  display: block;
  white-space: nowrap;
}
.nav-menu { display: flex; align-items: center; gap: 0.15rem; }
.nav-menu > a,
.nav-menu > .dropdown > a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  transition: all 0.18s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}
.nav-menu > a:hover,
.nav-menu > a.active,
.nav-menu > .dropdown > a:hover,
.nav-menu > .dropdown > a.active {
  background: var(--accent);
  color: var(--primary);
}

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(26,58,92,0.18);
  border: 1px solid var(--border);
  min-width: 240px;
  z-index: 300;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
@keyframes dropIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}
.dropdown-menu.open { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1.2rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: var(--light); color: var(--primary); }
.dropdown-menu a.active { background: #e8f4fd; color: var(--accent2); }
.dropdown-menu a .dm-icon { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.7rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  flex-shrink: 0;
}
.mobile-menu {
  display: none;
  background: var(--primary-dark);
  padding: 0.8rem 1rem 1.2rem;
  flex-direction: column;
  gap: 0.2rem;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  width: 100%;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  transition: background 0.15s;
  display: block;
}
.mobile-menu a:hover { background: rgba(255,255,255,0.08); }
.mobile-menu a.active { background: var(--accent); color: var(--primary); font-weight: 800; }
.mobile-section-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.38);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.8rem 1rem 0.25rem;
  margin-top: 0.3rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.page-header::before {
  content:'';
  position:absolute;
  inset:0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M20 20.5V18H0v5h5v5H0v5h20v-5h15v5H20v5h20V20.5z'/%3E%3C/g%3E%3C/svg%3E");
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3rem, 3vw, 2.1rem);
  font-weight: 900;
  margin-bottom: 0.4rem;
  position: relative;
  word-break: break-word;
}
.page-header p {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  position: relative;
}

/* ===== MAIN ===== */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.8rem 1.5rem;
  flex: 1;
  width: 100%;
  min-width: 0;
}

/* ===== INFO BOX ===== */
.info-box {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.87rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  line-height: 1.55;
  word-break: break-word;
}
.info-box.blue   { background: #e8f4fd; border: 1px solid #aed6f1; color: #1a5276; }
.info-box.yellow { background: #fef9e7; border: 1px solid #f9e79f; color: #7d6608; }

/* ===== FILE LIST ===== */
.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.8rem;
}
.file-item {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  min-width: 0;
}
.file-item:hover { border-color: var(--accent2); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.file-num {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.88rem;
  flex-shrink: 0;
  color: white;
}
.file-num.blue   { background: var(--primary); }
.file-num.orange { background: linear-gradient(135deg,#e67e22,var(--accent)); }
.file-num.green  { background: linear-gradient(135deg,#1abc9c,var(--success)); }
.file-num.red    { background: linear-gradient(135deg,#c0392b,#e74c3c); }
.file-info { flex: 1; min-width: 0; }
.file-info h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info p { font-size: 0.76rem; color: var(--muted); }
.file-actions { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.btn-view {
  background: var(--accent2); color: white;
  border: none; padding: 0.35rem 0.75rem;
  border-radius: 6px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: background 0.2s; white-space: nowrap;
  font-family: 'Nunito', sans-serif;
}
.btn-view:hover { background: #1a6fa3; }
.btn-dl {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 0.35rem 0.75rem;
  border-radius: 6px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: all 0.2s; white-space: nowrap;
  font-family: 'Nunito', sans-serif;
}
.btn-dl:hover { background: var(--accent); color: white; }

/* ===== PDF MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  width: 100%;
  max-width: 900px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  background: var(--primary); color: white;
  padding: 0.75rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 0.85rem; gap: 0.8rem;
  flex-shrink: 0;
  min-height: 52px;
}
.modal-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.modal-head-actions { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.modal-dl-btn {
  background: var(--accent); color: var(--primary);
  border: none; padding: 0.3rem 0.7rem;
  border-radius: 5px; font-size: 0.78rem; font-weight: 800;
  cursor: pointer; text-decoration: none;
  font-family: 'Nunito', sans-serif; white-space: nowrap;
}
.modal-close {
  background: rgba(255,255,255,0.15); border: none;
  color: white; width: 32px; height: 32px;
  border-radius: 7px; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; flex-shrink: 0;
}
.modal-close:hover { background: rgba(255,255,255,0.25); }
.modal iframe {
  flex: 1;
  border: none;
  display: block;
  width: 100%;
  /* Mobilda iframe scroll ishlashi uchun */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== SINGLE PDF ===== */
.single-pdf-wrap {
  background: var(--white);
  border-radius: 12px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.single-pdf-head {
  background: var(--primary); color: white;
  padding: 0.9rem 1.2rem;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 0.88rem;
  gap: 0.8rem;
}
.single-pdf-head span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.single-pdf-wrap iframe {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== FOOTER ===== */
footer {
  background: var(--primary);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 1.2rem 1.5rem;
  font-size: 0.8rem;
  margin-top: auto;
  word-break: break-word;
}
footer a { color: var(--accent); text-decoration: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .nav-menu { display: none; }
  .nav-toggle { display: block; }
}

@media (max-width: 768px) {
  .nav-inner { padding: 0 1rem; height: 58px; }
  .nav-logo { font-size: 1rem; }
  .mobile-menu { max-height: calc(100vh - 58px); }

  .main { padding: 1rem 0.9rem; }
  .page-header { padding: 1.8rem 1rem 1.5rem; }

  .file-list { grid-template-columns: 1fr; gap: 0.65rem; }
  .file-item { padding: 0.8rem 0.9rem; }
  .file-info h3 { font-size: 0.86rem; }

  /* Mobilda PDF modal — to'liq ekran, scroll ishlaydi */
  .modal-overlay { padding: 0; align-items: flex-start; }
  .modal {
    height: 100dvh;
    height: 100vh; /* fallback */
    border-radius: 0;
    max-width: 100%;
  }
  .modal iframe {
    /* Mobil brauzerda PDF scroll */
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
  }

  .single-pdf-wrap { border-radius: 10px; }
  .single-pdf-wrap iframe { height: 70vh; }

  .single-pdf-head { padding: 0.75rem 1rem; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .nav-logo .logo-sub { display: none; }
  .nav-logo { font-size: 0.95rem; }

  .file-num { width: 36px; height: 36px; font-size: 0.8rem; border-radius: 8px; }
  .file-actions { gap: 0.3rem; }
  .btn-view, .btn-dl { font-size: 0.73rem; padding: 0.3rem 0.6rem; }

  .modal-head { font-size: 0.8rem; padding: 0.65rem 0.85rem; }
  .modal-dl-btn { font-size: 0.74rem; padding: 0.27rem 0.6rem; }

  .single-pdf-wrap iframe { height: 65vh; }
  .info-box { font-size: 0.82rem; padding: 0.75rem 0.85rem; }
}
