/* =========================================================
   淘副业网站 - 全站样式
   ========================================================= */

:root {
    --tf-primary: #ff6a3d;
    --tf-primary-dark: #e84118;
    --tf-dark: #22252f;
    --tf-muted: #8a90a2;
    --tf-border: #eceef3;
    --tf-bg: #f5f6fa;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--tf-bg);
    color: #2f3242;
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--tf-primary);
}

/* ================== 顶部导航 ================== */
.site-top {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    box-shadow: 0 2px 12px rgba(24, 28, 47, 0.08);
}

.topbar-main {
    border-bottom: 1px solid var(--tf-border);
}

.topbar-main .container {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--tf-primary);
    white-space: nowrap;
}

.logo img {
    height: 34px;
    width: auto;
}

.logo span {
    color: var(--tf-dark);
}

.top-search {
    flex: 1 1 320px;
    max-width: 520px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.topbar-nav {
    background: var(--tf-dark);
}

.topbar-nav .navbar-nav {
    flex-wrap: wrap;
}

.topbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.82);
    padding: 10px 18px !important;
    font-size: 15px;
}

.topbar-nav .nav-link:hover,
.topbar-nav .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ================== 通用区块 ================== */
.main-wrap {
    flex: 1 0 auto;
    padding: 22px 0 40px;
}

.section-box {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 4px 18px rgba(24, 28, 47, 0.05);
    margin-bottom: 22px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--tf-border);
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.section-title h2 {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
    padding-left: 12px;
    border-left: 4px solid var(--tf-primary);
    line-height: 1.2;
}

.section-title .more {
    font-size: 13px;
    color: var(--tf-muted);
}

.bg-purple {
    background-color: #6f42c1 !important;
}

.btn-brand {
    background: linear-gradient(135deg, var(--tf-primary), var(--tf-primary-dark));
    border: none;
    color: #fff;
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    filter: brightness(1.05);
}

/* ================== 副业指南（首页两栏） ================== */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 26px;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--tf-border);
    overflow: hidden;
}

.guide-item .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--tf-primary);
    flex: 0 0 auto;
}

.guide-item .txt {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-item .time {
    color: var(--tf-muted);
    font-size: 13px;
    flex: 0 0 auto;
}

/* ================== 教程卡片 ================== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
    gap: 16px;
}

.course-card {
    background: #fff;
    border: 1px solid var(--tf-border);
    border-radius: 10px;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(24, 28, 47, 0.12);
}

/* 教程封面固定 250 × 150（5:3），窄屏等比缩放 */
.course-cover {
    position: relative;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    aspect-ratio: 250 / 150;
    background: #e9ecf3;
    overflow: hidden;
}

/* 不支持 aspect-ratio 的浏览器退回固定高度 */
@supports not (aspect-ratio: 250 / 150) {
    .course-cover {
        height: 150px;
    }
}

.course-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-body {
    padding: 9px 10px 12px;
}

.course-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    height: 39px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.course-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--tf-muted);
}

.badge-level {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    color: #fff;
    background: #adb5bd;
}

.badge-level.lv1 { background: #0d6efd; }
.badge-level.lv2 { background: #6f42c1; }
.badge-level.lv3 { background: #d63384; }
.badge-level.lv0 { background: #198754; }

/* ================== 文章列表 ================== */
.article-list .article-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    border-bottom: 1px solid var(--tf-border);
}

.article-list .article-row:hover {
    background: #fafbff;
}

.article-list .article-title {
    font-size: 15px;
    font-weight: 500;
}

.article-list .article-time {
    color: var(--tf-muted);
    font-size: 13px;
    white-space: nowrap;
    padding-left: 12px;
}

.tag-top {
    display: inline-block;
    font-size: 11px;
    color: #fff;
    background: var(--tf-primary);
    border-radius: 3px;
    padding: 1px 5px;
    margin-right: 6px;
    vertical-align: 1px;
}

/* ================== 详情页 ================== */
.detail-head h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.detail-info {
    color: var(--tf-muted);
    font-size: 13px;
    border-bottom: 1px solid var(--tf-border);
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.detail-content {
    line-height: 1.9;
    font-size: 15px;
    word-break: break-word;
}

.detail-content img {
    max-width: 100%;
    height: auto;
}

.download-box {
    border: 1px dashed var(--tf-primary);
    background: #fff7f3;
    border-radius: 10px;
    padding: 16px 18px;
}

.download-box .dl-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.download-box .dl-link {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 8px;
    background: var(--tf-primary);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: .18s;
}

.download-box .dl-link:hover {
    background: var(--tf-primary-dark);
    color: #fff;
}

/* ================== 会员套餐表 ================== */
.plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.plan-table th,
.plan-table td {
    border: 1px solid var(--tf-border);
    padding: 12px 10px;
    text-align: center;
    vertical-align: middle;
}

.plan-table thead th {
    background: var(--tf-dark);
    color: #fff;
    font-weight: 600;
}

.plan-table tbody th {
    background: #fafbff;
    width: 130px;
    text-align: left;
    color: #555;
}

.plan-table .hl {
    background: #fff7f3;
}

/* ---------- 套餐表美化版 ---------- */
.plan-wrap {
    overflow-x: auto;
    padding-bottom: 4px;
}

.plan-table-v2 {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--tf-border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    min-width: 640px;
}

.plan-table-v2 th,
.plan-table-v2 td {
    border-right: 1px solid var(--tf-border);
    border-bottom: 1px solid var(--tf-border);
    padding: 14px 12px;
    text-align: center;
    vertical-align: middle;
}

.plan-table-v2 th:last-child,
.plan-table-v2 td:last-child {
    border-right: 0;
}

.plan-table-v2 tbody tr:last-child th,
.plan-table-v2 tbody tr:last-child td {
    border-bottom: 0;
}

.plan-table-v2 thead th {
    background: linear-gradient(135deg, #2b3247, #1b2030);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    padding: 16px 12px;
}

.plan-table-v2 tbody th {
    background: #fafbff;
    width: 118px;
    text-align: left;
    color: #555;
    font-weight: 600;
}

.plan-table-v2 .col-hot {
    background: #fff7f3;
}

.plan-table-v2 thead .col-hot {
    background: linear-gradient(135deg, #ff6a3d, #e84118);
    position: relative;
}

.plan-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    vertical-align: middle;
}

.plan-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
}

.plan-sub {
    display: block;
    font-size: 12px;
    font-weight: 400;
    opacity: .78;
    margin-top: 2px;
}

.plan-price {
    display: block;
    font-size: 21px;
    font-weight: 700;
    color: var(--tf-primary-dark);
    line-height: 1.2;
}

.plan-price.free {
    font-size: 16px;
    color: var(--tf-muted);
}

.plan-old {
    display: block;
    font-size: 13px;
    color: #a4a9b8;
    text-decoration: line-through;
    line-height: 1.4;
}

.plan-unit {
    display: block;
    font-size: 12px;
    color: var(--tf-muted);
    margin-top: 2px;
}

.plan-desc {
    font-size: 13px;
    color: #666;
    text-align: left;
    line-height: 1.7;
}

.plan-cut {
    display: inline-block;
    min-width: 62px;
    padding: 3px 10px;
    border-radius: 20px;
    background: #fff1ec;
    color: var(--tf-primary-dark);
    font-weight: 700;
    font-size: 14px;
}

.plan-cut.zero {
    background: #ffe9e9;
    color: #d3252c;
}

/* ---------- 应付金额 ---------- */
.pay-price {
    font-size: 26px;
    font-weight: 700;
    color: var(--tf-primary-dark);
    line-height: 1.2;
}

.pay-detail {
    font-size: 12px;
    color: var(--tf-muted);
    margin-top: 2px;
}

/* ---------- 错误提示页 ---------- */
.err-icon {
    font-size: 54px;
    line-height: 1;
    color: #dc3545;
}

.err-msg {
    color: #555;
    font-size: 15px;
    line-height: 1.9;
}

/* ================== 底部 ================== */
.site-footer {
    background: var(--tf-dark);
    color: rgba(255, 255, 255, 0.68);
    padding: 26px 0 18px;
    font-size: 14px;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.78);
}

.site-footer a:hover {
    color: #fff;
}

.friend-links {
    background: #fff;
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 22px;
    box-shadow: 0 4px 18px rgba(24, 28, 47, 0.05);
}

.friend-links .fl-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--tf-dark);
    margin-right: 10px;
}

.friend-links .fl-apply {
    font-size: 12px;
    color: var(--tf-primary);
}

.friend-links a.fl-item {
    display: inline-block;
    margin: 4px 12px 4px 0;
    color: #5a6072;
}

.qr-box {
    text-align: center;
}

.qr-box img {
    width: 108px;
    height: 108px;
    object-fit: cover;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.qr-box p {
    margin: 6px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.66);
}

/* ================== 会员中心 ================== */
.member-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.member-side {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(24, 28, 47, 0.05);
}

.member-side .side-head {
    background: linear-gradient(135deg, var(--tf-primary), var(--tf-primary-dark));
    color: #fff;
    padding: 16px;
    font-weight: 700;
}

.member-side .list-group-item {
    border: none;
    border-bottom: 1px solid var(--tf-border);
    padding: 11px 16px;
}

.member-side .list-group-item.active {
    background: #fff7f3;
    color: var(--tf-primary);
    font-weight: 600;
}

.member-main {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 18px rgba(24, 28, 47, 0.05);
    min-height: 320px;
}

.stat-card {
    border: 1px solid var(--tf-border);
    border-radius: 10px;
    padding: 14px 16px;
    height: 100%;
}

.stat-card .label {
    color: var(--tf-muted);
    font-size: 13px;
}

.stat-card .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--tf-primary);
}

/* ================== 后台 ================== */
.admin-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* ================== 表单/表格 ================== */
.table td,
.table th {
    vertical-align: middle;
    font-size: 14px;
}

.table thead th {
    background: #f8f9fb;
    white-space: nowrap;
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #ddd;
    vertical-align: -2px;
    margin-right: 4px;
}

.empty-tip {
    text-align: center;
    padding: 40px 0;
    color: var(--tf-muted);
}

.required::after {
    content: " *";
    color: #dc3545;
}

/* ================== 响应式 ================== */
@media (max-width: 1200px) {
    .course-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .member-layout,
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .course-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .course-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .guide-grid {
        grid-template-columns: 1fr;
    }
    .top-actions {
        width: 100%;
        margin-left: 0;
    }
    .topbar-main .container {
        gap: 10px;
    }
}
