/* تحسينات إضافية للبطاقات القابلة للدوران */

/* ضمان عمل الدوران بشكل صحيح */
.flip-card {
    perspective: 1000px;
    transform-style: preserve-3d;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    transform: rotateY(0deg);
}

/* حالة الدوران */
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

/* الوجهان */
.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
}

/* الوجه الأمامي */
.flip-card-front {
    transform: rotateY(0deg);
}

/* الوجه الخلفي */
.flip-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e40af 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: white;
}

/* تأثيرات التمرير */
.flip-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.flip-card.flipped:hover {
    transform: translateY(-5px) scale(1.02);
}

/* تأثيرات الأزرار */
.flip-button,
.flip-back-button {
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    font-family: 'Cairo', sans-serif;
}

.flip-button:hover,
.flip-back-button:hover {
    transform: translateY(-2px);
}

/* إصلاح مشاكل الدوران في المتصفحات المختلفة */
.flip-card * {
    box-sizing: border-box;
}

/* ضمان عدم تداخل العناصر */
.flip-card-front {
    z-index: 2;
}

.flip-card.flipped .flip-card-front {
    z-index: 1;
}

.flip-card-back {
    z-index: 1;
}

.flip-card.flipped .flip-card-back {
    z-index: 2;
}

/* تحسينات الأداء */
.flip-card,
.flip-card-inner,
.flip-card-front,
.flip-card-back {
    will-change: transform;
    transform-origin: center center;
}

/* إصلاح مشكلة الوميض أثناء الدوران */
.flip-card-inner {
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

/* ضمان عمل الدوران على الأجهزة المحمولة */
@media (max-width: 768px) {
    .flip-card {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* تأثيرات إضافية للتفاعل */
.flip-card:active {
    transform: scale(0.98);
}

.flip-card.flipping {
    pointer-events: none;
}

/* تحسين النص في الوجه الخلفي */
.testimonial-text {
    position: relative;
    z-index: 3;
}

/* إضافة تأثير الظل للنص */
.testimonial-text,
.client-name,
.client-position {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* تحسين الأيقونات */
.quote-icon svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* تأثير النجوم */
.stars {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* تحسين الأزرار */
.flip-button,
.flip-back-button {
    position: relative;
    overflow: hidden;
}

.flip-button::before,
.flip-back-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.flip-button:hover::before,
.flip-back-button:hover::before {
    width: 100%;
    height: 100%;
}

/* إصلاح مشكلة التداخل */
.flip-card-front,
.flip-card-back {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ضمان عمل الدوران في جميع المتصفحات */
@supports not (transform-style: preserve-3d) {
    .flip-card.flipped .flip-card-front {
        display: none;
    }
    
    .flip-card:not(.flipped) .flip-card-back {
        display: none;
    }
}