/* Clients Section */
.clients-section {
    max-width: 1400px;
    margin: 4rem auto;
    padding: 3rem 2rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(66, 125, 192, 0.15);
    position: relative;
    overflow: hidden;
}

/* Background Pattern */
.clients-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(66, 125, 192, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(31, 48, 121, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.clients-container {
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Section Title */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: #1f3079;
    margin-bottom: 1rem;
    font-weight: 700;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(135deg, #203F78 0%, #427dc0 100%);
    border-radius: 2px;
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #4a5868;
    margin-bottom: 3rem;
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Clients Grid */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(5,1fr);
    gap: 2rem;
    margin-top: 3rem;
}

/* Client Card */
.client-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(66, 125, 192, 0.1);
    border: 1px solid rgba(66, 125, 192, 0.1);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

/* Hover Effect Background */
.client-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(66, 125, 192, 0.1), transparent);
    transition: left 0.6s ease;
    z-index: 0;
}

.client-card:hover::before {
    left: 100%;
}

/* Card Hover Effects */
.client-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(66, 125, 192, 0.25);
    border-color: #427dc0;
}

/* Client Logo */
.client-logo {
    max-width: 100%;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: all 0.4s ease;
    position: relative;
    z-index: 1;
    filter: grayscale(30%) opacity(1);
}

.client-card:hover .client-logo {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.1);
}

/* Loading Animation for Images */
.client-logo {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .clients-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 968px) {
    .clients-section {
        margin: 2rem auto;
        padding: 2rem 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .section-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .clients-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .client-card {
        padding: 1.5rem;
        min-height: 100px;
    }

    .client-logo {
        max-height: 70px;
    }
}

@media (max-width: 768px) {
    .clients-section {
        margin: 2rem 1rem;
        padding: 2rem 1rem;
        border-radius: 20px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .clients-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .client-card {
        padding: 1.2rem;
        min-height: 90px;
    }

    .client-logo {
        max-height: 60px;
    }
}

@media (max-width: 480px) {
    .clients-section {
        margin: 1.5rem 0.5rem;
        padding: 1.5rem 1rem;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .clients-grid {
        grid-template-columns: repeat(2, 1fr); /* تغییر از 1fr به 2 ستون */
        gap: 1rem;
    }

    .client-card {
        padding: 1rem;
        min-height: 80px;
    }

    .client-logo {
        max-height: 50px;
    }
}

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

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card Animation on Load */
.client-card {
    animation: slideInScale 0.6s ease forwards;
    opacity: 0;
}

/* Staggered Animation Delays */
.client-card:nth-child(1) { animation-delay: 0.1s; }
.client-card:nth-child(2) { animation-delay: 0.2s; }
.client-card:nth-child(3) { animation-delay: 0.3s; }
.client-card:nth-child(4) { animation-delay: 0.4s; }
.client-card:nth-child(5) { animation-delay: 0.5s; }
.client-card:nth-child(6) { animation-delay: 0.6s; }
.client-card:nth-child(7) { animation-delay: 0.7s; }
.client-card:nth-child(8) { animation-delay: 0.8s; }

/* Logo Animation Delays */
.client-card:nth-child(1) .client-logo { animation-delay: 0.2s; }
.client-card:nth-child(2) .client-logo { animation-delay: 0.3s; }
.client-card:nth-child(3) .client-logo { animation-delay: 0.4s; }
.client-card:nth-child(4) .client-logo { animation-delay: 0.5s; }
.client-card:nth-child(5) .client-logo { animation-delay: 0.6s; }
.client-card:nth-child(6) .client-logo { animation-delay: 0.7s; }
.client-card:nth-child(7) .client-logo { animation-delay: 0.8s; }
.client-card:nth-child(8) .client-logo { animation-delay: 0.9s; }

/* Pulse Effect for Active State */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(66, 125, 192, 0.1);
    }
    50% {
        box-shadow: 0 8px 30px rgba(66, 125, 192, 0.2);
    }
}

.client-card:hover {
    animation: pulse 2s ease-in-out infinite;
}

/* Loading State for Images */
.client-logo[src=""] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Error State for Broken Images */
.client-logo[alt]::after {
    content: attr(alt);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4a5868;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.client-logo[src=""]:after,
.client-logo[src*="placeholder"]:after {
    display: block;
}

/* Print Styles */
@media print {
    .clients-section {
        background: white;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .client-card {
        break-inside: avoid;
        background: white;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .client-logo {
        filter: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .clients-section {
        border: 2px solid #000;
        background: #fff;
    }

    .client-card {
        border: 2px solid #000;
        background: #fff;
    }

    .section-title {
        color: #000;
    }

    .section-subtitle {
        color: #333;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .client-card,
    .client-logo,
    .client-card::before {
        animation: none;
        transition: none;
    }

    .client-card:hover {
        transform: none;
    }
}