/* Members Section */
.member-group {
    /* margin-bottom: 3rem; */
    /* Ensure anchored scroll positions appear below fixed top nav */
    scroll-margin-top: calc(var(--nav-height) + 12px);
}

.member-group > h5 {
    margin: 1rem 0;
    color: var(--text-color-light);
}

.member {
    background-color: white;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.member[style*="cursor: pointer"]:hover,
.member[data-member-id]:hover {
    background-color: var(--light-bg);
    box-shadow: 0 2px 8px var(--overlay-dark-light);
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Professor, Ph.D., Master's, and Affiliated Member Cards - Horizontal Layout */
#professor .member,
#phd .member,
#ms .member,
#affiliated .member {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    padding: 1.5rem;
    border-radius: 8px;
    background-color: white;
    overflow: hidden;
}

#phd .member,
#ms .member,
#affiliated .member {
    border: 1px solid var(--border-color);
}

#professor .member {
    background-color: var(--hover-color);
}

#professor .member .chips-container .chip {
    background-color: white;
}


#professor .member-photo,
#phd .member-photo,
#ms .member-photo,
#affiliated .member-photo {
    margin-right: 1.5rem;
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: var(--light-bg);
    overflow: hidden;
}

#professor .member-photo {
    border: 4px solid var(--primary-color);
}


#professor .member-photo img,
#phd .member-photo img,
#ms .member-photo img,
#affiliated .member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    overflow: hidden;
}

#professor .member-info,
#phd .member-info,
#ms .member-info,
#affiliated .member-info {
    flex: 1;
    overflow: hidden;
}

/* Affiliated Members Hover Content */
.affiliated-hover-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-radius: 0 0 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.affiliated-member:hover .affiliated-hover-content {
    transform: translateY(0);
}

.affiliated-email {
    font-size: 1rem;
    line-height: 1.4;
    margin: 0;
    color: white;
    font-weight: 400;
}

.affiliated-email a {
    color: inherit;
    text-decoration: none;
    font-family: 'Pretendard', 'Roboto', sans-serif;
}

.affiliated-email a:hover {
    text-decoration: underline;
}

.affiliated-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.affiliated-profile-btn {
    flex: 1;
    padding: 0 1.25rem;
    background-color: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-width: 140px;
}

.affiliated-profile-btn:hover {
    background-color: var(--overlay-light);
}

.affiliated-email-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background-color: var(--overlay-light-weak);
    color: white;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.affiliated-email-btn:hover {
    background-color: var(--overlay-light-medium);
}

.affiliated-email-btn svg {
    width: 16px;
    height: 16px;
}

/* Tooltip for email button */
.affiliated-email-btn::after {
    content: attr(data-email);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--overlay-dark-strong);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.affiliated-email-btn::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--overlay-dark-strong);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.affiliated-email-btn:hover::after,
.affiliated-email-btn:hover::before {
    opacity: 1;
}

.member-photo {
    flex-shrink: 0;
    width: 120px;
    height: 160px;
    border-radius: 4px;
    overflow: hidden;
    background-color: var(--light-bg);
    border-style: solid;
    border-width: 1px;
    border-color: var(--border-color);
}

.member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    overflow: hidden;
}

.member-info {
    flex: 1;
    overflow: hidden;
}

.member-info p {
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.member-info p:last-child {
    margin-bottom: 0;
}

.member-info h5 {
    margin-top: 0;
    overflow: hidden;
    color: var(--text-color-dark);
}

.email-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.email-link:hover {
    color: var(--secondary-color);
}

.alumni-list {
    list-style: none;
    padding: 0 !important;
    margin: 0 !important;
}

.alumni-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.alumni-list li:last-child {
    border-bottom: none;
}

.alumni-item {
    border-radius: 4px;
    padding: 0.75rem 1rem !important;
    margin: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.2s ease;
}

/* TEMPORARILY DISABLED - Will be enabled when alumni profiles are ready */
/*
.alumni-item[style*="cursor: pointer"]:hover,
.alumni-item[data-member-id]:hover {
    background-color: var(--light-bg);
}
*/

.alumni-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.alumni-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* gap: 1.5rem; */
    flex-wrap: wrap;
    flex: 1;
}

.alumni-name {
    font-weight: 400;
    display: block;
    margin-bottom: 0.25rem;
}

.alumni-current {
    color: var(--text-color);
    font-size: 0.95rem;
    text-align: right;
}

.alumni-email {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    pointer-events: auto;
}

.alumni-email:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.member-email {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    margin: 0.5rem 0;
    transition: color 0.2s ease;
    pointer-events: auto;
}

.member-email:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Responsive Design for Members */
@media (max-width: 1024px) and (min-width: 769px) {
    .members-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .member .chips-container {
        justify-content: center;
    }
    
    #members-content {
        padding-top: 3rem !important;
    }

    /* 타블렛: hover 대신 active 클래스 사용 */
    .affiliated-member:hover .affiliated-hover-content {
        transform: translateY(100%);
    }

    .affiliated-member.active .affiliated-hover-content {
        transform: translateY(0);
    }

    body.members-page .go-top {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #members-content {
        padding-top: 5rem !important;
    }

    .members-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .member {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .member-photo {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .member-photo img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
    }

    #professor .member,
    #phd .member,
    #ms .member,
    #affiliated .member {
        flex-direction: row;
        text-align: left;
        padding: 0.75rem;
        align-items: flex-start;
    }

    #professor .member-photo,
    #phd .member-photo,
    #ms .member-photo,
    #affiliated .member-photo {
        margin-right: 0;
        margin-bottom: 0;
        width: 60px;
        height: 60px;
        border-radius: 50%;
    }

    .member-info {
        gap: 0.25rem;
        flex: 1;
        min-width: 0;
    }

    .member-info h5 {
        font-size: 0.95rem;
        margin-bottom: 0.1rem;
        line-height: 1.3;
    }

    .member-info p {
        font-size: 0.8rem;
        margin-bottom: 0.1rem;
        line-height: 1.3;
    }

    .member-email {
        font-size: 0.7rem;
        margin: 0.2rem 0;
    }

    .member .chips-container {
        justify-content: flex-start;
        gap: 0.25rem;
        flex-wrap: wrap;
    }

    .member .chip {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .alumni-item {
        padding: 0.5rem 0.75rem !important;
    }

    .alumni-photo {
        width: 32px;
        height: 32px;
    }

    .alumni-name {
        font-size: 0.9rem;
    }

    .alumni-email {
        font-size: 0.8rem;
    }

    .alumni-current {
        font-size: 0.85rem;
    }

    /* 모바일: hover 대신 active 클래스 사용 */
    .affiliated-member:hover .affiliated-hover-content {
        transform: translateY(100%);
    }

    .affiliated-member.active .affiliated-hover-content {
        transform: translateY(0);
    }

    body.members-page .go-top {
        display: none !important;
    }
}

/* Member Detail View */
/* Common styles (padding, margin-top) are handled by .detail-view and .detail-content in detail-content.css */

.member-detail-layout {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.member-detail-image {
    flex: 0 0 auto;
    width: 225px;
    border-radius: 8px;
    overflow: visible;
    position: sticky;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.member-detail-image img,
.member-detail-placeholder {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    overflow: hidden;
}

.member-detail-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.member-detail-actions .affiliated-profile-btn {
    flex: 1;
    background-color: var(--primary-color);
    color: white;
    height: 44px;
    min-width: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.member-detail-actions .affiliated-profile-btn:hover {
    background-color: var(--accent-blue);
    color: white;
}

.member-detail-actions .affiliated-email-btn {
    background-color: var(--primary-color);
    color: white;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.member-detail-actions .member-detail-email-text {
    width: 100%;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 400;
}

.member-detail-actions .affiliated-email-btn:hover {
    background-color: var(--accent-blue);
    color: white;
}

.member-detail-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: var(--color-gray-light);
    border-radius: 8px;
}

.member-detail-text {
    flex: 1;
    min-width: 0;
}

/* .member-detail-description common styles are handled by .detail-description in detail-content.css */

.member-detail-skills {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.member-detail-skills h5 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 500;
}

.member-detail-skills .chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Responsive for member detail */
@media (max-width: 768px) {
    .member-detail-layout {
        flex-direction: column;
        gap: 2rem;
        width: 100%;
    }
    
    .member-detail-image {
        width: 100%;
        max-width: 225px;
        margin: 0 auto;
        position: static;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .member-detail-image img {
        width: 60%;
    }

    .member-detail-actions {
        width: 100%;
        margin-top:0;
    }

    #affiliated {
        gap:1rem;
    }

    .affiliated-member {
        margin-bottom: 0 !important;
    }

    .alumni-item-content {
        display: flex;
        align-items: start;
        /* gap: 0.5rem; */
        flex-wrap: wrap;
        flex-direction: column;
    }

    .alumni-current {
        text-align: left;
    }
}

.members-page .members-section-title:first-of-type {
    margin-top: 2rem;
}