.teacher-toolbar{
    display:flex;
    gap:20px;
    margin-bottom:30px;
}

.teacher-toolbar input,
.teacher-toolbar select{
    padding:12px 18px;
    border:1px solid #ddd;
    border-radius:12px;
}

.teacher-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:30px;
}

.teacher-card{
    background:white;
    border-radius:22px;
    padding:24px;
    box-shadow: 0 8px 24px rgba(183, 228, 199, 0.55);
    transition:.3s;
}

.teacher-card:hover{
    transform:translateY(-10px);
}

.teacher-photo,
.modal-photo{
    width:140px;
    height:140px;
    border-radius:50%;
    object-fit:cover;
    border:4px solid #B7E4C7;
    display:block;
    margin:0 auto 15px auto;   /* centers horizontally */
    box-shadow:0 4px 14px rgba(0,0,0,.12);
}
.teacher-card h3{
    text-align:center;
    margin-top:15px;
}

.qualification{
    text-align:center;
    color:#666;
    margin-bottom:15px;
}

.badge{
    background:#edf5ff;
    padding:10px;
    border-radius:12px;
    margin-bottom:15px;
}

.subject-title{
    font-weight:bold;
    margin-bottom:12px;
}

.subject-box{
    background:#f8f8f8;
    padding:12px;
    margin-bottom:10px;
    border-radius:12px;
}

.principal{
    border:3px solid gold;
}

.coordinator{
    border:3px solid #6f42c1;
}

@media(max-width:1000px){
    .teacher-grid{
        grid-template-columns:repeat(2,1fr);
    }
}

@media(max-width:700px){
    .teacher-grid{
        grid-template-columns:1fr;
    }
}

.view-subjects-btn{
    width:100%;
    margin-top:15px;
    padding:12px;
    border:none;
    border-radius:12px;
    cursor:pointer;
    font-weight:600;
}

.teacher-modal{
    display:none;
    position:fixed;
    z-index:9999;
    left:0;
    top:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,.6);
}

.teacher-modal-content{
    background:#fff;
    width:550px;
    max-width:90%;
    margin:70px auto;
    padding:30px;
    border-radius:20px;
    position:relative;
}

.teacher-modal-close{
    position:absolute;
    right:20px;
    top:10px;
    font-size:32px;
    cursor:pointer;
}

.modal-header{
    display:flex;
    gap:20px;
    align-items:center;
    margin-bottom:20px;
    border-bottom:1px solid #eee;
    padding-bottom:20px;
}

.modal-photo{
    width:90px;
    height:90px;
    border-radius:50%;
    object-fit:cover;
}

.popup-subject-row{
    background:#f6f8ff;
    padding:15px;
    border-radius:12px;
    margin-bottom:10px;
}

.popup-subject-row strong{
    display:block;
    margin-bottom:5px;
}

.teacher-modal{
    display:none;
    position:fixed;
    z-index:9999;
    inset:0;
    background:rgba(0,0,0,.6);
    overflow-y:auto;   /* page overlay scrolls if needed */
}

.teacher-modal-content{
    background:#fff;
    width:550px;
    max-width:90%;
    max-height:85vh;   /* modal won't exceed viewport */
    margin:40px auto;
    padding:30px;
    border-radius:20px;
    position:relative;
    display:flex;
    flex-direction:column;
}

#teacherModalBody{
    overflow-y:auto;   /* vertical scrolling here */
    max-height:50vh;   /* scroll after this height */
    padding-right:8px; /* avoid text under scrollbar */
}
.teacher-modal{
    display:none;
    position:fixed;
    inset:0;
    z-index:99999;
    background:rgba(25, 35, 25, 0.45);
    backdrop-filter: blur(8px);
    overflow-y:auto;
}

.teacher-modal-content{
    width:620px;
    max-width:92%;
    max-height:88vh;
    margin:40px auto;
    border-radius:28px;
    overflow:hidden;
    background:#ffffff;
    box-shadow:0 25px 60px rgba(0,0,0,.22);
    animation: modalPop .35s ease;
    display:flex;
    flex-direction:column;
}

.teacher-modal-close{
    position:absolute;
    right:18px;
    top:14px;
    width:42px;
    height:42px;
    border-radius:50%;
    background:rgba(255,255,255,.2);
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    font-size:28px;
    font-weight:300;
    z-index:5;
}

.modal-header{
    position:relative;
    padding:60px 30px 25px;
    background:linear-gradient(135deg,#74C69D,#D8F3DC);
    display:flex;
    flex-direction:column;
    align-items:center;
    text-align:center;
}

.modal-photo{
    width:120px;
    height:120px;
    border-radius:50%;
    object-fit:cover;
    border:6px solid white;
    margin-bottom:16px;
    box-shadow:0 12px 28px rgba(0,0,0,.18);
}

.modal-teacher-info h3{
    margin:0;
    font-size:28px;
    color:#163020;
}

.modal-teacher-info p{
    margin:8px 0 0;
    color:#2d5a3d;
    font-size:16px;
}

.modal-body-wrapper{
    padding:25px 30px 30px;
    overflow-y:auto;
}

.modal-body-title{
    font-size:20px;
    font-weight:700;
    margin-bottom:18px;
    color:#163020;
}

#teacherModalBody{
    max-height:42vh;
    overflow-y:auto;
    padding-right:8px;
}

.popup-subject-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:15px;
    padding:16px 18px;
    margin-bottom:14px;
    border-radius:16px;
    background:linear-gradient(145deg,#f8fff9,#edf9f0);
    border:1px solid #d8f3dc;
}

.popup-subject-row strong{
    color:#1b4332;
    font-size:16px;
}

.popup-subject-row span{
    background:white;
    padding:8px 14px;
    border-radius:999px;
    font-size:14px;
    color:#2d6a4f;
}

@keyframes modalPop{
    from{
        opacity:0;
        transform:translateY(35px) scale(.96);
    }
    to{
        opacity:1;
        transform:translateY(0) scale(1);
    }
}