/*
 * WPGate Property Filter - Style Sheet
 * Author: WPGate
 * Version: 1.0.0
 */

:root {
    --primary-color: #ff4d6d;
    --border-color: #ddd;
    --background-color: #e9ebee;
    --text-color: #333;
}

.wpgate-property-filter {
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    color: var(--text-color);
}

.wpgate-property-filter *,
.wpgate-property-filter span,
.wpgate-property-filter button {
    font-family: 'Tajawal', sans-serif;
}

.wpgate-property-filter .main-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* تصميم التبويب */
.wpgate-property-filter .tabs {
    display: flex;
    justify-content: center;
    margin-bottom: -10px;
    position: relative;
    z-index: 2;
}

.wpgate-property-filter .tab {
    padding: 12px 30px;
    border: 1px solid transparent;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border-radius: 8px;
    position: relative;
    background: none;
}

.wpgate-property-filter .tab.active {
    background-color: var(--primary-color);
    color: white;
}

.wpgate-property-filter .tab.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
}

.wpgate-property-filter .tab:not(.active) {
    background-color: white;
    color: var(--text-color);
    margin-right: -15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* لوحة البحث */
.wpgate-property-filter .search-panel {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.wpgate-property-filter .search-panel.hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border: none;
    margin-top: -20px;
}

.wpgate-property-filter .top-panel-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr auto;
    gap: 20px;
    align-items: center;
}

/* القوائم المنسدلة المخصصة */
.wpgate-property-filter .custom-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 15px;
}

.wpgate-property-filter .custom-select-wrapper .icon {
    color: var(--primary-color);
    margin-left: 8px;
}

.wpgate-property-filter .custom-select {
    width: 100%;
    border: none;
    background-color: transparent;
    padding: 12px 5px;
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.wpgate-property-filter .custom-select:focus {
    outline: none;
}

.wpgate-property-filter .custom-select-wrapper::after {
    content: '▼';
    font-size: 0.7em;
    color: #888;
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* شرائح التمرير */
.wpgate-property-filter .slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
}

.wpgate-property-filter .slider-label {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.wpgate-property-filter .slider-track {
    position: relative;
    width: 100%;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    margin-top: 10px;
}

.wpgate-property-filter .slider-range {
    position: absolute;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.wpgate-property-filter .slider-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: white;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    cursor: grab;
    z-index: 2;
}

.wpgate-property-filter .slider-handle:active {
    cursor: grabbing;
}

.wpgate-property-filter .slider-values {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;
    font-size: 0.95rem;
    color: #555;
}

/* الأزرار */
.wpgate-property-filter .btn {
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: 'Tajawal', sans-serif;
}

.wpgate-property-filter .btn-advanced {
    background-color: white;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpgate-property-filter .btn-search {
    background-color: var(--primary-color);
    color: white;
    padding: 13px 40px;
}

.wpgate-property-filter .btn-search:hover {
    background-color: #e6395b;
}

.wpgate-property-filter .filters-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.wpgate-property-filter .sliders-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.wpgate-property-filter .amenities-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 40px;
}

/* مربعات الاختيار المخصصة */
.wpgate-property-filter .checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
}

.wpgate-property-filter .checkbox-item .real-checkbox {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wpgate-property-filter .custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wpgate-property-filter .custom-checkbox::after {
    content: '✔';
    font-size: 14px;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.wpgate-property-filter .real-checkbox:checked + .custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.wpgate-property-filter .real-checkbox:checked + .custom-checkbox::after {
    opacity: 1;
    transform: scale(1);
}

.wpgate-property-filter .checkbox-label {
    font-size: 1rem;
    color: var(--text-color);
}

/* شبكة عرض العقارات */
.wpgate-property-filter .property-listings-grid {
    width: 100%;
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.wpgate-property-filter .property-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.wpgate-property-filter .property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.wpgate-property-filter .property-image-container {
    flex: 0 0 45%;
    position: relative;
}

.wpgate-property-filter .property-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wpgate-property-filter .property-tags {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpgate-property-filter .tag {
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.wpgate-property-filter .tag.featured {
    background-color: var(--primary-color);
}

.wpgate-property-filter .tag.status {
    background-color: rgba(17, 24, 39, 0.6);
}

.wpgate-property-filter .property-image-actions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.wpgate-property-filter .property-image-actions .icon-btn {
    background-color: rgba(17, 24, 39, 0.6);
    border-radius: 8px;
    border: none;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.wpgate-property-filter .property-image-actions .icon-btn:hover {
    background-color: rgba(17, 24, 39, 0.8);
}

.wpgate-property-filter .property-image-actions .icon-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.wpgate-property-filter .property-details {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.wpgate-property-filter .property-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #111827;
}

.wpgate-property-filter .property-title.featured-title {
    color: var(--primary-color);
}

.wpgate-property-filter .property-location {
    color: #6b7280;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
}

.wpgate-property-filter .property-location svg {
    width: 16px;
    height: 16px;
    fill: #9ca3af;
}

.wpgate-property-filter .property-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    font-size: 0.9rem;
    color: #4b5563;
}

.wpgate-property-filter .feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpgate-property-filter .feature-item svg {
    width: 20px;
    height: 20px;
    fill: #9ca3af;
}

.wpgate-property-filter .property-details .divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 20px 0;
}

.wpgate-property-filter .property-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpgate-property-filter .property-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111827;
}

.wpgate-property-filter .property-actions {
    display: flex;
    gap: 10px;
}

.wpgate-property-filter .property-actions .icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.wpgate-property-filter .property-actions .icon-btn svg {
    width: 20px;
    height: 20px;
    fill: #9ca3af;
    transition: fill 0.2s;
}

.wpgate-property-filter .property-actions .icon-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wpgate-property-filter .property-actions .icon-btn {
    position: relative;
}

.wpgate-property-filter .gallery-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
}

.wpgate-property-filter .property-actions .icon-btn:hover svg {
    fill: var(--primary-color);
}

/* النوافذ المنبثقة */
.wpgate-property-filter .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.wpgate-property-filter .modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border-radius: 12px;
    width: 80%;
    max-width: 900px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wpgate-property-filter .modal-content.gallery-modal {
    background-color: transparent;
    box-shadow: none;
    padding: 0;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

.wpgate-property-filter .gallery-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: relative;
    flex-grow: 1;
}

.wpgate-property-filter .gallery-image-container img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.wpgate-property-filter .gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 2rem;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
    z-index: 10;
}

.wpgate-property-filter .gallery-nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.wpgate-property-filter .gallery-nav-btn.prev {
    right: 20px;
}

.wpgate-property-filter .gallery-nav-btn.next {
    left: 20px;
}

.wpgate-property-filter .gallery-thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    max-width: 100%;
}

.wpgate-property-filter .thumbnail-item {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.wpgate-property-filter .thumbnail-item:hover {
    transform: scale(1.05);
}

.wpgate-property-filter .thumbnail-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px var(--primary-color);
}

.wpgate-property-filter .video-modal-content {
    width: 90%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    background-color: black;
    border-radius: 12px;
    overflow: hidden;
}

.wpgate-property-filter .video-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.wpgate-property-filter .close-button {
    color: #aaaaaa;
    font-size: 35px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    left: 15px;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 100;
}

.wpgate-property-filter .close-button:hover,
.wpgate-property-filter .close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.wpgate-property-filter .modal-content.gallery-modal .close-button {
    color: white;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
}

.wpgate-property-filter .modal-content.gallery-modal .close-button:hover {
    color: var(--primary-color);
}

/* رسائل إضافية */
.wpgate-property-filter .no-properties-found,
.wpgate-property-filter .no-search-message {
    text-align: center;
    padding: 40px 20px;
    font-size: 1.2rem;
    color: #666;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.wpgate-property-filter .no-search-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
    border: 2px dashed rgba(255,255,255,0.3);
}

.wpgate-property-filter .no-search-message::before {
    content: '🔍';
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    opacity: 0.8;
}

.wpgate-property-filter .loading-spinner {
    text-align: center;
    padding: 40px;
}

.wpgate-property-filter .loading-spinner::before {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* التصميم المتجاوب */
@media (max-width: 900px) {
    .wpgate-property-filter .top-panel-grid {
        grid-template-columns: 1fr 1fr;
    }

    .wpgate-property-filter .top-panel-grid .slider-container {
        grid-column: span 2;
        order: 3;
    }

    .wpgate-property-filter .filters-row {
        grid-template-columns: 1fr;
    }

    .wpgate-property-filter .sliders-row {
        grid-template-columns: 1fr;
    }

    .wpgate-property-filter .amenities-grid {
        grid-template-columns: 1fr;
    }

    .wpgate-property-filter .property-listings-grid {
        grid-template-columns: 1fr;
    }

    .wpgate-property-filter .modal-content {
        width: 95%;
    }
}

@media (max-width: 640px) {
    .wpgate-property-filter .property-card {
        flex-direction: column;
    }

    .wpgate-property-filter .property-image-container {
        flex: 0 0 auto;
        height: 200px;
    }

    .wpgate-property-filter .gallery-nav-btn {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }

    .wpgate-property-filter .gallery-nav-btn.prev {
        right: 5px;
    }

    .wpgate-property-filter .gallery-nav-btn.next {
        left: 5px;
    }

    .wpgate-property-filter .thumbnail-item {
        width: 60px;
        height: 45px;
    }
}

/* منع التمرير عند فتح المودال */
body.modal-open {
    overflow: hidden !important;
    padding-right: 15px; /* تعويض scrollbar */
}

body.modal-open .wpgate-property-filter {
    padding-right: 0; /* إزالة padding إضافي من الحاوي الرئيسي */
}
button#toggle-advanced-btn span {
    color: black;
}