/* ==========================================================================
   TEAM SLIDER - اسلایدشو تیم در موبایل - دوتا دوتا هر 5 ثانیه
   ========================================================================== */

/* ---------- Desktop - Normal Grid ---------- */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
}

/* ---------- Mobile Slider Wrapper ---------- */
.team-slider-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.team-slider-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.team-slide-group {
    min-width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 10px;
    box-sizing: border-box;
}

/* Single card in group when odd */
.team-slide-group.single {
    grid-template-columns: 1fr;
    max-width: 280px;
    margin: 0 auto;
}

/* ---------- Flip Animation ---------- */
.team-slide-group {
    animation: slideIn 0.6s ease;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(50px) rotateY(15deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) rotateY(0);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.team-slide-group.slide-out {
    animation: slideOut 0.6s ease forwards;
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: translateX(0) rotateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50px) rotateY(-15deg);
    }
}

/* Page flip effect */
.team-slider-wrapper.flip-effect .team-slide-group {
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

@keyframes pageFlip {
    0% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotateY(90deg) scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
}

.team-slide-group.flipping {
    animation: pageFlip 0.8s ease-in-out;
}

/* ---------- Dots Navigation ---------- */
.team-slider-dots {
    display: none;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    padding: 10px;
}

.team-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(201, 161, 74, 0.3);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.team-slider-dot.active {
    background: #c9a14a;
    width: 28px;
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(201, 161, 74, 0.5);
}

.team-slider-dot:hover {
    background: rgba(201, 161, 74, 0.6);
    transform: scale(1.2);
}

/* ---------- Progress Bar - 5 seconds ---------- */
.team-slider-progress {
    display: none;
    height: 3px;
    background: rgba(201, 161, 74, 0.2);
    border-radius: 3px;
    margin-top: 16px;
    overflow: hidden;
    position: relative;
}

.team-slider-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #9a7a30, #c9a14a, #e8c476);
    width: 0;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.team-slider-progress-bar.animate {
    animation: progressFill 5s linear forwards;
}

@keyframes progressFill {
    0% { width: 0; }
    100% { width: 100%; }
}

/* ---------- Counter ---------- */
.team-slider-counter {
    display: none;
    text-align: center;
    margin-top: 12px;
    color: #a0a0a0;
    font-size: 13px;
    font-family: 'Vazirmatn', sans-serif;
}

.team-slider-counter .current {
    color: #c9a14a;
    font-weight: 700;
    font-size: 16px;
}

/* ---------- Mobile Only - Show Slider ---------- */
@media (max-width: 768px) {
    .team-slider-wrapper {
        display: block;
    }
    
    .team-slider-dots,
    .team-slider-progress,
    .team-slider-counter {
        display: flex;
    }
    
    .team-slider-counter {
        display: block;
    }
    
    /* Hide normal grid on mobile when slider active */
    .team-grid.mobile-slider-active {
        display: none;
    }
    
    .team-slider-wrapper:not(.active) {
        display: none;
    }
    
    .team-slider-wrapper.active {
        display: block;
    }
    
    .team-slide-group .team-card {
        margin: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .team-slide-group .team-img {
        aspect-ratio: 1;
    }
    
    .team-slide-group .team-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 14px 10px;
    }
}

@media (min-width: 769px) {
    .team-slider-wrapper {
        display: none !important;
    }
    
    .team-slider-dots,
    .team-slider-progress,
    .team-slider-counter {
        display: none !important;
    }
    
    .team-grid.mobile-slider-active {
        display: grid !important;
    }
}

/* ---------- Extra Small Mobile - 1 per view option ---------- */
@media (max-width: 480px) {
    .team-slide-group {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 0 auto;
    }
    
    /* But user wants 2 by 2, so keep 2 columns even on small, but with smaller gap */
    .team-slide-group.keep-2 {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
        gap: 10px;
    }
    
    .team-slide-group.keep-2 .team-info h3 {
        font-size: 0.8rem;
    }
    
    .team-slide-group.keep-2 .team-info span {
        font-size: 0.65rem;
    }
}

/* ---------- Auto-play pause on hover ---------- */
.team-slider-wrapper:hover .team-slider-progress-bar {
    animation-play-state: paused;
}

/* ---------- Navigation Arrows (optional) ---------- */
.team-slider-nav {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    justify-content: space-between;
    pointer-events: none;
    padding: 0 10px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .team-slider-nav {
        display: flex;
    }
}

.team-slider-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #c9a14a;
    color: #c9a14a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.team-slider-arrow:hover {
    background: #c9a14a;
    color: #0a0a0a;
    transform: scale(1.1);
}

.team-slider-arrow svg {
    width: 20px;
    height: 20px;
}

/* ---------- Accessibility ---------- */
.team-slider-wrapper:focus-within {
    outline: 2px solid #c9a14a;
    outline-offset: 4px;
    border-radius: 12px;
}

/* ---------- Loading State ---------- */
.team-slider-wrapper.loading {
    opacity: 0.5;
    pointer-events: none;
}
