/* ---- Dept nav ---- */
.dept-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 40px; }
.dept-nav-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 20px;
    border: 2px solid #e5e7eb; background: #fff;
    border-radius: 50px; font-size: 13px; font-weight: 700;
    color: #6b7280; cursor: pointer; transition: all 0.2s;
    text-decoration: none; font-family: 'Nunito', sans-serif;
}
.dept-nav-btn:hover { border-color: #1a56db; color: #1a56db; }

/* ---- Department block ---- */
.department-block { margin-bottom: 36px; }

.department-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 32px; padding-bottom: 20px;
    border-bottom: 3px solid #e5e7eb; position: relative;
}
.department-header::after {
    content: ''; position: absolute; bottom: -3px; left: 0;
    height: 3px; width: 80px;
    background: linear-gradient(90deg, #1a56db, #ff5252);
    border-radius: 3px;
}
.dept-icon {
    width: 54px; height: 54px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.dept-blue   { background: #dbeafe; color: #1a56db; }
.dept-red    { background: #ffe4e6; color: #e02b2b; }
.dept-purple { background: #ede9fe; color: #7c3aed; }
.dept-green  { background: #dcfce7; color: #16a34a; }

.dept-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 22px; font-weight: 900; color: #1a1a2e;
    line-height: 1.2; margin-bottom: 3px;
}
.dept-count { font-size: 13px; font-weight: 600; color: #6b7280; }

/* ======= TEACHER GRID & CARD ======= */
.teachers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.teacher-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 22px;
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: box-shadow 0.3s, border-color 0.3s, transform 0.3s;
}
.teacher-card:hover {
    border-color: #1a56db;
    box-shadow: 0 16px 48px rgba(26,86,219,0.13);
    transform: translateY(-4px);
}

/* ---- Photo ---- */
.teacher-photo-wrap {
    position: relative; width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f4f6; flex-shrink: 0;
}
.teacher-photo-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: top center;
    display: block; transition: transform 0.4s ease;
}
.teacher-card:hover .teacher-photo-wrap img { transform: scale(1.04); }

/* Placeholder */
.teacher-photo-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 52px; font-weight: 900;
    color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.15);
    user-select: none;
}
.teacher-photo-placeholder .ph-sub {
    font-size: 11px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase; opacity: 0.7;
}
.ph-blue   { background: linear-gradient(160deg, #1a56db, #3b82f6); }
.ph-red    { background: linear-gradient(160deg, #e02b2b, #f87171); }
.ph-green  { background: linear-gradient(160deg, #16a34a, #4ade80); }
.ph-purple { background: linear-gradient(160deg, #7c3aed, #a78bfa); }
.ph-yellow { background: linear-gradient(160deg, #ca8a04, #fbbf24); }
.ph-teal   { background: linear-gradient(160deg, #0d9488, #34d399); }
.ph-orange { background: linear-gradient(160deg, #ea580c, #fb923c); }

/* ===== НОВАЯ СИСТЕМА БЕЙДЖЕЙ - ТОЛЬКО ЦВЕТА ===== */
.teacher-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    backdrop-filter: blur(6px);
    color: #fff;
}

/* Базовые цвета для бейджей - добавляй нужный класс к .teacher-badge */
.badge-blue   { background: rgba(26, 86, 219, 0.88); }
.badge-red    { background: rgba(224, 43, 43, 0.88); }
.badge-green  { background: rgba(22, 163, 74, 0.88); }
.badge-purple { background: rgba(124, 58, 237, 0.88); }
.badge-orange { background: rgba(234, 88, 12, 0.88); }
.badge-teal   { background: rgba(13, 148, 136, 0.88); }
.badge-pink   { background: rgba(236, 72, 153, 0.88); }
.badge-yellow { background: rgba(202, 138, 4, 0.88); }

/* ---- Card body ---- */
.teacher-body {
    padding: 20px 22px 22px;
    flex: 1; display: flex; flex-direction: column; gap: 10px;
}
.teacher-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 15px; font-weight: 800;
    color: #1a1a2e; line-height: 1.3;
}
.teacher-roles {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.teacher-role {
    display: inline-block; padding: 4px 12px;
    background: #f3f4f6; border-radius: 50px;
    font-size: 12px; font-weight: 600; color: #374151;
}

/* ---- "Подробнее" кнопка на карточке ---- */
.teacher-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 50px;
    border: 2px solid #1a56db;
    background: transparent;
    color: #1a56db;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.teacher-modal-btn:hover {
    background: #1a56db;
    color: #fff;
}
.teacher-modal-btn .fa-arrow-right {
    font-size: 11px;
    transition: transform 0.2s;
}
.teacher-modal-btn:hover .fa-arrow-right { transform: translateX(3px); }

/* ======= MODAL ======= */
.tmodal-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.tmodal-overlay.is-open {
    opacity: 1; pointer-events: auto;
}

.tmodal-wrap {
    position: relative;
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 680px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.25);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(.34,1.4,.64,1);
    overflow: hidden;
    max-height: 95vh;
    /* НЕ ограничиваем высоту здесь */
}
.tmodal-overlay.is-open .tmodal-wrap {
    transform: translateY(0) scale(1);
}

.tmodal-close {
    position: absolute; top: 14px; right: 14px; z-index: 10;
    width: 34px; height: 34px; border-radius: 50%;
    border: none; background: rgba(255,255,255,0.9);
    font-size: 14px; cursor: pointer; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.2s, color 0.2s;
}
.tmodal-close:hover { background: #f3f4f6; color: #1a1a2e; }

/* Фото — строго квадрат через aspect-ratio */
.tmodal-photo-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
}
.tmodal-photo-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}
.tmodal-photo-wrap .teacher-photo-placeholder {
    width: 100%; height: 100%;
}

/* Бейдж поверх фото */
.tmodal-badge-wrap {
    position: absolute;
    top: 14px; left: 14px;
}

/* Контентная часть — прокручивается */
.tmodal-info-col {
    padding: 24px 28px 28px;
    overflow-y: auto;
    max-height: 55vh;   /* ограничиваем только текстовую часть */
}
.tmodal-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 19px; font-weight: 900;
    color: #1a1a2e; line-height: 1.3;
    margin-bottom: 10px;
    padding-right: 24px;
}
.tmodal-roles {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 14px;
}
.tmodal-description {
    font-size: 13px; line-height: 1.75;
    color: #4b5563;
    border-top: 1px solid #f3f4f6;
    padding-top: 14px;
    white-space: pre-line;  /* сохраняем переносы строк */
}

/* Скроллбар тонкий */
.tmodal-info-col::-webkit-scrollbar { width: 4px; }
.tmodal-info-col::-webkit-scrollbar-track { background: transparent; }
.tmodal-info-col::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* Мобилка */
@media (max-width: 500px) {
    .tmodal-overlay { padding: 0; align-items: flex-end; }
    .tmodal-wrap {
        border-radius: 20px 20px 0 0;
        max-width: 100%;
    }
    .tmodal-photo-wrap { aspect-ratio: 4 / 3; }
    .tmodal-info-col {
        padding: 20px 20px 32px;
        max-height: 45vh;
    }
}

/* ======= RESPONSIVE ======= */
@media (max-width: 900px) { .teachers-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (max-width: 768px) {
    .page-hero-title { font-size: 28px; }
    .page-hero-stats { display: none; }
    .dept-title { font-size: 18px; }
    .teachers-cta { padding: 28px 20px; }
    .teachers-cta-title { font-size: 20px; }
}
@media (max-width: 560px) {
    .teachers-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
}