/* ============================================
   组件：广告系统
   类型：文本广告（一行多列）/ 图片横幅广告
   ============================================ */

/* ---------- 广告区域容器 ---------- */
.ads-section {
    margin-bottom: 1.25rem;
}

/* ---------- 文本广告网格 ---------- */
.ads-text-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .65rem;
}

/* ---------- 横幅广告列表（单列，一行一个） ---------- */
.ads-banner-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
}

/* ---------- 单个文本广告项 ---------- */
.ads-text-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .75rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--app-text);
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
    min-width: 0; /* 防止溢出 */
}

.ads-text-item:hover {
    border-color: var(--app-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    transform: translateY(-2px);
    color: var(--app-text);
}

.ads-text-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 1rem;
    flex-shrink: 0;
}

.ads-text-item__body {
    min-width: 0;
    flex: 1;
}

.ads-text-item__title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--app-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ads-text-item__desc {
    font-size: .75rem;
    color: var(--app-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- 默认招租项（无广告时填充广告位） ---------- */
.ads-text-item--cta {
    border-style: dashed;
}

/* ---------- 广告标识 ---------- */
.ads-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: .6rem;
    padding: 1px 5px;
    background: rgba(0, 0, 0, .06);
    color: var(--app-text-muted);
    border-radius: 4px;
    line-height: 1.4;
}

[data-bs-theme="dark"] .ads-badge {
    background: rgba(255, 255, 255, .1);
}

.ads-badge--banner {
    top: 8px;
    right: 8px;
    font-size: .65rem;
    padding: 2px 6px;
}

/* ---------- 横幅广告 ---------- */
.ads-banner {
    display: block;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    transition: all .2s ease;
}

.ads-banner:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
    transform: translateY(-2px);
}

.ads-banner__img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 80px;
    object-fit: cover;
    background: var(--app-surface);
}

[data-bs-theme="dark"] .ads-banner__img {
    background: var(--app-surface);
}

/* ---------- 默认招租横幅（无横幅广告时） ---------- */
.ads-banner--rent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    min-height: 90px;
    padding: 1rem;
    background: var(--app-surface);
    border-style: dashed;
    text-align: left;
}

.ads-banner__rent-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 1.35rem;
    flex-shrink: 0;
}

.ads-banner__rent-body {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.ads-banner__rent-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
}

.ads-banner__rent-desc {
    font-size: .8rem;
    color: var(--app-text-muted);
}

/* ---------- 骨架屏（加载中占位） ---------- */
.ads-skeleton-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .75rem;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 10px;
    min-width: 0;
}

.ads-skeleton-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
}

.ads-skeleton-body {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex: 1;
    min-width: 0;
}

.ads-skeleton-line {
    height: .7rem;
    border-radius: 4px;
}

.ads-skeleton-line--title {
    width: 70%;
}

.ads-skeleton-line--desc {
    width: 45%;
    height: .6rem;
}

/* 横幅骨架：底色与真实横幅一致 */
.ads-skeleton-banner {
    height: 90px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background-color: var(--app-surface);
}

/* 微光扫过动画 */
.ads-skeleton-icon,
.ads-skeleton-line,
.ads-skeleton-banner {
    background-image: linear-gradient(90deg, transparent 25%, rgba(127, 127, 127, .18) 37%, transparent 63%);
    background-size: 400% 100%;
    animation: ads-skeleton-shimmer 1.4s ease infinite;
}

.ads-skeleton-icon,
.ads-skeleton-line {
    background-color: var(--app-surface-alt);
}

@keyframes ads-skeleton-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- 响应式调整 ---------- */
@media (max-width: 992px) {
    .ads-text-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: .5rem;
    }

    .ads-text-item {
        padding: .55rem .65rem;
    }
}

@media (max-width: 768px) {
    .ads-text-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: .4rem;
    }

    .ads-skeleton-icon {
        width: 30px;
        height: 30px;
    }

    .ads-text-item__icon {
        width: 30px;
        height: 30px;
        font-size: .85rem;
    }

    .ads-text-item__title {
        font-size: .78rem;
    }

    .ads-text-item__desc {
        font-size: .68rem;
    }
}

@media (max-width: 576px) {
    .ads-text-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: .4rem;
    }

    .ads-text-item {
        padding: .5rem .6rem;
        gap: .4rem;
        border-radius: 8px;
    }

    .ads-text-item__icon {
        width: 26px;
        height: 26px;
        font-size: .75rem;
        border-radius: 7px;
    }

    .ads-text-item__title {
        font-size: .72rem;
    }

    .ads-text-item__desc {
        font-size: .62rem;
    }

    .ads-badge {
        font-size: .5rem;
        padding: 1px 3px;
    }
}

/* ---------- 动画效果 ---------- */
.ads-section {
    animation: ads-fade-in .5s ease both;
}

@keyframes ads-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
