:root {
    --theme-color: #006400;
}

/* 필터 버튼 */
.instructor-filter {
    margin-bottom: 40px;
    text-align: center;
}

.filter-btn {
    padding: 8px 16px;
    margin: 5px;
    border: none;
    border-radius: 20px;
    background-color: #eee;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    color: #333;
    text-decoration: none;
}

.filter-btn.active {
    background-color: var(--theme-color);
    color: white;
}

.filter-btn:hover {
    color: var(--theme-color);
    text-decoration: none;
}

/* 강사 목록 그리드 */
.instructor-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 80px;
}

/* 강사 카드 */
.instructor-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, border 0.3s;
    cursor: pointer;
    border: 2px solid #ccc;
}

.instructor-card:hover {
    transform: translateY(-5px);
    border-color: var(--theme-color);
}

/* 이미지 영역 */
.instructor-card .photo {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background-color: #eee;
    overflow: hidden;
}

.photo {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    /* 또는 contain */
    object-position: top;
    /* 필요 시 추가 */
    display: block;
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}



/* 오버레이 */
.instructor-card .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 20px;
    pointer-events: none;
    background: none;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: opacity;
    z-index: 2;
}

.instructor-card .overlay .name {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    font-weight: bold;
    font-size: 1.1rem;
    z-index: 3;
}

.instructor-card .overlay span {
    margin-top: 8px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 12px;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.instructor-card:hover .overlay span {
    opacity: 1;
}

/* 이름 - 항상 하단 표시 */
.name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    text-align: center;
    padding: 10px 0;
    font-weight: bold;
    font-size: 1.1rem;
    z-index: 2;
}

.photo:hover .hover-badge {
    opacity: 1;
}


/* 강사 요약 설명 */
.instructor-summary {
    font-size: 0.9rem;
    color: #555;
    padding: 12px 10px 0;
    white-space: pre-line;
    min-height: 40px;
    text-align: center;
}

/* 페이지네이션 */
.pagination {
    text-align: center;
    margin-top: 30px;
}

.pagination a {
    display: inline-block;
    margin: 0 5px;
    padding: 8px 12px;
    background: #eee;
    color: #333;
    border-radius: 4px;
    text-decoration: none;
}

.pagination a.active {
    background: var(--theme-color);
    color: white;
}

/* 팝업 오버레이 */
#popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

/* 팝업 창 */
#profile-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
}

#profile-popup img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 20px;
}

#profile-popup h3 {
    margin-top: 0;
}

/* ✅ 팝업 전체 배경 */
#popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

/* ✅ 팝업창 */
#profile-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    max-height: 80vh;
    /* 높이 제한 */
    overflow-y: auto;
    /* 내부 스크롤 */
    max-width: 500px;
    width: 90%;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ✅ 팝업 열릴 때 body 스크롤 막기 */
body.popup-open {
    overflow: hidden;
}

.popup-open {
    overflow: hidden;
}

@media (max-width: 1200px) {
    .instructor-grid {
        max-width: 1000px;
    }
}

@media (max-width: 1024px) {
    .instructor-grid {
        max-width: 900px;
    }
}

@media (max-width: 850px) {
    .instructor-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    .filter-btn {
        font-size: 0.9rem;
        padding: 6px 14px;
    }

    .instructor-card .overlay .name {
        font-size: 1rem;
    }

    .instructor-summary {
        font-size: 0.85rem;
        padding: 10px 8px 0;
    }
}

@media (max-width: 768px) {
    .instructor-grid {
        gap: 20px;
    }

    .filter-btn {
        font-size: 0.85rem;
        padding: 5px 12px;
    }

    .instructor-summary {
        font-size: 0.8rem;
    }

    .instructor-card .overlay .name {
        font-size: 0.95rem;
    }
}

@media (max-width: 700px) {
    .instructor-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 10px;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 4px 10px;
        margin: 3px;
    }

    .instructor-card {
        border-radius: 8px;
    }

    .instructor-card .overlay .name {
        font-size: 0.9rem;
        padding: 8px 0;
    }

    .instructor-summary {
        font-size: 0.75rem;
        padding: 8px 6px 0;
    }

    #profile-popup {
        padding: 20px;
        width: 95%;
    }

    #popup-close {
        top: 10px;
        right: 14px;
        font-size: 20px;
    }

    #profile-popup h3 {
        font-size: 1rem;
    }
}

@media (max-width: 500px) {
    .instructor-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0 8px;
    }

    .filter-btn {
        font-size: 0.75rem;
        padding: 4px 8px;
        margin: 2px;
        border-radius: 16px;
    }

    .instructor-card {
        border-radius: 6px;
    }

    .instructor-card .overlay .name {
        font-size: 0.85rem;
        padding: 6px 0;
    }

    .instructor-summary {
        font-size: 0.7rem;
        padding: 6px 4px 0;
    }

    #profile-popup {
        padding: 18px;
        width: 95%;
        font-size: 0.9rem;
    }

    #profile-popup h3 {
        font-size: 1rem;
    }

    #popup-close {
        font-size: 20px;
        top: 10px;
        right: 12px;
    }
}

@media (max-width: 400px) {
    .filter-btn {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .instructor-card .overlay .name {
        font-size: 0.8rem;
    }

    .instructor-summary {
        font-size: 0.65rem;
    }

    #profile-popup {
        padding: 16px;
        font-size: 0.85rem;
    }

    #profile-popup h3 {
        font-size: 0.95rem;
    }
}

@media (max-width: 300px) {
    .filter-btn {
        font-size: 0.65rem;
        padding: 2px 4px;
        margin: 1px;
    }

    .instructor-card .overlay .name {
        font-size: 0.75rem;
        padding: 5px 0;
    }

    .instructor-summary {
        font-size: 0.6rem;
    }

    #profile-popup {
        padding: 14px;
        font-size: 0.8rem;
    }

    #popup-close {
        font-size: 18px;
    }
}