:root {
  --navy: #0f2c5c;
  --navy-light: #1b4079;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 44, 92, 0.08);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden; /* gorizontal scroll bo'lmasin */
}

a { color: inherit; text-decoration: none; }

/* Toshib ketmaslik uchun umumiy himoya */
img { max-width: 100%; height: auto; }
h1, h2, h3, h4, p, span, div, a, strong { overflow-wrap: break-word; word-break: break-word; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 0;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 2000px;
  margin: 0 auto;
  padding: 18px clamp(16px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0; overflow: hidden;
}
.brand-logo.has-img { background: #fff; padding: 5px; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text h1 { font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.brand-text p { font-size: 12.5px; opacity: .8; }
.header-nav { display: flex; gap: 8px; }
.header-nav a {
  padding: 8px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,0.10);
  transition: background .2s;
}
.header-nav a:hover { background: rgba(255,255,255,0.22); }

/* ---------- Hero ---------- */
.hero {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: 2000px; margin: 0 auto; padding: 30px clamp(16px, 3vw, 48px);
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.hero h2 { font-size: 24px; color: var(--navy); }
.hero p { color: var(--muted); margin-top: 4px; }
.search-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px 6px 6px 14px; min-width: 280px;
}
.search-box input { border: none; outline: none; background: transparent; flex: 1; font-size: 14px; }

/* ---------- Layout ---------- */
.container { max-width: 2000px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 48px) 60px; }
.section-title {
  font-size: 18px; font-weight: 700; color: var(--navy);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* ---------- Conference cards (kenglikka qarab avtomatik moslashadi) ---------- */
.conf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}
.conf-card {
  position: relative;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 2px 10px rgba(15,44,92,0.06);
  overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.conf-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(15,44,92,0.16);
  border-color: #c9d8f5;
}
.conf-cover {
  width: 100%; height: 200px; object-fit: contain; object-position: center;
  background: #eef2f8; display: block; padding: 8px;
}
.conf-cover-ph {
  width: 100%; height: 200px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center;
  font-size: 38px;
}
.conf-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.conf-body h3 {
  font-size: 13.8px; color: var(--navy); line-height: 1.4; font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.8em;
}
.conf-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 11.5px; }
.conf-meta span { display: inline-flex; align-items: center; gap: 4px; }
.conf-card-foot {
  margin-top: auto; padding-top: 9px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.badge {
  background: var(--blue-soft); color: var(--blue);
  font-size: 10.5px; font-weight: 700; padding: 4px 9px;
  border-radius: 20px; white-space: nowrap;
}
.badge-pdf { background: #fef3e8; color: #d97706; }
.conf-desc { color: var(--muted); font-size: 13.5px; margin-top: 8px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,44,92,0.55);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card); border-radius: 16px; width: 100%; max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.modal-head {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.modal-head h2 { font-size: 18px; color: var(--navy); line-height: 1.4; }
.modal-close {
  background: var(--bg); border: none; width: 34px; height: 34px; border-radius: 9px;
  font-size: 18px; cursor: pointer; color: var(--muted); flex-shrink: 0;
}
.modal-close:hover { background: #e2e8f0; }
.modal-body { padding: 20px 24px 26px; }
.modal-cover { display: flex; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.modal-cover img { width: 150px; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.modal-info { flex: 1; min-width: 200px; }

/* ---------- Articles ---------- */
.articles-title { font-weight: 700; color: var(--navy); margin: 14px 0 6px; font-size: 15px; }
.article-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 13px 0; border-bottom: 1px dashed var(--border);
}
.article-row:last-child { border-bottom: none; }
.article-info { min-width: 0; }
.article-info .a-title { font-weight: 600; font-size: 14.5px; }
.article-info .a-author { color: var(--muted); font-size: 13px; margin-top: 2px; }
.article-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty-articles { color: var(--muted); font-size: 13.5px; padding: 12px 0; }

/* ---------- Buttons ---------- */
.btn {
  border: none; cursor: pointer; font-family: inherit;
  font-size: 13.5px; font-weight: 600; padding: 9px 16px;
  border-radius: 10px; transition: filter .15s, background .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-pdf { background: var(--blue-soft); color: var(--blue); }
.btn-pdf:hover { background: #d6e4fd; }
.btn-danger { background: #fde8e8; color: var(--danger); }
.btn-danger:hover { background: #fbd5d5; }
.btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- States ---------- */
.state { text-align: center; padding: 60px 20px; color: var(--muted); }
.state .big { font-size: 42px; margin-bottom: 10px; }

/* ---------- Forms / Admin ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.panel h3 { color: var(--navy); font-size: 16px; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; outline: none; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); }
.field textarea { resize: vertical; min-height: 70px; }
.file-input { padding: 8px; background: var(--bg); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Toast / messages ---------- */
.msg { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.ok { background: #dcfce7; color: var(--success); }
.msg.err { background: #fee2e2; color: var(--danger); }

/* ---------- Login ---------- */
.login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; }

/* ---------- Admin list ---------- */
.admin-conf { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.admin-conf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.admin-conf-head h4 { color: var(--navy); font-size: 15px; }
.admin-article { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--border); font-size: 13.5px; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; border-top: 1px solid var(--border); }

/* ---------- Boy footer (gspi.uz uslubida) ---------- */
.site-footer {
  background: #1668e6; color: #fff; border-top: none;
  text-align: left; padding: 0; margin-top: 44px;
}
.footer-inner {
  max-width: 2000px; margin: 0 auto;
  padding: 42px clamp(16px, 3vw, 48px);
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; align-items: start;
}
.footer-map iframe {
  width: 100%; height: 300px; border: 0; border-radius: 16px; display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.footer-col h3 {
  font-size: 21px; font-weight: 800; margin-bottom: 20px;
  position: relative; padding-bottom: 10px;
}
.footer-col h3::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 48px; height: 3px; background: #fff; border-radius: 2px;
}
.f-row { margin-bottom: 15px; font-size: 15px; }
.f-label { display: inline-block; min-width: 92px; opacity: .9; }
.site-footer a { color: #fff; }
.site-footer a:hover { text-decoration: underline; }
.f-counter {
  margin-top: 20px; display: inline-flex; gap: 8px; align-items: center;
  background: rgba(255,255,255,.16); padding: 9px 15px; border-radius: 10px;
  font-weight: 600; font-size: 14px;
}
.footer-col p { margin-bottom: 8px; font-size: 15px; opacity: .96; line-height: 1.7; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.22); text-align: center;
  padding: 16px; font-size: 13px; opacity: .92;
}

/* ================= MOSLASHUVCHANLIK (RESPONSIVE) ================= */

/* Planshet */
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; gap: 18px; }
  .hero-inner { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 0; width: 100%; }
  .hero h2 { font-size: 21px; }
  .footer-inner { grid-template-columns: 1fr; gap: 30px; }
  .footer-map iframe { height: 260px; }
}

/* Telefon */
@media (max-width: 560px) {
  .header-inner { padding: 14px 14px; gap: 12px; }
  .brand-logo { width: 44px; height: 44px; font-size: 22px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text p { font-size: 11.5px; }
  .header-nav a { padding: 7px 12px; font-size: 13px; }

  .hero-inner { padding: 20px 14px; }
  .hero h2 { font-size: 19px; }

  .container { padding: 20px 14px 50px; }

  /* Konferensiyalar: telefonda 1 qatorda 1 ta (auto-fill o'zi 1 ustun qiladi) */
  .conf-grid { gap: 14px; }
  .conf-cover, .conf-cover-ph { height: 220px; }
  .conf-body h3 { font-size: 15px; -webkit-line-clamp: 3; min-height: 0; }

  /* Detal / maqola qatori: tik joylashsin */
  .modal-cover { flex-direction: column; }
  .modal-cover img { width: 100%; max-width: 240px; align-self: center; }
  .article-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .article-actions { justify-content: flex-start; }

  /* Admin ro'yxati: tugmalar pastga tushsin */
  .admin-conf-head { flex-direction: column; }
  .admin-conf-head > div:last-child { display: flex; gap: 8px; }
  .admin-article { flex-direction: column; align-items: stretch; gap: 8px; }

  /* Modal (admin tahrir) telefonda */
  .modal-overlay { padding: 16px 10px; }
  .modal-head { padding: 16px 16px; }
  .modal-body { padding: 16px; }

  .panel { padding: 18px 16px; }

  /* iOS'da inputga bosganda zoom bo'lmasligi uchun */
  .field input, .field textarea, .field select,
  .search-box input, .login-card input { font-size: 16px; }
}

/* Juda kichik ekran (eski/kichik telefonlar) */
@media (max-width: 360px) {
  .brand-text h1 { font-size: 13.5px; }
  .conf-cover, .conf-cover-ph { height: 190px; }
}
