/* Team Page Styles with Flip Cards */
:root {
    --purple-primary: #8c70dc;
    --purple-light: #a890e8;
    --purple-dark: #6a4fb8;
    --purple-hover: rgba(140, 112, 220, 0.1);
}

body {
    background: #000;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

main {
    background: rgba(0, 0, 0, 0.85);
    min-height: 100vh;
}

/* Hero Section */
.team-hero-section {
    height: 60vh;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), 
                url('../images/team.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    margin-bottom: 60px;
}

.hero-content h1 {
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--purple-primary);
    text-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.hero-content p {
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Team Section */
.team-section {
    padding: 60px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

.team-section .section-title {
    text-align: center;
    font-size: 3.5rem !important;
    font-weight: 900 !important;
    margin-bottom: 50px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.admin-title {
    font-size: 3.5rem !important;
    font-weight: 900 !important;
    background: linear-gradient(90deg, #ff6b6b 0%, #f7b42c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.moderator-title {
    font-size: 3.5rem !important;
    font-weight: 900 !important;
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.member-title {
    font-size: 3.5rem !important;
    font-weight: 900 !important;
    background: linear-gradient(90deg, #00ff88 0%, #00cc66 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Team Grid */
.team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    align-items: flex-start;
}

/* Members section - horizontal scroll for many members */
.member-title ~ .team-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    padding: 20px;
    gap: 30px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for members section */
.member-title ~ .team-grid::-webkit-scrollbar {
    height: 10px;
}

.member-title ~ .team-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.member-title ~ .team-grid::-webkit-scrollbar-thumb {
    background: var(--purple-primary);
    border-radius: 10px;
}

.member-title ~ .team-grid::-webkit-scrollbar-thumb:hover {
    background: var(--purple-light);
}

/* Ensure member cards don't shrink */
.member-title ~ .team-grid .flip-card {
    flex-shrink: 0;
    width: 320px;
}

/* Admin section - force all cards in one row */
.admin-title ~ .team-grid {
    flex-wrap: nowrap;
    gap: 20px; /* Reduced gap for better fit */
    overflow-x: visible; /* Remove horizontal scroll */
    justify-content: center;
    padding: 20px 10px;
    max-width: 100%;
}

/* Ensure admin cards fit in viewport */
.admin-title ~ .team-grid .flip-card {
    flex-shrink: 1; /* Allow cards to shrink */
    min-width: 240px; /* Reduced minimum width */
    width: calc(25% - 15px); /* Each card takes 25% minus gap */
    max-width: 280px;
}

/* Animation for cards appearing from center */
.flip-card {
    opacity: 0;
    transform: scale(0.8);
    animation: cardAppear 0.6s ease-out forwards;
    will-change: transform;
}

@keyframes cardAppear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stagger animation delays for center-to-sides effect */
.admin-title ~ .team-grid .flip-card:nth-child(1) { animation-delay: 0.1s; }
.admin-title ~ .team-grid .flip-card:nth-child(2) { animation-delay: 0.2s; }
.admin-title ~ .team-grid .flip-card:nth-child(3) { animation-delay: 0.3s; }
.admin-title ~ .team-grid .flip-card:nth-child(4) { animation-delay: 0.4s; }
.admin-title ~ .team-grid .flip-card:nth-child(5) { animation-delay: 0.5s; }
.admin-title ~ .team-grid .flip-card:nth-child(6) { animation-delay: 0.6s; }

.moderator-title ~ .team-grid .flip-card:nth-child(1) { animation-delay: 0.1s; }
.moderator-title ~ .team-grid .flip-card:nth-child(2) { animation-delay: 0.2s; }
.moderator-title ~ .team-grid .flip-card:nth-child(3) { animation-delay: 0.3s; }
.moderator-title ~ .team-grid .flip-card:nth-child(4) { animation-delay: 0.4s; }
.moderator-title ~ .team-grid .flip-card:nth-child(5) { animation-delay: 0.5s; }
.moderator-title ~ .team-grid .flip-card:nth-child(6) { animation-delay: 0.6s; }

.member-title ~ .team-grid .flip-card:nth-child(1) { animation-delay: 0.1s; }
.member-title ~ .team-grid .flip-card:nth-child(2) { animation-delay: 0.2s; }
.member-title ~ .team-grid .flip-card:nth-child(3) { animation-delay: 0.3s; }
.member-title ~ .team-grid .flip-card:nth-child(4) { animation-delay: 0.4s; }
.member-title ~ .team-grid .flip-card:nth-child(5) { animation-delay: 0.5s; }
.member-title ~ .team-grid .flip-card:nth-child(6) { animation-delay: 0.6s; }
.member-title ~ .team-grid .flip-card:nth-child(7) { animation-delay: 0.7s; }
.member-title ~ .team-grid .flip-card:nth-child(8) { animation-delay: 0.8s; }
.member-title ~ .team-grid .flip-card:nth-child(9) { animation-delay: 0.9s; }
.member-title ~ .team-grid .flip-card:nth-child(10) { animation-delay: 1s; }

/* Flip Card Container */
.flip-card {
    perspective: 1000px;
    height: 450px;
    width: 320px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    top: 0;
    left: 0;
}

/* Front Side */
.flip-card-front {
    background: linear-gradient(135deg, rgba(140, 112, 220, 0.1), rgba(106, 79, 184, 0.1));
    border: 2px solid var(--purple-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    transition: all 0.3s ease;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

/* Background overlay for better text visibility */
.flip-card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

/* Admin card background */
.admin-title ~ .team-grid .flip-card-front {
    background-image: url('../images/admin_card_bg.jpg');
}

/* Moderator card background */
.moderator-title ~ .team-grid .flip-card-front {
    background-image: url('../images/moderator_card_bg.jpg');
}

/* Member card background */
.member-title ~ .team-grid .flip-card-front {
    background-image: url('../images/member_card_bg.jpg');
}

.card-image {
    width: 100%;
    height: 60%;
    overflow: hidden;
    border: none;
    margin: 0;
    box-shadow: none;
    position: relative;
    z-index: 1;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-name {
    width: 100%;
    background: var(--purple-primary);
    padding: 20px 20px 20px 30px;
    position: relative;
    z-index: 1;
    clip-path: polygon(0 0, 100% 0, 85% 100%, 0 100%);
    margin-top: auto;
}

.card-name h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    text-align: left;
}

/* Fixed flip button */
.flip-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--purple-primary);
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.flip-button i {
    transition: transform 0.3s ease;
}

.flip-card:hover .flip-button {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(140, 112, 220, 0.5);
}

.flip-card:hover .flip-button i {
    transform: rotate(180deg);
}

.flip-hint {
    display: none;
}

/* Back Side */
.flip-card-back {
    background: linear-gradient(135deg, var(--purple-dark), var(--purple-primary));
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.back-content {
    text-align: center;
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow-y: auto;
}

.back-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #fff;
    margin: 0 auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.back-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.back-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    flex-shrink: 0;
}

/* Member Info Section */
.member-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 5px 0;
    flex-shrink: 0;
}

.info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    margin: 0;
}

.info-item i {
    color: #fff;
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.info-item span {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Social Icons */
.social-icons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px 0;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.social-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.social-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.social-icon:hover::before {
    transform: scale(1);
}

.social-icon.facebook {
    background: #1877f2;
}

.social-icon.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.social-icon.youtube {
    background: #ff0000;
}

.social-icon.twitter {
    background: #1da1f2;
}

.social-icon.linkedin {
    background: #0077b5;
}

.social-icon:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.social-icon i {
    position: relative;
    z-index: 1;
}

/* View Profile Button */
.view-profile-btn {
    display: inline-block; /* Make button visible */
    margin-top: 5px;
    padding: 10px 25px;
    background: #fff;
    color: var(--purple-dark);
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.view-profile-btn:hover {
    background: var(--purple-light);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.view-profile-btn i {
    margin-right: 6px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .team-grid {
        gap: 30px;
    }
    
    .flip-card {
        width: 280px;
    }
    
    /* Admin section adjustments for smaller screens */
    .admin-title ~ .team-grid {
        gap: 15px;
    }
    
    .admin-title ~ .team-grid .flip-card {
        min-width: 220px;
        width: calc(25% - 12px);
        max-width: 260px;
    }
}

@media (max-width: 1000px) {
    /* Admin section for medium screens */
    .admin-title ~ .team-grid {
        gap: 10px;
        justify-content: center;
    }
    
    .admin-title ~ .team-grid .flip-card {
        min-width: 200px;
        width: calc(25% - 8px);
        max-width: 220px;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .hero-content p {
        font-size: 1.2rem;
    }
    
    .team-section .section-title {
        font-size: 3rem;
    }
    
    .team-grid {
        gap: 25px;
        padding: 10px;
    }
    
    /* Admin section reverts to wrap on mobile/tablet */
    .admin-title ~ .team-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: 25px;
    }
    
    .admin-title ~ .team-grid .flip-card {
        min-width: auto;
        width: 100%;
        max-width: 320px;
    }
    
    .flip-card {
        height: 400px;
        width: 100%;
        max-width: 320px;
    }
    
    .card-image {
        width: 160px;
        height: 160px;
    }
    
    .card-name h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .team-section .section-title {
        font-size: 2rem;
    }
    
    .flip-card {
        height: 380px;
        width: 100%;
        max-width: 300px;
    }
}
