/* 广告网格容器 - 一行4列 */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
    margin: 20px 0;
}

/* 单个广告卡片 - 固定高度180px（因为去掉了底部区域） */
.ad-card {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #eaeef2;
    height: 180px;
    display: flex;
    overflow: hidden;
}

.ad-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* 广告内部布局 */
.ad-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* 媒体容器 - 固定高度 */
.media-container {
    width: 100%;
    height: 120px; /* 增加高度，因为去掉了底部区域 */
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 视频容器 */
.video-wrapper {
    width: 100%;
    height: 100%;
    display: none;
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

/* 图片容器 - 普通图片 */
.image-wrapper {
    width: 100%;
    height: 100%;
    display: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
}

.image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 三小图容器 */
.three-image-wrapper {
    width: 100%;
    height: 100%;
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 2px;
    background: #f0f3f8;
}

.three-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 内容区域 - 不显示底部footer */
.ad-content {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 标题 - 调整字体大小以适应更小的卡片 */
.ad-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    cursor: pointer;
    text-align: center;
}

.ad-title:hover {
    color: #0d6efd;
}

/* 描述 - 可选，如果不想显示描述可以隐藏 */
.ad-description {
    display: none; /* 隐藏描述，节省空间 */
}

/* 底部区域 - 完全隐藏 */
.ad-footer {
    display: none !important; /* 强制隐藏底部区域 */
}

/* 广告Logo */
.ad-logo {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: rgba(0,0,0,0.5);
    z-index: 2;
    object-fit: contain;
}

/* 错误提示 */
.ad-error {
    text-align: center;
    padding: 60px 0;
    color: #94a3b8;
    font-size: 14px;
    background: #fff;
    border-radius: 12px;
    grid-column: 1 / -1;
    border: 1px solid #eaeef2;
}

/* 加载提示 */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    grid-column: 1 / -1;
    font-size: 14px;
}

/* 刷新按钮 */
.refresh-btn {
    text-align: center;
    margin-top: 30px;
}

.btn {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #0b5ed7;
}

.btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ad-grid {
        grid-template-columns: repeat(2, 1fr); /* 移动端显示2列 */
    }
}

@media (max-width: 480px) {
    .ad-grid {
        grid-template-columns: 1fr; /* 小屏幕显示1列 */
    }
}