/* ========================================
   模板子站 - 公共样式
   ======================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #0066ff;
    --primary-dark: #0052d6;
    --dark: #0a192f;
    --dark2: #112240;
    --accent: #ff6f06;
    --gray-bg: #f7f7f7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background: #f5f6f8;
}

a { text-decoration: none; color: inherit; }

/* ========================================
   顶部导航
   ======================================== */
.site-nav {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    z-index: 999;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
}

.nav-brand span { color: var(--primary); }

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: #666;
    font-size: 15px;
    padding: 8px 0;
    position: relative;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--primary);
}

/* ========================================
   轮播/Banner区
   ======================================== */
.banner-section {
    margin-top: 60px;
    position: relative;
    overflow: hidden;
}

.banner-slide {
    display: none;
    padding: 80px 20px;
    text-align: center;
    color: #fff;
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-slide.active { display: flex; }

.banner-slide:nth-child(1) {
    background: linear-gradient(135deg, #0a192f, #1a365d, #0066ff);
}

.banner-slide:nth-child(2) {
    background: linear-gradient(135deg, #112240, #0066ff, #00c6ff);
}

.banner-slide:nth-child(3) {
    background: linear-gradient(135deg, #0052d6, #0a192f, #1a365d);
}

.banner-content { max-width: 700px; }

.banner-content h1 {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 20px;
}

.banner-content p {
    font-size: 17px;
    line-height: 1.8;
    opacity: 0.9;
}

.banner-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.banner-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.3s;
}

.banner-dots .dot.active { background: #fff; }

/* ========================================
   模板列表区
   ======================================== */
.tpl-section {
    max-width: 1600px;
    width: calc(100% - 24px);
    margin: 0 auto 30px;
    padding: 30px 24px;
    text-align: center;
    background: transparent;
    border-radius: 12px;
    box-shadow: none;
}

.tpl-section h2 {
    font-size: 26px;
    font-weight: 700;
    color: #333;
    margin-bottom: 30px;
    position: relative;
}

.tpl-section h2::after {
    content: "";
    display: block;
    width: 50px; height: 3px;
    background: var(--primary);
    margin: 10px auto 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 模板网格 - 默认4列（minmax(0,1fr)防止内容撑宽列，保证等宽） */
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

@media (max-width: 1200px) { .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) { .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tpl-grid { grid-template-columns: 1fr; } }

/* 模板卡片 */
.tpl-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: 0.3s ease all;
    cursor: pointer;
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 10px 10px 0;
}

.tpl-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.tpl-card .cover {
    width: 100%;
    height: 360px;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 10px;
}

.tpl-card .cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.tpl-card:hover .cover img { transform: scale(1.03); }

/* 手机模型叠加（白色 iPhone 外壳，向下探出封面） */
.tpl-card .phone-mockup {
    position: absolute;
    bottom: 42px;
    right: 26px;
    width: 132px;
    height: 262px;
    background:
        radial-gradient(circle at calc(50% + 22px) 11px, #d9d9d9 2px, rgba(0,0,0,0) 2.5px),
        linear-gradient(#d9d9d9, #d9d9d9) center 9px / 24px 4px no-repeat,
        #fff;
    border-radius: 10px;
    padding: 24px 9px;
    box-shadow: 0 10px 26px rgba(0,0,0,0.18), 0 0 0 1px #ececec;
    z-index: 3;
}

.tpl-card .phone-mockup img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    background: #f0f0f0;
}

/* 底部圆形 Home 键 */
.tpl-card .phone-mockup::after {
    content: "";
    position: absolute;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border: 2px solid #d9d9d9;
    border-radius: 50%;
    background: #fff;
    z-index: 4;
}

.tpl-card .card-name {
    padding: 16px 12px 14px;
    font-size: 15px;
    color: #333;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 0 0 10px 10px;
}

/* 更多按钮 */
.more-btn-wrap {
    text-align: center;
    margin-top: 30px;
    padding-bottom: 20px;
}

.more-btn {
    display: inline-block;
    padding: 8px 30px;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    font-size: 14px;
    transition: 0.2s;
}

.more-btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ========================================
   搜索区（更多模板页）
   ======================================== */
.search-section {
    margin-top: 60px;
    padding: 30px 0;
    background: transparent;
}

.search-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 20px;
}

.search-box {
    display: flex;
    border: 2px solid var(--accent);
    border-radius: 4px;
    overflow: hidden;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
}

.search-box button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.search-box button:hover { background: #e56305; }

/* ========================================
   模板分类区
   ======================================== */
.category-section {
    max-width: 1600px;
    width: calc(100% - 24px);
    margin: 0 auto 20px;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.category-item {
    padding: 12px 16px;
    background: #f5f6f8;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    color: #555;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-item:hover {
    background: #fff;
    border-color: var(--accent);
    color: var(--accent);
}

.category-item.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

@media (max-width: 992px) { .category-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .category-grid { grid-template-columns: 1fr; } }

/* ========================================
   定制引导区
   ======================================== */
.cta-section {
    padding: 50px 20px 60px;
    text-align: center;
    background: #f9f9f9;
}

.cta-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 24px;
}

.cta-btn {
    display: inline-block;
    padding: 12px 40px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.cta-btn:hover { background: #e56305; }

/* ========================================
   分页
   ======================================== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    padding-bottom: 40px;
    list-style: none;
}

.pagination .page-info {
    font-size: 14px;
    color: #999;
    margin-right: 8px;
}

.pagination button,
.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    transition: 0.2s;
}

.pagination button:hover,
.pagination .page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination button.active,
.pagination .page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ========================================
   详情页工具栏
   ======================================== */
.detail-toolbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    min-width: 140px;
}

.toolbar-right { justify-content: flex-end; }

.toolbar-center { display: flex; align-items: center; }

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-back:hover { background: var(--primary-dark); }

.device-switcher {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.device-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 36px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.device-btn:hover { color: var(--primary); background: #fff; }

.device-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.device-label {
    font-size: 13px;
    color: #888;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    white-space: nowrap;
}

/* 手机端隐藏设备切换按钮 */
@media (max-width: 768px) {
    .detail-toolbar .device-switcher,
    .detail-toolbar .device-label { display: none; }
}

/* 详情页iframe区 */
.detail-container {
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    padding: 16px;
    background: #f0f2f5;
}

.detail-frame {
    position: relative;
    width: 100%;
    height: calc(100vh - 88px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: width 0.3s ease;
}

.detail-frame iframe {
    width: 100%; height: 100%;
    border: none;
}

/* iframe 加载遮罩 */
.frame-loading {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #fff;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.frame-loading.hide {
    opacity: 0;
    visibility: hidden;
}

.frame-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: var(--accent, #ff6f06);
    border-radius: 50%;
    animation: frame-spin 1s linear infinite;
}

.frame-loading p {
    margin: 0;
    font-size: 14px;
    color: #888;
}

@keyframes frame-spin {
    to { transform: rotate(360deg); }
}

/* 电脑端：iframe占满全屏，无留白 */
.detail-container.full {
    padding: 0;
}

.detail-container.full .detail-frame {
    width: 100% !important;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
}

/* ========================================
   底部版权
   ======================================== */
.site-footer {
    background: var(--dark);
    color: #a8b2d1;
    text-align: center;
    padding: 30px 0;
    font-size: 14px;
    line-height: 1.8;
}

.site-footer a { color: #ccd6f6; }
