/* WP 多系列自助广告插件 前台样式 */

.ss-ads-wrap {
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: stretch;
}
/* 中屏（电脑窗口缩小/平板）：≤900px → 2列 */
@media (max-width: 900px) {
    .ss-ads-wrap { grid-template-columns: repeat(2, 1fr); }
}
/* 小屏（手机）：≤600px → 1列 */
@media (max-width: 600px) {
    .ss-ads-wrap { grid-template-columns: repeat(1, 1fr); }
}

.ss-ad-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* 右上角红色 Ad 标签 */
.ss-ad-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 3px;
    z-index: 9;
    font-weight: 500;
}

/* 图片容器：等比缩放不裁剪 */
.ss-ad-imgbox {
    width: 100%;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.ss-ad-imgbox img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.ss-ad-info { padding: 10px 12px; flex-grow: 1; text-align: center; display: flex; flex-direction: column; }
.ss-ad-title { font-size: 15px; font-weight: bold; color: #222; margin-bottom: 4px; word-break: normal; overflow-wrap: break-word; }
.ss-ad-gap { height: 10px; }
.ss-ad-meta { font-size: 12px; color: #666; line-height: 1.6; text-align: center; flex-grow: 1; display: flex; flex-direction: column; }
.ss-ad-meta-line { font-size: 13px; color: #333; font-weight: normal; margin-top: 2px; word-break: normal; overflow-wrap: break-word; }
.ss-ad-remain {
    display: inline-block;
    margin-top: auto;
    padding: 2px 8px;
    background: #eef6ff;
    color: #2563eb;
    border-radius: 4px;
    font-size: 11px;
}
.ss-ad-remain.ss-remain-warn {
    background: #fff1f1;
    color: #dc2626;
}

.ss-ad-empty {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border: 2px dashed #ccc;
    cursor: pointer;
    padding: 20px;
    transition: border-color 0.2s;
}
.ss-ad-empty:hover { border-color: #2563eb; }
.ss-ad-icon { font-size: 32px; margin-bottom: 6px; }
.ss-ad-slot-label { font-size: 13px; color: #999; margin-bottom: 10px; }

.ss-ad-buy-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 8px;
}
.ss-ad-buy-btn:hover { background: #1d4ed8; }
.ss-ad-price { font-size: 13px; color: #666; }

/* 弹窗 */
.ss-ads-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 99999;
}
.ss-modal-inner {
    background: #fff;
    width: 95%;
    max-width: 820px;
    overflow-y: auto;
    padding: 28px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* 左右分栏：左表单 右预览 */
.ss-modal-row {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    margin-top: 16px;
    align-items: start;
}
.ss-modal-preview-col { position: sticky; top: 20px; align-self: start; }
.ss-preview-box {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
    text-align: center;
}
.ss-preview-label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    text-align: left;
}
/* 预览图片：等比缩小不裁剪，内容自适应高度，无大片空白 */
#ssPreviewBox {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    min-height: 60px;
}
#ssPreviewBox img {
    max-width: 100%;
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.ss-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7f7;
    border: 1px dashed #ccc;
    border-radius: 4px;
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    line-height: 1.5;
}
@media (max-width: 768px) {
    .ss-modal-row { grid-template-columns: 1fr; }
    .ss-modal-preview-col { position: static; order: -1; }
}
.ss-modal-close {
    position: absolute; top: 10px; right: 16px;
    font-size: 28px; cursor: pointer; color: #999; line-height: 1;
}
.ss-modal-close:hover { color: #333; }
.ss-modal-inner h3 { margin: 0 0 16px; font-size: 20px; }

.ss-form-item { margin-bottom: 14px; }
.ss-form-item label { display: block; margin-bottom: 5px; font-size: 14px; color: #555; font-weight: 500; }
.ss-form-item input, .ss-form-item select {
    width: 100%; padding: 9px 12px;
    border: 1px solid #ddd; border-radius: 6px;
    font-size: 14px; box-sizing: border-box; outline: none;
}
.ss-form-item input:focus, .ss-form-item select:focus { border-color: #2563eb; }
.ss-hint { margin: 4px 0 0; font-size: 12px; color: #999; }

.ss-total-price {
    font-size: 18px; font-weight: bold; color: #2563eb;
    margin: 14px 0; padding: 10px;
    background: #f0f7ff; border-radius: 6px;
}
.pay-select { margin: 10px 0; }
.pay-select label { margin-right: 16px; font-weight: normal; }

.ss-submit-pay {
    width: 100%; padding: 13px;
    background: #16a34a; color: #fff;
    border: none; border-radius: 8px; font-size: 16px; cursor: pointer;
}
.ss-submit-pay:hover { background: #15803d; }
.ss-wechat-box img { border: 1px solid #eee; border-radius: 8px; }

/* 手机自适应 */
@media (max-width: 768px) {
    .ss-ads-wrap { grid-template-columns: 1fr !important; }
    .ss-modal-inner { padding: 20px; }
}
