/* ========================================= */
/* All Ads Page Styles                       */
/* ========================================= */

.ads-page-section {
    padding: 4rem 2rem;
    min-height: 80vh;
    direction: rtl;
    margin: 50px 0px 0px 0px;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;        /* so text inside stays the same */
  /* optional: remove any focus outline that would ruin the glass look */
  outline: none;
}

.card-link:hover,
.card-link:focus {
  /* you can leave hover effect on the card itself, not the link */
}

.ads-page-container {
    max-width: 1300px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    /* 320px sidebar, remainder is grid */
    gap: 2.5rem;
    align-items: start;
}

/* --- Sidebar --- */
.ads-filter-sidebar {
    padding: 2rem 1.5rem;
    position: sticky;
    top: 100px;
    /* Sticks to the top when scrolling down */
    border-radius: 20px;
}

.sidebar-title {
    font-size: 1.4rem;
    color: var(--clr-dark);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(0, 27, 46, 0.1);
    padding-bottom: 0.8rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(0, 27, 46, 0.8);
    margin-bottom: 0.8rem;
}

/* Custom Search Input inside sidebar */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper svg {
    position: absolute;
    right: 12px;
    width: 20px;
    height: 20px;
    stroke: rgba(0, 27, 46, 0.5);
}

.search-input-wrapper input {
    width: 100%;
    /* PADDING FIX: Top(1rem), Right(2.8rem), Bottom(1rem), Left(1rem) */
    padding: 1rem 2.8rem 1rem 1rem; 
    border: 2px solid rgba(0, 27, 46, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    color: var(--clr-dark);
    outline: none;
    transition: all 0.3s ease;
}

.search-input-wrapper input:focus {
    border-color: var(--clr-accent);
}
.search-input-wrapper svg {
    position: absolute;
    right: 15px; /* Placed on the right */
    width: 20px;
    height: 20px;
    stroke: rgba(0, 27, 46, 0.5);
    pointer-events: none; /* CRITICAL: Allows you to click "through" the icon into the input */
}


/* --- Ads Grid Area --- */
.ads-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.ads-header-info h2 {
    font-size: 1.8rem;
    color: var(--clr-dark);
}

.ads-count {
    color: rgba(0, 27, 46, 0.6);
    font-weight: 600;
    background: rgba(0, 27, 46, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 20px;
}

.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- Ad Card Styling --- */
.ad-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 27, 46, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ad-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 27, 46, 0.1);
}

.ad-card-image {
    position: relative;
    height: 200px;
    width: 100%;
    overflow: hidden;
}

.ad-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ad-card:hover .ad-card-image img {
    transform: scale(1.05);
}

/* Badges */
.ad-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.badge-lost {
    background: rgba(248, 228, 98, 0.9);
    color: var(--clr-dark);
}

.badge-found {
    background: rgba(35, 159, 64, 0.9);
    color: white;
}

.prize-tag {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--clr-dark);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.prize-tag svg {
    width: 18px;
    height: 18px;
    stroke: var(--clr-accent);
}

.ad-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ad-title {
    font-size: 1.15rem;
    color: var(--clr-dark);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.ad-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ad-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: rgba(0, 27, 46, 0.6);
}

.ad-meta svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.ad-excerpt {
    font-size: 0.9rem;
    color: rgba(0, 27, 46, 0.7);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;

    /* Truncate long text to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.load-more-container {
    text-align: center;
    margin-top: 3rem;
}

.custom-select {
    /* Wipe out default browser styling */
    appearance: none; 
    -webkit-appearance: none;
    -moz-appearance: none;
    
    width: 100%;
    cursor: pointer;
    
    /* Inject our own custom Navy Blue SVG arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23001b2E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    
    /* Place the arrow on the LEFT side for RTL */
    background-position: left 1rem center; 
    background-size: 1.2em;
    
    /* Add padding to the left so text doesn't overlap the new arrow */
    padding-left: 2.5rem; 
}

/* Fallback for the actual dropdown list background */
.custom-select option {
    background-color: var(--clr-bg);
    color: var(--clr-dark);
    padding: 10px;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 960px) {
    .ads-page-container {
        grid-template-columns: 1fr;
        /* Stack sidebar on top */
    }

    .ads-filter-sidebar {
        position: relative;
        top: 0;
        margin-bottom: 1rem;
    }
}

@media (max-width: 600px) {
    .ads-page-section {
        padding: 2rem 1rem;
    }

    .ads-header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .ads-grid {
        grid-template-columns: 1fr;
        /* 1 card per row on mobile */
    }
}