/* ================================================================
   KAFEDRALAR SAHIFASI
   ================================================================ */

:root {
    --primary:   #1566B7;
    --primary-d: #0d47a1;
    --gold:      #FFD54F;
    --text:      #2c3e50;
    --muted:     #5f738c;
    --light-bg:  #f8faff;
    --border:    #e5efff;
    --dark-bg:   #0e1a2b;
}

/* ── HEADER ── */
.kf-header {
    background: linear-gradient(135deg, var(--primary-d) 0%, var(--primary) 100%);
    padding: 64px 0 52px;
    position: relative;
    overflow: hidden;
}
.kf-header-orb { position: absolute; border-radius: 50%; pointer-events: none; }
.kf-orb-1 { width: 320px; height: 320px; left: -80px; bottom: -80px; background: rgba(255,255,255,0.05); }
.kf-orb-2 { width: 440px; height: 440px; right: -120px; top: -120px; background: rgba(255,255,255,0.04); }
.kf-header-inner { position: relative; z-index: 2; }

.kf-header .breadcrumb { background: none; padding: 0; margin-bottom: 20px; }
.kf-header .breadcrumb-item,
.kf-header .breadcrumb-item a { color: rgba(255,255,255,0.65); font-size: 13px; text-decoration: none; font-family: sans-serif; }
.kf-header .breadcrumb-item a:hover { color: var(--gold); }
.kf-header .breadcrumb-item.active { color: #fff; }
.kf-header .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,0.35); }

.kf-header-tag {
    display: inline-block; font-size: 10px; font-weight: 700;
    letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--gold); background: rgba(255,213,79,0.12);
    border: 1px solid rgba(255,213,79,0.25);
    padding: 5px 16px; border-radius: 20px; margin-bottom: 16px; font-family: sans-serif;
}
.kf-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(32px, 5vw, 52px); font-weight: 900;
    color: #fff; line-height: 1.15; margin-bottom: 12px;
}
.kf-header h1 em { font-style: italic; color: var(--gold); }
.kf-header-sub { font-size: 15px; font-weight: 300; color: rgba(255,255,255,0.6); font-family: sans-serif; margin-bottom: 32px; }

body.dark .kf-header { background: linear-gradient(135deg, #060c18 0%, #0a1628 100%); }

/* Statistika */
.kf-header-stats {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 14px 28px;
    border-radius: 16px;
}
.kf-stat { text-align: center; }
.kf-stat-num {
    font-family: 'Playfair Display', serif;
    font-size: 28px; font-weight: 900; color: #fff; line-height: 1;
}
.kf-stat-label { font-size: 11px; color: rgba(255,255,255,0.6); font-family: sans-serif; margin-top: 2px; }
.kf-stat-divider { width: 1px; height: 36px; background: rgba(255,255,255,0.2); }

/* ── TOOLBAR ── */
.kf-toolbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(21,102,183,0.07);
}
body.dark .kf-toolbar { background: #1a2740; border-color: rgba(255,255,255,0.07); }

.kf-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Qidiruv */
.kf-search-wrap {
    flex: 1; min-width: 220px;
    position: relative;
    display: flex;
    align-items: center;
}
.kf-search-wrap > i {
    position: absolute; left: 14px;
    color: var(--muted); font-size: 14px; pointer-events: none;
}
.kf-search-input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: sans-serif;
    color: var(--text);
    background: var(--light-bg);
    outline: none;
    transition: border-color 0.2s;
}
.kf-search-input:focus { border-color: var(--primary); background: #fff; }
body.dark .kf-search-input { background: #0e1a2b; border-color: rgba(255,255,255,0.1); color: #e2e8f0; }
body.dark .kf-search-input:focus { border-color: #90caf9; }

.kf-search-clear {
    position: absolute; right: 10px;
    background: none; border: none;
    color: var(--muted); cursor: pointer;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}
.kf-search-clear:hover { background: var(--border); color: var(--primary); }

/* Filter select */
.kf-filter-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 220px;
}
.kf-filter-wrap > i {
    position: absolute; left: 14px;
    color: var(--muted); font-size: 13px; pointer-events: none;
}
.kf-filter-select {
    width: 100%;
    padding: 10px 16px 10px 38px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: sans-serif;
    color: var(--text);
    background: var(--light-bg);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
}
.kf-filter-select:focus { border-color: var(--primary); }
body.dark .kf-filter-select { background: #0e1a2b; border-color: rgba(255,255,255,0.1); color: #e2e8f0; }

/* Count */
.kf-count-wrap {
    font-size: 13px;
    color: var(--muted);
    font-family: sans-serif;
    white-space: nowrap;
}
body.dark .kf-count-wrap { color: #64748b; }

/* ── SECTION ── */
.kf-section { background: var(--light-bg); padding: 48px 0 88px; }
body.dark .kf-section { background: #0a1525; }

/* ── GRID ── */
.kf-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ── KARTA ── */
.kf-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(21,102,183,0.07);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s, border-color 0.3s;
}
.kf-card.visible { opacity: 1; transform: translateY(0); }
/* Stagger — max 8 ta (keyin takrorlanadi) */
.kf-card:nth-child(1)  { transition-delay: 0s; }
.kf-card:nth-child(2)  { transition-delay: 0.05s; }
.kf-card:nth-child(3)  { transition-delay: 0.10s; }
.kf-card:nth-child(4)  { transition-delay: 0.15s; }
.kf-card:nth-child(5)  { transition-delay: 0.08s; }
.kf-card:nth-child(6)  { transition-delay: 0.13s; }
.kf-card:nth-child(7)  { transition-delay: 0.18s; }
.kf-card:nth-child(8)  { transition-delay: 0.23s; }

.kf-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--gold));
}
.kf-card.visible:hover {
    box-shadow: 0 12px 40px rgba(21,102,183,0.15);
    border-color: rgba(21,102,183,0.25);
    transform: translateY(-4px);
}
.kf-card.active {
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(21,102,183,0.2);
}
body.dark .kf-card { background: #1a2740; border-color: rgba(255,255,255,0.07); }
body.dark .kf-card.active { border-color: #90caf9; }

/* Rasm */
.kf-card-img-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}
.kf-card-img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: top;
    display: block;
    transition: transform 0.5s ease;
}
.kf-card.visible:hover .kf-card-img { transform: scale(1.05); }
.kf-card-overlay {
    position: absolute; inset: 0;
    background: rgba(13,71,161,0.5);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s;
}
.kf-card.visible:hover .kf-card-overlay { opacity: 1; }
.kf-card-overlay i { font-size: 24px; color: #fff; }
.kf-card-num {
    position: absolute; top: 10px; right: 10px;
    font-family: 'Playfair Display', serif; font-size: 12px; font-weight: 900;
    color: #fff; background: rgba(13,71,161,0.7);
    backdrop-filter: blur(4px);
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* Body */
.kf-card-body { padding: 16px 18px 12px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.kf-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 14px; font-weight: 700;
    color: var(--primary-d); line-height: 1.35;
    margin-bottom: 6px;
}
body.dark .kf-card-title { color: #90caf9; }
.kf-card-rank {
    font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
    text-transform: uppercase; color: var(--muted); font-family: sans-serif;
}
body.dark .kf-card-rank { color: #64748b; }
.kf-card-name {
    font-size: 14px; font-weight: 600;
    color: var(--dark-bg); font-family: sans-serif;
}
body.dark .kf-card-name { color: #e2e8f0; }
.kf-card-contacts {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border);
}
body.dark .kf-card-contacts { border-color: rgba(255,255,255,0.07); }
.kf-card-contacts a {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--muted); text-decoration: none;
    font-family: sans-serif; transition: color 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kf-card-contacts a:hover { color: var(--primary); }
body.dark .kf-card-contacts a { color: #64748b; }
body.dark .kf-card-contacts a:hover { color: #90caf9; }
.kf-card-contacts i { color: var(--primary); font-size: 11px; width: 13px; flex-shrink: 0; }
body.dark .kf-card-contacts i { color: #90caf9; }

/* Footer */
.kf-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 18px 14px;
    font-size: 12px; font-weight: 600;
    color: var(--primary); font-family: sans-serif;
    border-top: 1px solid var(--border);
}
body.dark .kf-card-footer { border-color: rgba(255,255,255,0.07); color: #90caf9; }
.kf-card-arrow { transition: transform 0.4s cubic-bezier(.34,1.56,.64,1); }
.kf-card-arrow.rotated { transform: rotate(180deg); }

/* ── PANEL DRAWER ── */
.kf-panel-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,22,48,0.35);
    backdrop-filter: blur(3px);
    z-index: 199;
}
.kf-panel-overlay.active { display: block; }

.kf-panel-drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 48px rgba(21,102,183,0.18);
    z-index: 200;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.kf-panel-drawer.open { transform: translateY(0); }
body.dark .kf-panel-drawer { background: #1a2740; }

/* Panel tepa chiziq */
.kf-panel-drawer::before {
    content: '';
    display: block;
    width: 48px; height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 12px auto 0;
    flex-shrink: 0;
}
body.dark .kf-panel-drawer::before { background: rgba(255,255,255,0.1); }

.kf-panel-header {
    display: flex; align-items: flex-start;
    justify-content: space-between;
    padding: 16px 32px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
body.dark .kf-panel-header { border-color: rgba(255,255,255,0.07); }

.kf-panel-kafedra-name {
    font-family: 'Playfair Display', serif;
    font-size: 20px; font-weight: 900;
    color: var(--primary-d); line-height: 1.3;
}
body.dark .kf-panel-kafedra-name { color: #90caf9; }
.kf-panel-mudur {
    font-size: 13px; color: var(--muted); margin-top: 4px; font-family: sans-serif;
}
body.dark .kf-panel-mudur { color: #64748b; }

.kf-panel-close {
    background: rgba(0,0,0,0.06); border: none;
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text); font-size: 15px;
    flex-shrink: 0; margin-left: 16px;
    transition: background 0.2s, color 0.2s;
}
.kf-panel-close:hover { background: var(--primary); color: #fff; }
body.dark .kf-panel-close { background: rgba(255,255,255,0.08); color: #e2e8f0; }

.kf-panel-body {
    padding: 24px 32px 32px;
    overflow-y: auto;
    flex: 1;
}
.kf-panel-body::-webkit-scrollbar { width: 4px; }
.kf-panel-body::-webkit-scrollbar-track { background: transparent; }
.kf-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.kf-panel-body::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.kf-panel-cols {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

.kf-pc-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
body.dark .kf-pc-header { border-color: rgba(255,255,255,0.08); }
.kf-pc-header i { font-size: 16px; color: var(--primary); }
body.dark .kf-pc-header i { color: #90caf9; }
.kf-pc-header h4 {
    font-family: 'Playfair Display', serif;
    font-size: 16px; font-weight: 700;
    color: var(--dark-bg); margin: 0;
}
body.dark .kf-pc-header h4 { color: #e8eeff; }

.kf-pc-rows { display: flex; flex-direction: column; gap: 12px; }
.kf-pc-row {
    display: flex; align-items: center; gap: 12px;
    font-size: 14px; font-family: sans-serif; color: var(--text);
}
body.dark .kf-pc-row { color: #cbd5e0; }
.kf-pc-row i { color: var(--primary); width: 16px; text-align: center; }
body.dark .kf-pc-row i { color: #90caf9; }
.kf-pc-row a { color: var(--text); text-decoration: none; }
.kf-pc-row a:hover { color: var(--primary); }
body.dark .kf-pc-row a { color: #90caf9; }

.kf-panel-bio-text {
    font-size: 14.5px; line-height: 1.85;
    color: #4a5568; font-weight: 300;
}
body.dark .kf-panel-bio-text { color: #94a3b8; }
.kf-panel-bio-text p { margin-bottom: 14px; }
.kf-panel-bio-text p:last-child { margin-bottom: 0; }

.kf-no-data { font-size: 13px; color: var(--muted); font-style: italic; font-family: sans-serif; }

/* ── EMPTY ── */
.kf-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; padding: 80px 0;
    color: var(--muted);
}
.kf-empty i { font-size: 40px; opacity: 0.4; }
.kf-empty p { font-size: 15px; font-family: sans-serif; margin: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
    .kf-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .kf-grid { grid-template-columns: repeat(2, 1fr); }
    .kf-panel-cols { grid-template-columns: 1fr; }
    .kf-panel-drawer { max-height: 80vh; }
}
@media (max-width: 576px) {
    .kf-grid { grid-template-columns: 1fr; }
    .kf-toolbar-inner { flex-direction: column; align-items: stretch; }
    .kf-filter-wrap { min-width: unset; }
    .kf-panel-header { padding: 16px 20px; }
    .kf-panel-body { padding: 20px; }
}
/* Rich editor content — kafedralar.css ga qo'shiladi */
.kf-panel-bio-text p              { margin-bottom: 12px; }
.kf-panel-bio-text p:last-child   { margin-bottom: 0; }
.kf-panel-bio-text ul,
.kf-panel-bio-text ol             { padding-left: 20px; margin-bottom: 12px; }
.kf-panel-bio-text li             { margin-bottom: 4px; }
.kf-panel-bio-text strong         { font-weight: 700; }
.kf-panel-bio-text em             { font-style: italic; }
.kf-panel-bio-text a              { color: var(--primary, #1566B7); text-decoration: underline; }
.kf-panel-bio-text a:hover        { color: var(--primary-d, #0d47a1); }
.kf-panel-bio-text h1, .kf-panel-bio-text h2, .kf-panel-bio-text h3,
.kf-panel-bio-text h4, .kf-panel-bio-text h5 {
    font-family: 'Playfair Display', serif;
    font-weight: 700; margin: 14px 0 8px; line-height: 1.3;
}
.kf-panel-bio-text blockquote {
    border-left: 3px solid var(--primary, #1566B7);
    padding-left: 14px; margin: 12px 0;
    color: #666; font-style: italic;
}
.kf-panel-bio-text img   { max-width: 100%; border-radius: 6px; margin: 8px 0; }
.kf-panel-bio-text table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.kf-panel-bio-text th,
.kf-panel-bio-text td    { border: 1px solid var(--border, #e5efff); padding: 8px 12px; font-size: 0.88rem; }
.kf-panel-bio-text th    { background: var(--light-bg, #f8faff); font-weight: 700; }