/* ====== تنظیمات کلی و فونت ====== */
.nikan-cards-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    direction: rtl;
    font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f172a !important;
    color: #f1f5f9;
    box-sizing: border-box;
}

.nikan-cards-container * {
    box-sizing: border-box;
}

/* ====== هدر ====== */
.nikan-cards-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #1e293b;
    position: relative;
}

.nikan-cards-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #D4AF37, transparent);
}

.nikan-cards-title {
    color: #e2e8f0 !important;
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nikan-cards-description {
    color: #94a3b8 !important;
    font-size: 1rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ====== فیلترها (جستجو) ====== */
.nikan-cards-filters {
    background: #1e293b !important;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 40px;
    border: 1px solid #334155;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.filter-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.filter-fields input,
.filter-fields select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #334155 !important;
    border-radius: 10px;
    font-size: 14px;
    background: #0f172a !important;
    color: #f8fafc !important;
    font-family: inherit;
    transition: all 0.3s ease;
    height: 48px; /* ارتفاع یکسان */
}

/* استایل مخصوص آپشن‌های کشویی (زمینه مشکی) */
.filter-fields select option {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    padding: 10px;
}

.filter-fields input:focus,
.filter-fields select:focus {
    outline: none;
    border-color: #D4AF37 !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15) !important;
}

.filter-fields input::placeholder {
    color: #64748b !important;
}

/* ====== بخش امکانات (چک‌باکس‌ها) ====== */
.filter-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    padding-top: 15px;
    border-top: 1px solid #334155;
}

.amenities-label {
    width: 100%;
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 600;
}

/* تبدیل چک‌باکس به دکمه‌های زیبا */
.checkbox-item {
    position: relative;
}

.checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    border: 1px solid #334155;
    padding: 8px 16px;
    border-radius: 20px;
    color: #cbd5e1;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.checkbox-item input[type="checkbox"]:checked + label {
    background: rgba(212, 175, 55, 0.15); /* زمینه طلایی محو */
    border-color: #D4AF37;
    color: #D4AF37;
    font-weight: 600;
}

.checkbox-item input[type="checkbox"]:hover + label {
    border-color: #64748b;
}

/* دکمه‌ها */
.filter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.filter-submit {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 40px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s;
}

.filter-reset {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    transition: transform 0.2s;
}

.filter-submit:hover,
.filter-reset:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ====== گرید کارت‌ها ====== */
.nikan-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* ====== طراحی کارت ====== */
.nikan-card {
    background: #1e293b !important;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: 100%;
}

.nikan-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    border-color: #D4AF37;
}

/* تصویر کارت */
.card-image {
    position: relative;
    height: 220px;
    width: 100%;
    background: #020617;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #334155;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    transition: transform 0.5s ease;
    background: transparent;
}

.nikan-card:hover .card-image img {
    transform: scale(1.05);
}

/* محتوای کارت */
.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #334155;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title-group {
    flex: 1;
    min-width: 120px;
}

.card-title {
    color: #f1f5f9 !important;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.4;
    text-align: right;
}

.card-subtitle {
    display: block;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.card-price-main {
    color: #D4AF37 !important;
    font-size: 1.1rem;
    font-weight: 800;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    background: rgba(212, 175, 55, 0.1);
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.card-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1 !important;
    font-size: 0.9rem;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.detail-icon {
    color: #38bdf8;
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.1);
}

.card-action {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #D4AF37 0%, #b49321 100%);
    color: #0f172a !important;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.card-action:hover {
    background: linear-gradient(135deg, #E5C158 0%, #D4AF37 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* ====== خریداران ====== */
.nikan-card.buyer-card {
    flex-direction: column !important;
    align-items: stretch !important;
    min-height: auto;
}

.buyer-card .card-image {
    padding: 20px;
    background: #0f172a;
}

.buyer-card .card-image img {
    width: auto;
    height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.3));
}

/* ====== لودینگ و پیام‌ها ====== */
.nikan-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #38bdf8;
    background: #1e293b;
    border-radius: 12px;
    border: 1px dashed #334155;
}

.nikan-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    background: #1e293b;
    border-radius: 16px;
    border: 1px dashed #334155;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.nikan-error {
    text-align: center;
    padding: 20px;
    color: #fca5a5;
    background: #7f1d1d;
    border-radius: 8px;
    grid-column: 1 / -1;
    border: 1px solid #991b1b;
}

/* ====== دکمه بارگذاری بیشتر ====== */
.nikan-load-more {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #334155;
}

.nikan-load-more-btn {
    background: #334155;
    color: #f1f5f9;
    border: 1px solid #475569;
    padding: 12px 40px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====== رسپانسیو ====== */
@media (max-width: 768px) {
    .nikan-cards-container {
        padding: 10px;
    }
    
    .nikan-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .card-image {
        height: 200px;
    }

    .filter-actions {
        flex-direction: column;
    }
    
    .filter-submit, .filter-reset {
        width: 100%;
    }
    
    /* دو ستونه کردن فیلترها در موبایل */
    .filter-fields {
        grid-template-columns: 1fr 1fr; 
    }
    
    /* اما برخی فیلترها بهتر است تمام عرض باشند */
    .filter-fields input[name="min_price"],
    .filter-fields input[name="max_price"],
    .filter-fields input[name="min_budget"],
    .filter-fields input[name="max_budget"] {
         grid-column: span 1;
    }
}

/* ====== استایل مودال جزئیات ====== */
.nikan-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: #1e293b;
    border-radius: 20px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid #334155;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #ef4444;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.modal-title {
    color: #f1f5f9;
    text-align: center;
    padding: 30px 20px 20px;
    margin: 0;
    font-size: 1.8rem;
    border-bottom: 2px solid #334155;
    background: linear-gradient(135deg, #D4AF37 0%, #b49321 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detail-section {
    padding: 20px;
    border-bottom: 1px solid #334155;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h4 {
    color: #38bdf8;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-images {
    margin-bottom: 20px;
}

.main-image {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-label {
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.95rem;
}

.detail-value {
    color: #f1f5f9;
    font-weight: 500;
    text-align: left;
    direction: ltr;
}

.price-highlight {
    color: #D4AF37 !important;
    font-weight: 700;
    font-size: 1.1rem;
}

.amenities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.amenity {
    background: #0f172a;
    border: 1px solid #334155;
    padding: 8px 16px;
    border-radius: 20px;
    color: #64748b;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.amenity.available {
    background: rgba(56, 189, 248, 0.1);
    border-color: #38bdf8;
    color: #38bdf8;
}

.detail-actions {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    border-top: 1px solid #334155;
}

.btn-primary, .btn-secondary {
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    min-width: 180px;
}

.btn-primary {
    background: linear-gradient(135deg, #D4AF37 0%, #b49321 100%);
    color: #0f172a;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #E5C158 0%, #D4AF37 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: #334155;
    color: #f1f5f9;
    border: 1px solid #475569;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.contact-btn {
    font-size: 1.1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* رسپانسیو برای مودال */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 95vh;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .detail-value {
        text-align: right;
        direction: rtl;
    }
    
    .detail-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .main-image {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .modal-title {
        font-size: 1.4rem;
        padding: 25px 15px 15px;
    }
    
    .detail-section {
        padding: 15px;
    }
    
    .amenities-list {
        justify-content: center;
    }
    
    .amenity {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* ====== استایل‌های حریم خصوصی ====== */
.privacy-notice {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 15px;
    display: inline-block;
}

.privacy-notice small {
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-badge {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-right: 5px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.privacy-note {
    color: #f87171;
    font-size: 0.8rem;
    margin-right: 8px;
    font-style: italic;
}

.btn-primary.disabled {
    background: #6b7280 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary.disabled:hover {
    background: #6b7280 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ====== نشانگر حریم خصوصی در کارت‌ها ====== */
.nikan-card .privacy-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #f87171;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}