/* Team Archive Styles */
.team-archive-content {
    padding-top: 40px;
    padding-bottom: 80px;
}

.team-archive-header {
    margin-bottom: 60px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 30px;
}

.team-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.filter-group {
    display: flex;
    align-items: center;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #888;
    transition: color 0.3s;
}

.filter-toggle:hover {
    color: #121212;
}

.filter-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: inherit;
}

.toggle-icon {
    display: flex;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.filter-toggle.is-active .toggle-icon {
    transform: rotate(180deg);
}

/* Filter Grid Container */
.filter-grid-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), margin 0.4s;
    background: #fdfdfd;
    margin-bottom: 0;
}

.filter-grid-container.is-active {
    max-height: 500px;
    /* Large enough for many categories */
    margin-bottom: 40px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 30px;
}

.filter-grid-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px 30px;
    padding: 20px 0;
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    user-select: none;
    transition: color 0.2s;
}

.checkbox-container:hover {
    color: #121212;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-mark {
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    margin-right: 10px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-container:hover input~.checkbox-mark {
    border-color: #121212;
}

.checkbox-container input:checked~.checkbox-mark {
    background-color: #121212;
    border-color: #121212;
}

.checkbox-mark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked~.checkbox-mark:after {
    display: block;
}

.checkbox-label {
    line-height: 1;
}


.team-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.team-search-wrapper input {
    border: 1px solid #e0e0e0;
    border-radius: 40px;
    /* Pill shape */
    padding: 12px 45px 12px 25px;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    width: 280px;
    color: #121212;
}

.team-search-wrapper input:focus {
    border-color: #121212;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.team-search-wrapper input::placeholder {
    color: #aaa;
}

.search-icon {
    position: absolute;
    right: 20px;
    color: #888;
    pointer-events: none;
    display: flex;
    align-items: center;
}


.team-grid-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.team-member-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.member-image-wrapper {
    flex: 0 0 160px;
    height: 160px;
    overflow: hidden;
}

.member-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* filter: grayscale(100%); */
    transition: filter 0.3s ease;
}

.team-member-card:hover .member-image-wrapper img {
    filter: grayscale(0%);
}

.member-info {
    flex: 1;
    padding-top: 5px;
}

.member-name,
.member-name a {
    font-size: 18px;
    margin: 0 0 5px 0;
    font-weight: 600;
    color: #000;
}

.member-position {
    font-size: 14px;
    margin: 0 0 5px 0;
    color: #333;
}

.member-address {
    font-size: 13px;
    margin: 0;
    color: #888;
}

.member-placeholder-img {
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
}

/* AJAX Loading State */
.team-grid.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Pagination */
.team-pagination {
    margin-top: 50px;
}

.team-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
    .team-grid-inner {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .team-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .team-grid-inner {
        grid-template-columns: 1fr 1fr;
    }

    .team-member-card {
        flex-direction: column;
    }

    .member-image-wrapper {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* Modal Popup Styles */
body.modal-open {
    overflow: hidden;
}

.team-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    /* Changed from center to allow scrolling from top */
    justify-content: flex-end;
    overflow-y: auto;
    /* Allow whole modal area to scroll */
    padding: 50px 0;
    /* Vertical breathing room */
}

.team-modal.is-active {
    display: flex;
}

.modal-overlay {
    position: fixed;
    /* Fixed so it stays behind while scrolling */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 850px;
    /* Increased from 600px */
    min-height: calc(100vh - 100px);
    /* Fill height but allow growth */
    margin-top: 0;
    margin-right: 100px;
    margin-bottom: 50px;
    background: #fff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(calc(100% + 50px)) scale(1.1);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
    display: flex;
    flex-direction: column;
    z-index: 1;
    border-radius: 4px;
    /* Optional slight rounding for premium feel */
}

.team-modal.is-active .modal-container {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.modal-close {
    position: fixed;
    /* Fixed to viewport */
    top: 50px;
    right: 50px;
    width: 50px;
    height: 50px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 30px;
    line-height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transition: transform 0.3s ease;
    padding: 0;
}

.modal-close:hover {
    transform: scale(1.1);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 50px;
    /* More padding for premium feel */
    scrollbar-width: thin;
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.modal-pre-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 25px;
}

.modal-pre-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: #e5e5e5;
}

.modal-header-label {
    font-size: 16px;
    color: #333;
    font-weight: 400;
}

.modal-label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #666;
}

.modal-body-header {
    margin-bottom: 30px;
}

.modal-member-meta {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.modal-member-title {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
    font-family: 'Cormorant Garamond', sans-serif;
    color: #121212;
}

.modal-member-image {
    margin-bottom: 40px;
}

.modal-member-image img {
    width: 100%;
    height: auto;
}

.modal-member-content {
    font-size: 18px;
    line-height: 1.6;
    color: #444;
}

/* Loading state for modal */
.modal-body.is-loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body.is-loading::after {
    content: "";
    width: 30px;
    height: 30px;
    border: 2px solid #eee;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {
    .team-modal {
        padding: 0;
    }

    .modal-container {
        max-width: 100%;
        height: auto;
        min-height: 100%;
        margin: 0;
        border-radius: 0;
        transform: translateX(100%) scale(1);
    }

    .modal-close {
        position: fixed;
        /* Keep it visible at all times */
        bottom: 30px;
        top: auto;
        right: 0;
        left: 0;
        margin: 0 auto;
        width: 50px;
        height: 50px;
        font-size: 30px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .modal-member-title {
        font-size: 32px;
    }

    .modal-content {
        padding: 40px 20px;
    }
}