/* Shrift HTML <head> da bloklamaydigan <link> orqali yuklanadi (tezlik uchun) */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f3f4f7;
  --surface-hover: #eef0f4;
  --text: #14181f;
  --text-2: #5b6270;
  --text-3: #9aa0ab;
  --border: #e6e8ee;
  --accent: #1c6dff;
  --accent-700: #0d3aa6;
  --accent-100: #e8f0ff;
  --navy: #0d2e8a;
  --navy-2: #1257d6;
  --star: #f5b400;
  --success: #1f9d55;
  --success-bg: #e7f6ec;
  --danger: #d33a3a;
  --danger-bg: #fbe9e9;
  --warning-bg: #fff4e0;
  --warning: #9a6b00;
  --radius: 16px;
  --overlay: rgba(13, 20, 40, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
img { max-width: 100%; display: block; }
svg { display: block; flex-shrink: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 60; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner { max-width: 1180px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--text); }
.brand .shield { width: 34px; height: 34px; flex-shrink: 0; }
.navlinks { display: flex; align-items: center; gap: 30px; }
.navlinks a { font-size: 15px; font-weight: 500; color: var(--text); padding: 6px 0; position: relative; }
.navlinks a.active { color: var(--accent); }
.navlinks a.active::after { content:""; position:absolute; left:0; right:0; bottom:-15px; height:2px; background:var(--accent); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: #fff; border: none; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; position: relative; }
.hamburger { display: none; background: none; border: none; padding: 6px; }
.nav-bell { border-radius: 50%; }
.mobile-nav { display: none; flex-direction: column; padding: 12px 24px 18px; border-top: 1px solid var(--border); background: var(--surface); }
.mobile-nav a { padding: 12px 0; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.mobile-nav.open { display: flex; }
.dropdown { position: absolute; top: 60px; right: 24px; width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(20,30,60,.15); padding: 8px; display: none; z-index: 100; }
.dd-item { border: none; margin: 0; padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.hero-all-btn { background: #c9a8e8; color: #1a1a2e; border: none; padding: 13px 32px; }

/* ---------- Buttons ---------- */
.btn {
  padding: 10px 20px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: linear-gradient(135deg, var(--navy-2), var(--navy)); border-color: transparent; color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #1a65eb, #0b348f); opacity: .96; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-outline-accent { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, #2f7dff 100%);
  border-radius: var(--radius); padding: 46px 40px; margin: 28px 0 40px; position: relative; overflow: hidden;
  display: flex; align-items: center; min-height: 150px;
}
.hero h1 { color: #fff; font-size: 26px; text-align: center; width: 100%; line-height: 1.4; position: relative; z-index: 2; }
.hero-deco { position: absolute; left: -10px; top: 50%; transform: translateY(-50%); opacity: .18; }
.hero-deco svg { width: 130px; height: 130px; }

/* ---------- Section ---------- */
.section-label { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--text-3); margin-bottom: 18px; }
.subject-tabs { display: flex; justify-content: center; gap: 28px; margin-bottom: 28px; flex-wrap: wrap; }
.subject-tab { font-size: 15px; font-weight: 600; color: var(--text-2); padding: 6px 4px; border: none; background: none; position: relative; }
.subject-tab.active { color: var(--text); }
.subject-tab.active::after { content:""; position:absolute; left:0; right:0; bottom:-8px; height:2px; background:var(--accent); }

/* ---------- Course card / grid ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-professors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.course-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: transform .18s, box-shadow .18s; display: block;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(20,30,60,.10); }
.course-thumb { width: 100%; aspect-ratio: 16/10; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-3); overflow: hidden; position: relative; }
.course-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-thumb-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.course-body { padding: 16px 18px 18px; }
.course-body h3 { font-size: 15.5px; margin-bottom: 10px; }
.course-prof { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.course-prof .who { flex: 1; min-width: 0; }
.course-prof .who b { font-size: 13px; display: block; }
.course-prof .who span { font-size: 12px; color: var(--text-3); }
.grade { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 8px; background: var(--success-bg); color: var(--success); flex-shrink: 0; }
.course-desc { font-size: 13px; color: var(--text-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-100); color: var(--accent-700); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar.lg { width: 150px; height: 150px; border-radius: 14px; font-size: 38px; }
.avatar.xl { width: 190px; height: 190px; border-radius: 16px; font-size: 50px; }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 3px; color: var(--star); }
.star-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1.5px solid var(--star); border-radius: 999px; }
.star-pill .num { font-weight: 700; font-size: 13px; color: var(--text); margin-left: 4px; }

/* ---------- Professor card (grid) ---------- */
.prof-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 18px; padding: 18px; text-align: center; transition: box-shadow .18s, transform .18s; position: relative; display: block; }
.prof-card .prof-top { position: absolute; top: 12px; right: 12px; }
.prof-meta { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 48px; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Kurs page ---------- */
.kurs-top { display: flex; gap: 30px; align-items: flex-start; margin-bottom: 30px; }
.kurs-player-col { flex: 1.5; min-width: 0; }
.kurs-text-col { flex: 1; max-width: 380px; flex-shrink: 0; }
.player-box { width: 100%; aspect-ratio: 16/9; background: #14181f; border-radius: 14px; overflow: hidden; }
.player-box iframe { width: 100%; height: 100%; border: 0; }
.player-fallback { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #777; }
.text-panel { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.action-row { display: flex; align-items: center; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 0; flex-wrap: wrap; }
.act-btn { display: flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.act-btn.active { color: var(--accent); border-color: var(--accent); }
.action-prof { margin-right: auto; text-decoration: none; color: inherit; }
.kurs-related { margin-bottom: 36px; }
.related-row { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; }
.related-row .course-card { width: 250px; flex-shrink: 0; }
.kurs-comments { max-width: 760px; margin-bottom: 40px; }
.chapters-card { padding: 14px; margin-top: 12px; }
.chapter-item { display: flex; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.chapter-item:hover { background: var(--surface-2); }
.chapter-time { width: 42px; flex-shrink: 0; }
.comment-item { display: flex; gap: 12px; margin-bottom: 18px; }
.comment-reply { display: flex; gap: 10px; margin-top: 10px; margin-left: 6px; }
@media (max-width: 900px) {
  .kurs-top { flex-direction: column; }
  .kurs-text-col { max-width: none; width: 100%; }
  .text-panel { position: static; max-height: none; }
}
.prof-card:hover { box-shadow: 0 14px 30px rgba(20,30,60,.10); transform: translateY(-3px); }
.prof-card .avatar.lg { margin: 0 auto 14px; }
.prof-card h3 { font-size: 14.5px; letter-spacing: .03em; margin-bottom: 6px; }
.prof-card p { font-size: 12.5px; color: var(--text-2); margin: 0; line-height: 1.5; }

/* ---------- Fields / Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 11px 14px; color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 90px; }
.toggle { position: relative; width: 40px; height: 23px; border-radius: 12px; background: var(--border); border: none; flex-shrink: 0; }
.toggle.on { background: var(--accent); }
.toggle .knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.on .knob { transform: translateX(17px); }

/* ---------- Card / misc ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.badge { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 7px; }
.badge.top { background: var(--warning-bg); color: var(--warning); }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.pending { background: var(--surface-2); color: var(--text-2); }
.badge.accent { background: var(--accent-100); color: var(--accent-700); }
.row { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay); display: none; align-items: center; justify-content: center; z-index: 300; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: 18px; padding: 28px; width: 420px; max-width: 100%; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 36px 0; margin-top: 60px; color: var(--text-2); font-size: 13px; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer a { color: var(--text-2); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 13.5px; opacity: 0; transition: all .25s; z-index: 400; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Admin layout (sidebar) ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 250px; flex-shrink: 0; background: var(--surface-2); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 800; font-size: 13px; letter-spacing: 0.06em; color: var(--accent-700); }
.admin-sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 14px 6px; }
.admin-navitem {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; font-weight: 500; margin-bottom: 2px;
  border: 1px solid transparent; background: transparent;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.admin-sidebar button.admin-navitem { width: 100%; text-align: left; font-family: inherit; cursor: pointer; }
.admin-navitem:hover:not(.active):not(.admin-navitem--home):not(.admin-navitem--logout) {
  background: rgba(28, 109, 255, 0.1); color: var(--accent-700); border-color: rgba(28, 109, 255, 0.2);
}
.admin-navitem.active {
  background: var(--accent-100); color: var(--accent-700); font-weight: 600;
  border-color: transparent;
}
.admin-navitem.active:hover {
  background: rgba(28, 109, 255, 0.16); color: var(--accent-700);
  border-color: transparent;
}
.admin-navitem--home { color: var(--success); }
.admin-navitem--home:hover {
  background: var(--success-bg); color: var(--success); border-color: rgba(31, 157, 85, 0.28);
}
.admin-navitem--logout { color: var(--danger); }
.admin-navitem--logout:hover {
  background: var(--danger-bg); color: var(--danger); border-color: rgba(211, 58, 58, 0.28);
}
.admin-navitem svg { flex-shrink: 0; opacity: 0.88; }
.admin-navitem.active svg { opacity: 1; color: var(--accent); }
.admin-main { flex: 1; min-width: 0; padding: 32px 36px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; gap: 16px; }
.admin-topbar-user { flex-shrink: 0; }
.admin-topbar-user-text { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.25; }
.admin-topbar-user-name { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35em; font-size: 14px; font-weight: 700; color: var(--text); }
.admin-topbar-user-first,
.admin-topbar-user-last { white-space: nowrap; }
.admin-topbar-user-role { font-size: 12px; font-weight: 600; color: var(--accent-700); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.stat-card .num { font-size: 26px; font-weight: 800; margin-top: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 11px 16px; font-size: 14px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; }
.tab.active { color: var(--accent-700); border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.card-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.iconbtn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.iconbtn:hover { background: var(--surface-hover); }

.admin-menu-btn { display: none; }
.modal-wide { width: 600px; max-width: 100%; max-height: 85vh; overflow-y: auto; }
.topic-box { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.topic-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.topic-chip input { margin: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.admin-backdrop { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 340; }
.admin-backdrop.open { display: block; }

@media (max-width: 880px) {
  .navlinks { display: none; }
  .hamburger { display: flex; }
  .grid3, .grid-professors { grid-template-columns: 1fr; }
  .admin-menu-btn { display: flex; }
  .hide-mobile { display: none; }
  .admin-sidebar {
    position: fixed; left: 0; top: 0; z-index: 350;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    display: block;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { padding: 20px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal-wide { width: 100% !important; max-height: 90vh; overflow-y: auto; }
  .cert-config-modal {
    width: 95vw;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
  }
}
