/* 🎨 استایل‌های پیشرفته و کاملاً رسپانسیو برای لیست آگهی‌ها */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
    font-weight: 800;
}

.ads-directory {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    /*font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */
    font-family: 'Vazirmatn';
}

/* 🎴 استایل‌های گرید آگهی‌ها - کاملاً رسپانسیو */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

/* حالت کارت افقی فشرده برای موبایل */
@media (max-width: 768px) {
    .ads-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .ad-card {
        display: flex;
        flex-direction: row;
        height: 110px;
        border-radius: 10px;
        overflow: hidden;
        margin-bottom: 8px;

        flex: 1 1 auto;
        min-width: 0; 
    }
    
    .ad-image {
        width: 90px;
        height: 100%;
        min-width: 90px;
        border-radius: 10px 0 0 10px;
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    }
    
    .ad-image img {
        height: 100%;
        width: 100%;
        object-fit: cover;
    }
    
    .ad-content {
        padding: 10px 12px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between !important;
        overflow: hidden;
        color: #790733;
        text-overflow: ellipsis;
        white-space: normal !important; /* ✔ اجازه دوخطی */
    }
    
    .ad-title {
        color: #790733;
        font-size: 16px !important;
        font-weight: 800;
        font-family: 'Vazirmatn', sans-serif;
        line-height: 1.4;

        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
    
        overflow: hidden !important;
    }
    
    .ad-price {
        font-size: 15px;
        margin-bottom: 5px;
        font-weight: 700;
        color: #00b894;
        white-space: nowrap !important;
    }
    
    .ad-location {
        color: #790733;
        font-size: 10px;
        font-weight: 400;
        font-family: 'Vazirmatn', sans-serif;
        margin-bottom: 5px;
        white-space: nowrap !important;

    }
    
    .ad-meta {
        padding-top: 6px;
        margin-top: auto;
        border-top: 1px solid #f1f2f6;
        white-space: nowrap !important;
    }
    
    .ad-date {
        color: #f4400a !important;
        font-size: 10px !important;
        font-weight: 400 !important;
        font-family: 'Vazirmatn', sans-serif;
        background-color: #f7f6f5 !important;
            position: relative;   /* نه absolute */
            margin-top: 0px;     /* فاصله از محتوا */
            margin-left: 100%; 
            display: inline-block;

        
    }
    .ad-category {
        color: #f3eef0 !important;
        font-size: 12px !important;
        font-weight: 700;
        font-family: 'Vazirmatn', sans-serif;
         background: linear-gradient(135deg, #470cd1 0%, #e36b09 100%) !important;

        position: absolute;
        left: 10px;
        

    }
    

    
    .featured-badge {
        font-size: 9px;
        padding: 3px 8px;
        top: 6px;
        left: 6px;
    }
    
    .ad-card:hover {
        transform: none;
        box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    }
    
    /* کاهش padding کلی در موبایل */
    .ads-directory {
        padding: 12px 12px;
    }

    * {
        text-decoration: none !important;
    }

    /* نشان‌های ویژگی‌های آگهی */
    .ad-feature-badges {
        position: absolute;
        top: 60%;
        left: 15px;
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        z-index: 10;
    }
    
}

* {
    text-decoration: none !important;
}

/* حالت کارت برای تبلت */
@media (min-width: 769px) and (max-width: 1024px) {
    .ads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* حالت کارت برای دسکتاپ کوچک */
@media (min-width: 1025px) and (max-width: 1366px) {
    .ads-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 25px;
    }
}

/* حالت کارت برای دسکتاپ بزرگ */
@media (min-width: 1367px) {
    .ads-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 30px;
    }
}

/* 🃏 استایل‌های کارت آگهی - مدرن و تعاملی */
.ad-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
    
}

.ad-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.ad-card.featured {
    border: 2px solid #0a6762;
    background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
}

.featured-badge {
    background: linear-gradient(135deg, #c70569 0%, #f00457 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(253, 203, 110, 0.4);
    animation: pulse 2s infinite;
}

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

.ad-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
   
        justify-content: center;
}

.ad-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.6s ease;
}

.ad-card:hover .ad-image img {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ad-card:hover .image-overlay {
    opacity: 1;
}

.ad-content {
    padding: 10px;
    position: relative;
    font-weight: 800;
    font-family: 'Vazirmatn', sans-serif;
}

.ad-title {
    font-size: 17px;
    font-weight: 800;
    font-family: 'Vazirmatn', sans-serif;
    margin-bottom: 8px;
    line-height: 1.4;
    
    /* روش مطمئن برای محدود کردن به 2 خط */
    display: block;
    display: -webkit-box;
    max-width: 100%;
    height: 2.8em;
    margin: 0 auto;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    
    /* پشتیبانی از مرورگرهای مدرن */
    line-clamp: 2;
    box-orient: vertical;
}
.ad-title a {
    color: #900606;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ad-title a:hover {
    color: #0984e3;
}

.ad-price {
    font-size: 20px;
    font-weight: 800;
    color: #00b894;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ad-location {
    color: #790733;
    font-size: 18px;
    font-weight: 800;
    font-family: 'Vazirmatn', sans-serif;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-location i {
    color: #f2082b;
}

.ad-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f1f2f6;
}

.ad-category {
    background: linear-gradient(135deg, #470cd1 0%, #e36b09 100%)!important;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
}

.ad-date {
    color: #b2bec3;
    font-size: 12px;
    font-weight: 500;
}

/* 🔄 استایل‌های بارگذاری بیشتر */
.load-more-container {
    text-align: center;
    margin: 40px 0;
}

.load-more-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.load-more-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
    background: #b2bec3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ⏳ استایل‌های وضعیت بارگذاری */
.loading-status {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 20px;
    color: #636e72;
    grid-column: 1 / -1;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}

.loading-spinner {
    border: 4px solid #f1f2f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* ❌ استایل‌های وضعیت خطا و عدم وجود آگهی */
.no-ads, .error-message {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 20px;
    color: #636e72;
    grid-column: 1 / -1;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}

.no-ads-icon, .error-message i {
    font-size: 64px;
    color: #b2bec3;
    margin-bottom: 25px;
}

/* 🖥️ استایل‌های رسپانسیو برای تبلت */
@media (min-width: 769px) and (max-width: 1024px) {
    .ads-directory {
        padding: 20px;
    }
    
    .ads-grid {
        gap: 20px;
    }
    
    .ad-image {
        height: 200px;
    }
}

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

.stagger-animation > * {
    animation: stagger 0.5s ease forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes stagger {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🖨️ استایل‌های چاپ */
@media print {
    .ads-filters, .load-more-container {
        display: none;
    }
    
    .ads-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .ad-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
/* 🎴 بهینه‌سازی نهایی برای موبایل - خوانایی و زیبایی بهتر */
@media (max-width: 768px) {
    .ads-directory {
        padding: 12px 8px !important;
    }
    
    .ads-grid {
        gap: 10px !important;
        margin: 20px 0 !important;
    }
    
    .ad-card {
        display: flex;
        flex-direction: row;
        height: 180px !important; /* افزایش ارتفاع برای نمایش بهتر */
        border-radius: 12px;
        margin-bottom: 8px;
        padding: 0 !important;
        background: white;
        box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    }
    
    .ad-image {
        width: 180px !important; /* افزایش عرض تصویر */
        height: 180px !important;
        min-width: 100px !important;
        border-radius: 0px 0 0 0px;
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    }
    
    .ad-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 0px 0 0 0px;
    }
    
    .ad-content {
        padding: 8px 10px !important; /* افزایش فضای داخلی */
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-width: 0;


    }
    
    .ad-title {
        color: #790733;
        font-size: 14px;
        font-weight: 700;
        font-family: 'Vazirmatn', sans-serif;/* افزایش سایز فونت عنوان */
        height: 2.8em !important; /* فضای بیشتر برای نمایش عنوان */
        margin-bottom: 6px !important;
        line-height: 1.3;

    }
    
    .ad-price {
        font-size: 18px !important; /* بزرگتر کردن قیمت */
        margin-bottom: 5px !important;
        font-weight: 800;
        color: #00b894;
    }
    
    .ad-location {
        font-size: 12px !important; /* خوانایی بهتر مکان */
        margin-bottom: 5px !important;
        color: #636e72;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .ad-meta {
        padding-top: 8px !important;
        margin-top: auto;
        border-top: 1px solid #f1f2f6;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .ad-category {
        font-size: 6px !important;
        padding: 4px 8px !important;
        border-radius: 12px;
        font-weight: 600;

    }
    
    .ad-date {
        color: #790733;
        font-size: 18px;
        font-weight: 800;
        font-family: 'Vazirmatn', sans-serif;
         
    }
    
    .featured-badge {
        font-size: 9px !important;
        padding: 4px 8px !important;
        top: 8px !important;
        left: 8px !important;
        background: linear-gradient(135deg, #a806a0 0%, #910594 100%);
        color: white;
        border-radius: 15px;
        font-weight: 700;
        z-index: 10;
    }
    
    /* بهبود سلسله مراتب بصری */
    .ad-title a {
        color: #2d3436;
        text-decoration: none;
        transition: color 0.2s ease;
        font-weight: 800;
        font-family: 'Vazirmatn', sans-serif;
    }
    
    .ad-title a:hover {
        color: #0984e3;
    }
    
    /* نمایش بهتر آیکون‌ها */
    .ad-location i {
        color: #790733;
        font-size: 18px;
        font-weight: 800;
        font-family: 'Vazirmatn', sans-serif;
    }
    
    /* حذف افکت‌های غیرضروری در موبایل */
    .ad-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 5px 20px rgba(0,0,0,0.15) !important;
    }
    
    .image-overlay {
        display: none !important;
    }
}


/* حذف فضای هدررفته و بهینه‌سازی کلی */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }
    
    body {
        margin: 0;
        padding: 0;
    }
    
    .container {
        padding: 0 8px !important;
    }
    
    /* بهبود نمایش عنوان در 2 خط */
    .ad-title {
        display: block;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}




/* استایل‌های پایه برای دسکتاپ (بدون تغییر) */
.ads-directory {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Vazirmatn';
}

.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

/* سایر مدیا کوئری‌ها بدون تغییر باقی می‌مانند */
@media (min-width: 769px) and (max-width: 1024px) {
    .ads-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1025px) and (max-width: 1366px) {
    .ads-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (min-width: 1367px) {
    .ads-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}