/* Staff Page Styles */
.staff-page {
    padding-top: 80px;
    background-color: #ffffff;
}

/* Staff Members Grid */
.staff-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 20px;
    justify-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

/* When there's only one item */
.staff-members-grid:only-child,
.staff-members-grid > :only-child {
    grid-column: 1;
    width: 300px;
    justify-self: start;
}

/* For sections with only one item */
.staff-section:has(.staff-members-grid > :only-child) .staff-members-grid {
    justify-items: start;
    margin-left: 20px;
}

/* Individual Member Profile */
.member-profile {
    background: #ffffff;
    border: 2px solid #e1e1e1;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 300px;
}

.member-profile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(27, 48, 88, 0.2);
    border-color: #1b3058;
}

/* Member Photo Container */
.member-photo-container {
    width: 100%;
    height: 380px;
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border-bottom: 3px solid #1b3058;
}

.member-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
}

.member-profile:hover .member-photo {
    transform: scale(1.02);
}

/* Member Details */
.member-details {
    padding: 1.5rem;
    text-align: center;
    background: #ffffff;
}

.member-name {
    color: #1b3058;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    letter-spacing: 0.5px;
}

.member-position {
    display: inline-block;
    color: #1b3058;
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    background: #f0c80820;
    border: 2px solid #f0c808;
    border-radius: 30px;
    margin-top: 0.5rem;
    font-weight: 500;
}

.breadcrumb {
    background: #fff;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.breadcrumb a {
    color: #1b3058;
    text-decoration: none;
}

.breadcrumb span {
    color: #666;
}

.staff-header {
    background: linear-gradient(rgba(27, 48, 88, 0.9), rgba(27, 48, 88, 0.9)), url('../images/academic-bg.jpg');
    color: white;
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 3rem;
}

.staff-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s ease-out;
}

.staff-header p {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
}

.staff-section {
    padding: 2rem;
    margin-bottom: 3rem;
}

.staff-section h2 {
    color: #1b3058;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #f0c808;
    display: inline-block;
}

.staff-section h2 i {
    margin-right: 0.5rem;
    color: #f0c808;
}

.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2.5rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.staff-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e6e6e6;
    position: relative;
    margin-bottom: 1rem;
}

.staff-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(27, 48, 88, 0.15);
}

.staff-image {
    width: 100%;
    height: 320px;
    overflow: hidden;
    position: relative;
    background: #ffffff;
    border-bottom: 2px solid #f0f0f0;
}

.staff-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    filter: none;
    -webkit-filter: none;
}

.staff-card:hover .staff-image img {
    transform: scale(1.02);
}

.staff-card:hover .staff-image img {
    transform: scale(1.05);
}

.staff-info {
    padding: 1.5rem;
    text-align: center;
    background: #ffffff;
}

.staff-info h3 {
    color: #1b3058;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Staff Carousel Styles */
.staff-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 20px 0;
}

.staff-track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.staff-card {
    flex: 0 0 300px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s ease;
}

.staff-card:hover {
    transform: translateY(-5px);
}

.staff-image {
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.staff-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.staff-card:hover .staff-image img {
    transform: scale(1.05);
}

.staff-card h3 {
    margin: 15px 0 5px;
    color: #333;
    font-size: 1.2rem;
}

.staff-card p {
    margin: 0 0 15px;
    color: #666;
    font-size: 1rem;
}

.prev-btn,
.next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
    transition: all 0.3s ease;
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.prev-btn:hover,
.next-btn:hover {
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.prev-btn:before,
.next-btn:before {
    content: '';
    border: solid #333;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transition: border-color 0.3s ease;
}

.prev-btn:before {
    transform: rotate(135deg);
    margin-left: 4px;
}

.next-btn:before {
    transform: rotate(-45deg);
    margin-right: 4px;
}

.prev-btn:hover:before,
.next-btn:hover:before {
    border-color: #000;
}

.staff-info .role {
    color: #555;
    font-size: 1rem;
    margin: 0;
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border-radius: 20px;
    display: inline-block;
    margin-top: 0.5rem;
}

.load-more {
    display: block;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background-color: #1b3058;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.load-more:hover {
    background-color: #f0c808;
}

/* Loading and Error States */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    grid-column: 1 / -1;
}

.loading-spinner i {
    font-size: 2rem;
    color: #1b3058;
    margin-bottom: 1rem;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    grid-column: 1 / -1;
}

.error-message i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Staff Member Card */
.staff-member-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    display: flex;
    flex-direction: column;
    height: auto;
    width: 300px;
    margin: 0;
}

.staff-member-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.staff-member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.staff-image {
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
    cursor: pointer;
}

.staff-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease-out;
    cursor: pointer;
}

.staff-image:hover img {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 2;
}

.staff-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

.staff-image:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

.staff-info {
    padding: 1.5rem;
    flex: 1;
}

.staff-info h3 {
    margin: 0;
    color: #1b3058;
    font-size: 1.25rem;
    font-weight: 600;
}

.staff-role {
    color: #666;
    font-size: 0.9rem;
    margin: 0.5rem 0;
    font-style: italic;
}

.staff-contact {
    margin: 1rem 0;
}

.contact-link {
    color: #1b3058;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: #f0c808;
}

.staff-details {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.staff-department,
.staff-subjects {
    margin: 0.5rem 0;
    color: #555;
}

.staff-details i {
    margin-right: 0.5rem;
    color: #1b3058;
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-caption {
    color: white;
    margin-top: 15px;
    font-size: 1.2rem;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #f0c808;
}

/* Update staff image styles */
.staff-image {
    width: 100%;
    padding-top: 75%;
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
    cursor: pointer;
}

.staff-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.staff-image:hover img {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Add subtle hover effect */
.staff-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

.staff-image:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive Grid */
@media (max-width: 1400px) {
    .staff-members-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 768px) {
    .staff-members-grid {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .staff-member-card {
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .staff-members-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
        padding: 15px;
    }

    .staff-member-card {
        width: 280px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1400px) {
    .staff-members-grid {
        grid-template-columns: repeat(3, 300px);
        justify-content: center;
    }
}

@media (max-width: 1100px) {
    .staff-members-grid {
        grid-template-columns: repeat(2, 300px);
    }
}

@media (max-width: 768px) {
    .staff-members-grid {
        grid-template-columns: repeat(1, 300px);
    }
    
    .staff-members-grid > :only-child {
        margin: 0 auto;
        justify-self: center;
    }
    
    .staff-section:has(.staff-members-grid > :only-child) .staff-members-grid {
        margin-left: 0;
        justify-items: center;
    }
    
    .staff-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .staff-header {
        padding: 3rem 1rem;
    }
    
    .staff-header h1 {
        font-size: 2rem;
    }
    
    .staff-section {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .staff-grid {
        grid-template-columns: 1fr;
    }
    
    .staff-card {
        max-width: 100%;
    }
}
