/* Container اصلی */
.custom-tax-container {
    max-width: 100%;
    margin: 30px auto;
    padding: 0 15px;
    font-family: inherit;
    direction: rtl;
    text-align: right;
    width: 100%;
    box-sizing: border-box;
}

/* هدر و بردکرامپ */
.tax-header { margin-bottom: 20px; }
.tax-title { font-size: 28px; margin-bottom: 10px; color: #333; }
.tax-breadcrumb { font-size: 13px; color: #777; margin-bottom: 15px; }
.tax-breadcrumb a { color: #0D8385; text-decoration: none; }
.tax-breadcrumb a:hover { text-decoration: underline; }
#breadcrumbs { margin: 0; }

/* باکس توضیحات */
.tax-description-box {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.tax-description-box p { margin: 0; font-size: 15px; color: #555; }
.btn-submit-listing {
    background-color: #0D8385;
    color: #ffffff !important; /* رنگ سفید تضمین شده */
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.btn-submit-listing:hover { 
    background-color: #0a6b6d; 
    color:#ffffff !important; 
    box-shadow: 0 4px 10px rgba(13, 131, 133, 0.3);
}

/* لی‌اوت اصلی */
.tax-main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}

/* سایدبار دسکتاپ (سمت چپ) */
.tax-sidebar { 
    flex: 0 0 280px; 
    order: 2; /* در محیط RTL این مقدار باعث می‌شود سایدبار در سمت چپ قرار گیرد */
}

/* محتوای دسکتاپ (سمت راست) */
.tax-content { 
    flex: 1; min-width: 0; 
    order: 1; /* محتوای اصلی در سمت راست */
}
.tax-content.full-width { flex: 1 1 100%; order: 1; }

/* عناوین بخش‌ها */
.section-title {
    font-size: 22px;
    border-bottom: 2px solid #0D8385; 
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: inline-block;
    color: #333;
}

/* سایدبار محله‌ها */
.tax-locations-box {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
}
.sidebar-title { font-size: 18px; margin-bottom: 15px; color:#333; }
.location-search {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    box-sizing: border-box;
}
.location-search:focus { outline: none; border-color: #0D8385; }
.locations-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}
.locations-list::-webkit-scrollbar { width: 6px; }
.locations-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.locations-list li a {
    display: block;
    padding: 8px 10px;
    color: #555;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}
.locations-list li a:hover {
    background-color: #f2fbfb;
    color: #0D8385;
    padding-right: 15px;
}

/* زیردسته‌ها */
.tax-subcats-box { margin-bottom: 40px; }
.subcat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}
.subcat-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.subcat-item:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border-color: #0D8385;
}
.subcat-icon {
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    object-fit: contain;
    margin-bottom: 10px;
    color: #0D8385;
    line-height: 1;
    font-size: 30px;
}
.subcat-icon svg,
.subcat-icon img,
.subcat-item .term-icon-svg,
.subcat-item .term-icon-font,
svg.subcat-icon,
img.subcat-icon {
    width: 100% !important;
    height: 100% !important;
    max-width: 40px !important;
    max-height: 40px !important;
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
}
.subcat-item > .term-icon-svg,
.subcat-item > .term-icon-font {
    width: 40px !important;
    height: 40px !important;
    margin-bottom: 10px;
}
.subcat-name { font-size: 14px; font-weight: 500; }

/* گرید آگهی‌ها */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.listing-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}
.listing-card:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.listing-link { text-decoration: none; color: inherit; display:block; }

.listing-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
}
.listing-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.no-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
    border-radius: 0;
    background: linear-gradient(145deg, #f4f8fb 0%, #e8eff5 100%);
}

.no-thumbnail::before {
    content: "";
    width: 22px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 4px;
    display: block;
    box-sizing: border-box;
    opacity: 0.8;
}

.listing-floating-rating {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 2;
}

.listing-info { padding: 15px; text-align: center; }
.listing-title { margin: 0; font-size: 16px; color: #333; font-weight:bold;}
.listing-city {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.no-listings-msg { color: #777; font-style: italic; }

/* صفحه‌بندی */
.tax-pagination {
    margin-top: 40px;
    text-align: center;
}
.tax-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 5px;
    align-items: center;
}
.tax-pagination li { display: inline-block; }
.tax-pagination a, .tax-pagination span.current {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
}
.tax-pagination a:hover {
    background: #f2fbfb;
    border-color: #0D8385;
    color: #0D8385;
}
.tax-pagination span.current {
    background: #0D8385;
    color: #fff;
    border-color: #0D8385;
    font-weight: bold;
}

.tax-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 34px;
}

.tax-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 230px;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid #0D8385;
    border-radius: 8px;
    background: #0D8385;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(13, 131, 133, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tax-load-more-btn:hover,
.tax-load-more-btn:focus {
    background: #096f71;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(13, 131, 133, 0.24);
}

.tax-load-more-btn svg {
    flex: 0 0 auto;
}

.tax-load-more-btn:disabled {
    opacity: 0.72;
    cursor: wait;
    transform: none;
}

/* ریسپانسیو (موبایل) */
@media (max-width: 768px) {
    .tax-description-box { flex-direction: column; text-align: center; gap: 15px; }
    
    /* محله‌ها در بالاترین قسمت قرار می‌گیرند */
    .tax-sidebar { flex: 1 1 100%; order: 1; }
    
    /* محتوای اصلی (شامل دسته‌بندی‌ها در بالا و آگهی‌ها در پایین) زیر محله‌ها */
    .tax-content { flex: 1 1 100%; order: 2; }
    
    .listings-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
