.main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ads-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: var(--space-3xs);
}

.ad-card {
    display: flex;
    flex-direction: column;
    min-height: 250px;
    max-height: 100%;
    background: var(--color-card-background);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid;
    border-image: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(0,0,0,0.1)) 1;
    position: relative;
    overflow: hidden;
}

.ad-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ad-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(0,0,0,0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.ad-image-container {
    width: 100%;      /* fixed width */
    height: 250px;     /* fixed height */
    overflow: hidden;
    border-radius: 5px 5px 0 0;
    background: #f0f0f0; /* optional placeholder for empty space */
}

.ad-image-container img.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* fills the container and crops excess */
    display: block;
}

.ad-header {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2xs);
}

.ad-title {
    font-size: var(--text-base);
    font-weight: 400;
    color: #2c3e50;
    direction: rtl;
    text-align: right;
    white-space: normal;
}

.ad-title a {
    color: inherit;
    text-decoration: none;
}

.ad-title a:hover {
    color: #3498db;
}

.ad-salary {
    color: #27ae60;
    align-self: flex-end;
    font-size: var(--text-xs);
}

.ad-meta-group {
    display: flex;
    flex-direction: column;
    font-size: var(--text-sm);
    color: #2c3e50;
    padding: var(--space-2xs);
    font-weight: 380;
    white-space: normal;
    gap:var(--space-2xs);
}

.ad-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    border-radius: 0 0 10px 10px;
    font-family: "Vazir", sans-serif;
    font-size: 13px;
    margin-top: auto;
}

.ad-card-footer-statics-items {
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #666;
    transition: color 0.25s ease;
}

.stat-item i {
    font-size: 14px;
    transition: transform 0.25s ease, color 0.25s ease;
}

.stat-item:hover {
    color: #222;
}

.stat-item:hover i {
    transform: scale(1.1);
    color: #2d89ef;
}

.like-btn.active-like {
    color: #27ae60;
}

.dislike-btn.active-dislike {
    color: #e74c3c;
}

.like-btn, .dislike-btn {
    cursor: pointer;
}

.like-count, .dislike-count {
    font-weight: 500;
    font-size: 12px;
}

.ad-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f5f7fa;
    color: #2c3e50;
    transition: all 0.25s ease;
}

.ad-card-footer .ad-link:hover {
    background: #2d89ef;
    color: #fff;
    box-shadow: 0 2px 6px rgba(45, 137, 239, 0.2);
}

.active-like {
  color: #66BB6A !important;
}

.active-dislike {
  color: #EF5350 !important; 
}

.stat-item i:hover {
  color: #000;
}

.counter-container {
    padding: 15px;
}

.counter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.counter-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.counter-label {
    font-size: 14px;
    color: #555;
}

.counter-value {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
}

.pagination-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: var(--space-3xs);
    align-items: stretch;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-width: 40px;
    padding: 0 12px;
    border-radius: 8px;
    background-color: var(--text-base);
    color: #4a5568;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.pagination-item:hover:not(.active, .disabled) {
    background-color: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.pagination-item.active {
    background-color: var(--color-accent-500);
    color: white;
    border-color: #4299e1;
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f7fa;
}

.pagination-item.arrow {
    padding: 0 15px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
}

.pagination-item.arrow:hover:not(.disabled) {
    background-color: #f5f7fa;
}

.pagination-item .text {
    margin: 0 5px;
    font-size: 14px;
}

.pagination-item .icon {
    font-size: 12px;
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 20px;
    color: #a0aec0;
}

.pagination-pages {
    justify-content: center;
    align-items: center;
    font-size: var(--text-sm);
    display: flex;
}

.no-ads {
    display: flex;
    position: relative;
    flex-direction: row;
    width: 100%;
    color: black;
    padding: 3px;
}

.search-engine-button.reset-button {
    margin-left: 8px;
    color: #c00;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1024px) {
    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
        padding: 20px;
    }
}

@media (max-width: 768px) {

    .ad-meta-group {
        flex-direction: column;
        gap: 5px;
    }
    .ads-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .ad-image-container {
        height: 180px;
    }
    
    .ad-content {
        padding: 0;
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .ad-header {
        padding: 0 3px;
        display: flex;
        flex-direction: column;
        max-width: 100%;
        width: 100%;
    }

    .ad-title {
        padding: 3px;
        font-size: var(--text-base);
        white-space: normal;
    }

    .ad-link {
        font-size: 0.8rem;
    }

    .ad-meta-group {
        max-width: 100%;
        font-size: 0.8rem;
    }

    .ad-description {
        white-space: normal;
        max-width: 100%;
        font-size: 0.8rem;
    }

    #search-engine-input {
        font-size: 0.7rem;
    }

    .main-nav {
        padding: 0.1rem;
    }
     .pagination {
        gap: 5px;
    }
    
    .pagination-item {
        height: 36px;
        min-width: 36px;
        padding: 0 10px;
        font-size: 14px;
    }
    
    .pagination-item.arrow .text {
        display: none;
    }
    
    .pagination-item.arrow {
        padding: 0 10px;
    }
}