/* ===== Ads grid: පැති දෙකේ, photo වම් පැත්තේ ===== */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 760px) {
    .ad-grid { grid-template-columns: 1fr; }
}

.ad-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 132px;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .15s, box-shadow .15s;
}
.ad-card:hover { transform: translateY(-2px); }

.ad-card .ad-img {
    position: relative;
    flex: 0 0 140px;
    width: 140px;
    height: auto;
    aspect-ratio: auto;
    min-height: 132px;
    background: #e9edf1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: #7b8794;
}
.ad-card .ad-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-card .ad-body {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ad-card .ad-body h3 {
    margin: 0;
    font-size: .98rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ad-card .ad-excerpt {
    margin: 0;
    font-size: .84rem;
    line-height: 1.4;
    color: #4a5663;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ad-card .price { margin: 0; font-weight: 800; font-size: .95rem; }
.ad-card .ad-foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: .78rem;
    color: #5b6b7c;
}

/* ===== Normal ads: නිල් පාට ===== */
.ad-card.tier-normal {
    background: linear-gradient(180deg, #f0f7ff 0%, #e3efff 100%);
    border: 1px solid #b9d4f5;
}
.ad-card.tier-normal .price { color: #1558b0; }

/* ===== Super ads: කොළ පාට ===== */
.ad-card.tier-super {
    background: linear-gradient(180deg, #effaf1 0%, #d9f2de 100%);
    border: 2px solid #3cb454;
    box-shadow: 0 4px 14px rgba(60, 180, 84, .22);
}
.ad-card.tier-super .price { color: #14772b; }

/* ===== VIP ads: රන්වන් gradient ===== */
.ad-card.tier-vip {
    background: linear-gradient(135deg, #fff6cf 0%, #ffe38a 45%, #f4b73a 100%);
    border: 2px solid #c8930f;
    box-shadow: 0 6px 20px rgba(200, 147, 15, .38);
}
.ad-card.tier-vip h3 { color: #3d2a00; }
.ad-card.tier-vip .ad-excerpt { color: #5e4a14; }
.ad-card.tier-vip .price { color: #7a4b00; }
.ad-card.tier-vip .ad-foot { color: #6b5420; }

/* ===== Badges (පින්තූරේ උඩ කෙලවරේ) ===== */
.ad-card .badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    overflow: hidden;
    font-style: normal;
    font-size: .72rem;
    letter-spacing: .5px;
    padding: 3px 9px;
    border-radius: 6px;
    background: #0b6e4f;
    color: #fff;
}

.ad-card .badge.tier-badge-vip,
.ad-card .badge.tier-badge-super {
    font-weight: 900;
    animation-duration: .8s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}
.ad-card .badge.tier-badge-vip {
    background: linear-gradient(135deg, #ffd44d, #d99a00);
    color: #3d2a00;
    animation-name: glowGold;
}
.ad-card .badge.tier-badge-super {
    background: linear-gradient(135deg, #38c75b, #168a34);
    color: #fff;
    animation-name: glowGreen;
}

/* බැඩ්ජ් එක උඩින් යන ඉක්මන් shine එක */
.ad-card .badge.tier-badge-vip::after,
.ad-card .badge.tier-badge-super::after {
    content: "";
    position: absolute;
    top: 0;
    left: -70%;
    width: 45%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .9), transparent);
    transform: skewX(-20deg);
    animation: badgeShine 1.2s linear infinite;
}

@keyframes glowGold {
    0%, 100% { box-shadow: 0 0 4px 1px rgba(255, 200, 40, .7); transform: scale(1); }
    50%      { box-shadow: 0 0 14px 5px rgba(255, 190, 20, 1), 0 0 24px 8px rgba(255, 170, 0, .6); transform: scale(1.08); }
}
@keyframes glowGreen {
    0%, 100% { box-shadow: 0 0 4px 1px rgba(60, 220, 100, .7); transform: scale(1); }
    50%      { box-shadow: 0 0 14px 5px rgba(50, 230, 100, 1), 0 0 24px 8px rgba(30, 200, 80, .6); transform: scale(1.08); }
}
@keyframes badgeShine {
    0%   { left: -70%; }
    60%, 100% { left: 130%; }
}

@media (prefers-reduced-motion: reduce) {
    .ad-card .badge.tier-badge-vip,
    .ad-card .badge.tier-badge-super,
    .ad-card .badge.tier-badge-vip::after,
    .ad-card .badge.tier-badge-super::after { animation: none; }
}