/* ===== المجمعات السكنية - ملف CSS الرئيسي ===== */

/* متغيرات CSS */
:root {
    --primary-color: #007bff;
    --secondary-color: #c6ab7b;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --white-color: #ffffff;

    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    --shadow-xl: 0 16px 32px rgba(0,0,0,0.25);

    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== أنيميشن الدخول العام ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== كلاسات الأنيميشن ===== */
.animate-fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s ease forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease forwards;
}

.animate-slide-in-bottom {
    animation: slideInFromBottom 1s ease forwards;
}

/* تأخير الأنيميشن */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-400 { animation-delay: 0.4s; }
.animate-delay-500 { animation-delay: 0.5s; }
.animate-delay-600 { animation-delay: 0.6s; }
.animate-delay-700 { animation-delay: 0.7s; }
.animate-delay-800 { animation-delay: 0.8s; }

/* ===== تأثيرات التمرير (Hover Effects) ===== */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
}

/* ===== تأثيرات الأزرار ===== */
.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-animated:hover::before {
    left: 100%;
}

.btn-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===== تأثيرات النصوص ===== */
.text-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-shadow {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.text-glow {
    text-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

/* ===== تأثيرات الخلفيات ===== */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
}

.bg-gradient-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #a0916b);
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
}

.bg-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bg-glass-dark {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== تأثيرات الحدود ===== */
.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(45deg, var(--primary-color), var(--secondary-color)) 1;
}

.border-animated {
    position: relative;
    border: 2px solid transparent;
}

.border-animated::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.border-animated:hover::before {
    opacity: 1;
}

/* ===== تأثيرات الظلال ===== */
.shadow-colored {
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
}

.shadow-colored-hover {
    transition: box-shadow var(--transition-normal);
}

.shadow-colored-hover:hover {
    box-shadow: 0 12px 35px rgba(0, 123, 255, 0.25);
}

/* ===== أنيميشن التحميل ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* ===== تأثيرات الشريط المتحرك ===== */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.marquee-content {
    display: inline-flex;
    animation: marquee-scroll 30s linear infinite;
    gap: 3rem;
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.marquee-content:hover {
    animation-play-state: paused;
}

/* ===== تأثيرات الصور ===== */
.image-overlay {
    position: relative;
    overflow: hidden;
}

.image-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0,0,0,0.3), rgba(0,123,255,0.2));
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 1;
}

.image-overlay:hover::before {
    opacity: 1;
}

.image-zoom {
    transition: transform var(--transition-slow);
}

.image-zoom:hover {
    transform: scale(1.1);
}

/* ===== تأثيرات الكروت ===== */
.card-hover {
    transition: all var(--transition-normal);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius-lg);
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* ===== تأثيرات الإشعارات ===== */
.notification-slide-in {
    animation: slideInFromRight 0.5s ease forwards;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ===== تحسينات الاستجابة ===== */
@media (max-width: 768px) {
    .animate-fade-in-up,
    .animate-fade-in-down,
    .animate-fade-in-left,
    .animate-fade-in-right {
        animation-duration: 0.6s;
    }

    .hover-lift:hover {
        transform: translateY(-3px);
    }

    .marquee-content {
        animation-duration: 20s;
        gap: 2rem;
    }
}

/* ===== تأثيرات خاصة للمجمعات ===== */
.complex-card-entrance {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
    transition: all 0.8s ease;
}

.complex-card-entrance.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.countdown-pulse {
    animation: countdownPulse 2s infinite;
}

@keyframes countdownPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }
}

.feature-icon-bounce {
    animation: iconBounce 2s infinite;
}

@keyframes iconBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* ===== تأثيرات التمرير المتقدمة ===== */
.parallax-element {
    transition: transform 0.1s ease-out;
}

.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===== تحسينات الأداء ===== */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.smooth-scroll {
    scroll-behavior: smooth;
}

/* ===== تأثيرات الفوكس ===== */
.focus-glow:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.focus-scale:focus {
    transform: scale(1.02);
}

/* ===== أزرار البيع والإيجار المودولار ===== */
.sale-rent-toggle {
    position: relative;
    display: inline-flex;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-normal);
    direction: rtl;
    font-family: 'Cairo', sans-serif;
}

.sale-rent-toggle:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.sale-rent-toggle input[type="radio"] {
    display: none;
}

.sale-rent-toggle .toggle-option {
    position: relative;
    padding: 12px 24px;
    border-radius: 46px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
    z-index: 2;
    min-width: 80px;
    text-align: center;
    color: #393939;
    background: transparent;
    border: none;
    outline: none;
}

.sale-rent-toggle .toggle-option:hover {
    color: #c6ab7b;
}

.sale-rent-toggle .toggle-slider {
    position: absolute;
    top: 4px;
    right: 4px;
    height: calc(100% - 8px);
    background: #c6ab7b;
    border-radius: 42px;
    transition: transform var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(198, 171, 123, 0.3);
}

/* عرض السلايدر للثلاثة خيارات (افتراضي) */
.sale-rent-toggle.three-options .toggle-slider {
    width: calc(33.333% - 4px);
}

/* عرض السلايدر للأربعة خيارات */
.sale-rent-toggle.four-options .toggle-slider {
    width: calc(25% - 4px);
}

.sale-rent-toggle input[type="radio"]:checked + .toggle-option {
    color: #ffffff;
    font-weight: 700;
}

/* موضع السلايدر للخيارات الثلاثة عبر CSS */
.sale-rent-toggle.three-options input[name="listingType"]:nth-of-type(2):checked ~ .toggle-slider {
    transform: translateX(-100%);
}
.sale-rent-toggle.three-options input[name="listingType"]:nth-of-type(3):checked ~ .toggle-slider {
    transform: translateX(-200%);
}

/* موضع السلايدر للخيارات الأربعة عبر CSS */
.sale-rent-toggle.four-options input[name="listingType"]:nth-of-type(2):checked ~ .toggle-slider {
    transform: translateX(-100%);
}
.sale-rent-toggle.four-options input[name="listingType"]:nth-of-type(3):checked ~ .toggle-slider {
    transform: translateX(-200%);
}
.sale-rent-toggle.four-options input[name="listingType"]:nth-of-type(4):checked ~ .toggle-slider {
    transform: translateX(-300%);
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 768px) {
    .sale-rent-toggle.three-options {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }

    .sale-rent-toggle.four-options {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    .sale-rent-toggle .toggle-option {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 60px;
    }

    .sale-rent-toggle.four-options .toggle-option {
        padding: 10px 12px;
        font-size: 12px;
        min-width: 55px;
    }
}

/* تأثيرات إضافية للتفاعل */
.sale-rent-toggle .toggle-option:active {
    transform: scale(0.98);
}

.sale-rent-toggle:focus-within {
    outline: 2px solid #c6ab7b;
    outline-offset: 2px;
}

/* تأثير النبضة للزر النشط */
.sale-rent-toggle input[type="radio"]:checked + .toggle-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 42px;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* تحسينات إضافية للمكون */
.sale-rent-toggle .toggle-option {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.sale-rent-toggle .toggle-option:focus {
    outline: 2px solid #c6ab7b;
    outline-offset: 2px;
    border-radius: 42px;
}

/* تحسين الانتقال للشريط المتحرك */
.sale-rent-toggle .toggle-slider {
    will-change: transform;
    backface-visibility: hidden;
}

/* تأثير الظل للزر النشط */
.sale-rent-toggle input[type="radio"]:checked + .toggle-option {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
