/* ==========================================================
   网上书店 - 全局样式
   配色：墨蓝 + 暖橙，扁平卡片风，可平滑迁移到 Django static
   ========================================================== */

:root {
    --bs-primary: #ff6a3d;
    --bs-primary-rgb: 255, 106, 61;
    --bs-link-color: #ff6a3d;
    --bs-link-hover-color: #e8512a;

    --ink: #1f2d3d;          /* 主文字：墨蓝 */
    --ink-2: #4a5a6a;        /* 次级文字 */
    --ink-3: #8a97a4;        /* 弱文字 */
    --line: #eceff3;         /* 分割线 */
    --bg: #f6f7f9;           /* 页面底 */
    --nav: #1f2d3d;          /* 导航底色 */
    --accent: #ff6a3d;
    --accent-soft: #fff1ec;
    --radius: 14px;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.navbar-top { background: var(--nav); }
.navbar-top .navbar-brand { font-weight: 700; letter-spacing: .5px; color: #fff; }
.navbar-top .nav-link { color: rgba(255,255,255,.82) !important; font-size: 15px; padding-inline: .85rem; }
.navbar-top .nav-link:hover,
.navbar-top .nav-link.active { color: #fff !important; }
.navbar-top .nav-link.active { position: relative; }
.navbar-top .nav-link.active::after {
    content: ""; position: absolute; left: .85rem; right: .85rem; bottom: 2px;
    height: 2px; background: var(--accent); border-radius: 2px;
}
.search-box { position: relative; width: 340px; }
.search-box .form-control {
    border-radius: 999px; padding-left: 2.4rem; background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18); color: #fff; height: 38px;
}
.search-box .form-control::placeholder { color: rgba(255,255,255,.55); }
.search-box .form-control:focus {
    background: #fff; color: var(--ink);
    box-shadow: 0 0 0 .2rem rgba(255,106,61,.25); border-color: transparent;
}
.search-box .bi {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: rgba(255,255,255,.7); z-index: 2;
}
.search-box .form-control:focus ~ .bi { color: var(--ink-3); }
.cart-link { position: relative; }
.cart-badge {
    position: absolute; top: -4px; right: -10px; font-size: 11px;
    min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
    background: var(--accent); color: #fff; border-radius: 999px; text-align: center;
}

/* ---------- 通用块 ---------- */
.section { padding: 44px 0 8px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.section-title { font-size: 22px; font-weight: 700; margin: 0; }
.section-title::before {
    content: ""; display: inline-block; width: 4px; height: 20px;
    background: var(--accent); border-radius: 2px; margin-right: 10px; vertical-align: -3px;
}
.section-more { color: var(--ink-3); font-size: 14px; }
.section-more:hover { color: var(--accent); }

.card-soft { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.breadcrumb-bar { background: #fff; border-bottom: 1px solid var(--line); }
.breadcrumb { margin: 0; font-size: 14px; padding: 12px 0; }
.breadcrumb a { color: var(--ink-2); }
.breadcrumb a:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(120deg, #22344a 0%, #2f4a68 45%, #3f6f8f 100%);
    color: #fff; border-radius: 20px; overflow: hidden; position: relative;
    padding: 56px 48px; margin-top: 24px;
}
.hero::after {
    content: ""; position: absolute; right: -80px; top: -80px; width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(255,106,61,.45), transparent 65%);
}
.hero h1 { font-size: 34px; font-weight: 800; line-height: 1.35; }
.hero p { color: rgba(255,255,255,.78); margin: 14px 0 26px; font-size: 15px; }
.hero .hero-search { max-width: 520px; }
.hero .hero-search .form-control { height: 48px; border-radius: 999px; padding-left: 20px; border: 0; }
.hero .hero-search .btn { border-radius: 999px; padding: 0 28px; height: 48px; font-weight: 600; }
.hero-stats { display: flex; gap: 36px; margin-top: 34px; position: relative; z-index: 2; }
.hero-stats b { display: block; font-size: 22px; font-weight: 700; }
.hero-stats span { font-size: 13px; color: rgba(255,255,255,.7); }

/* ---------- 分类卡片 ---------- */
.cat-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px 12px; text-align: center; transition: .22s; display: block; color: var(--ink);
}
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(31,45,61,.09); border-color: #ffd9cc; }
.cat-card .icon-wrap {
    width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent); font-size: 24px;
}
.cat-card .cat-name { font-weight: 600; font-size: 15px; }
.cat-card .cat-sub { font-size: 12px; color: var(--ink-3); }
.cat-card.active { border-color: var(--accent); background: #fffaf8; }
.cat-card.active .icon-wrap { background: var(--accent); color: #fff; }

/* ---------- 商品卡片 ---------- */
.book-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; transition: .22s; display: flex; flex-direction: column; height: 100%;
}
.book-card:hover { transform: translateY(-5px); box-shadow: 0 16px 32px rgba(31,45,61,.1); border-color: #ffd9cc; }
.book-cover { position: relative; padding-top: 132%; background: #f2f4f7; overflow: hidden; }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-tag {
    position: absolute; left: 10px; top: 10px; z-index: 2;
    background: var(--accent); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px;
}
.book-body { padding: 12px 14px 16px; display: flex; flex-direction: column; flex: 1; }
.book-title {
    font-size: 15px; font-weight: 600; line-height: 1.45; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px;
}
.book-title:hover { color: var(--accent); }
.book-meta { font-size: 12.5px; color: var(--ink-3); margin: 6px 0 10px; }
.price-row { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; }
.price { color: var(--accent); font-weight: 700; font-size: 19px; }
.price small { font-size: 13px; }
.price-old { color: var(--ink-3); text-decoration: line-through; font-size: 12px; margin-left: 6px; }
.sales { font-size: 12px; color: var(--ink-3); }

/* ---------- 服务条 ---------- */
.feature-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 0; }
.feature-item { text-align: center; color: var(--ink-2); font-size: 14px; }
.feature-item .bi { font-size: 22px; color: var(--accent); display: block; margin-bottom: 6px; }

/* ---------- 筛选侧栏 ---------- */
.filter-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.filter-box h6 { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.filter-list { list-style: none; padding: 0; margin: 0; }
.filter-list li a {
    display: block; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px;
}
.filter-list li a:hover { background: #f6f7f9; color: var(--accent); }
.filter-list li a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sort-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 18px; }
.sort-bar .btn-sort { border: 0; background: transparent; color: var(--ink-2); font-size: 14px; padding: 4px 12px; border-radius: 8px; }
.sort-bar .btn-sort.active, .sort-bar .btn-sort:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- 商品详情 ---------- */
.gallery { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.gallery .main-img { width: 100%; border-radius: 10px; background: #f2f4f7; aspect-ratio: 3/4; object-fit: cover; }
.thumb-row { display: flex; gap: 10px; margin-top: 14px; }
.thumb-row img {
    width: 66px; height: 88px; object-fit: cover; border-radius: 8px; cursor: pointer;
    border: 2px solid transparent; background: #f2f4f7;
}
.thumb-row img.active { border-color: var(--accent); }
.detail-title { font-size: 24px; font-weight: 700; line-height: 1.4; }
.detail-meta { font-size: 14px; color: var(--ink-2); }
.detail-meta span { margin-right: 22px; }
.price-panel { background: linear-gradient(120deg, #fff6f3, #fff); border: 1px solid #ffe1d6; border-radius: var(--radius); padding: 18px; }
.price-panel .now { color: var(--accent); font-size: 30px; font-weight: 800; }
.qty-input { width: 46px; text-align: center; border-left: 0; border-right: 0; }
.kv-table td { border: 0; padding: 6px 0; font-size: 14px; }
.kv-table td:first-child { color: var(--ink-3); width: 96px; }
.nav-tabs .nav-link { color: var(--ink-2); font-weight: 600; }
.nav-tabs .nav-link.active { color: var(--accent); }

/* ---------- 购物车 / 订单 ---------- */
.cart-table th { font-size: 13px; color: var(--ink-3); font-weight: 500; border-top: 0; }
.cart-table td { vertical-align: middle; }
.cart-thumb { width: 64px; height: 84px; object-fit: cover; border-radius: 6px; background: #f2f4f7; }
.sum-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.sum-row.total { color: var(--ink); font-weight: 700; font-size: 15px; padding-top: 10px; border-top: 1px dashed var(--line); }
.sum-row.total b { color: var(--accent); font-size: 24px; }

.order-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.order-head { background: #fafbfc; padding: 12px 18px; font-size: 13px; color: var(--ink-3); display: flex; gap: 24px; flex-wrap: wrap; }
.order-head b { color: var(--ink-2); font-weight: 500; }
.order-body { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.status-pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.status-pill.done { background: #eaf7ef; color: #2e9e5b; }
.status-pill.gray { background: #f0f2f5; color: var(--ink-3); }

/* ---------- 登录 / 注册 ---------- */
.auth-wrap { min-height: calc(100vh - 210px); display: flex; align-items: center; padding: 36px 0; }
.auth-side {
    background: linear-gradient(135deg, #22344a, #3f6f8f); color: #fff;
    border-radius: 20px 0 0 20px; padding: 48px 44px; position: relative; overflow: hidden;
}
.auth-side::after {
    content: ""; position: absolute; width: 260px; height: 260px; right: -90px; bottom: -90px;
    background: radial-gradient(circle, rgba(255,106,61,.5), transparent 65%);
}
.auth-side h2 { font-weight: 800; font-size: 26px; }
.auth-side ul { list-style: none; padding: 0; margin-top: 24px; }
.auth-side ul li { margin-bottom: 14px; color: rgba(255,255,255,.85); font-size: 14.5px; }
.auth-side ul li .bi { color: #ffb59a; margin-right: 8px; }
.auth-form { background: #fff; border-radius: 0 20px 20px 0; padding: 44px 44px; }
.auth-form .form-control { height: 46px; border-radius: 10px; }
.auth-form .input-group-text { border-radius: 10px 0 0 10px; background: #fff; }
.social-login { display: flex; gap: 12px; }
.social-login a {
    flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 10px;
    padding: 8px; color: var(--ink-2); font-size: 14px;
}
.social-login a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 用户中心 ---------- */
.uc-side { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.uc-side .uc-user { padding: 18px 16px; border-bottom: 1px solid var(--line); text-align: center; }
.uc-avatar {
    width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, #ff8a5c, #ff6a3d);
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 10px;
}
.uc-side .list-group-item { border: 0; border-radius: 8px !important; color: var(--ink-2); font-size: 14.5px; padding: 10px 16px; }
.uc-side .list-group-item:hover { background: #f6f7f9; color: var(--accent); }
.uc-side .list-group-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-card b { display: block; font-size: 24px; font-weight: 700; }
.stat-card span { font-size: 13px; color: var(--ink-3); }
.stat-card .bi { font-size: 20px; color: var(--accent); }

/* ---------- 页脚 ---------- */
.footer { background: #1f2d3d; color: rgba(255,255,255,.7); margin-top: 60px; padding: 46px 0 20px; font-size: 14px; }
.footer h6 { color: #fff; font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.footer a { color: rgba(255,255,255,.7); display: block; margin-bottom: 8px; font-size: 13.5px; }
.footer a:hover { color: var(--accent); }
.footer .copy { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 18px; font-size: 13px; }

/* ---------- 其它 ---------- */
.empty-state { padding: 70px 0; text-align: center; color: var(--ink-3); }
.empty-state .bi { font-size: 54px; color: #dfe3e8; }
.app-toast {
    position: fixed; right: 24px; top: 88px; z-index: 1080; min-width: 220px;
    background: #1f2d3d; color: #fff; padding: 12px 18px; border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.18); font-size: 14px; opacity: 0; transform: translateY(-10px);
    transition: .25s; pointer-events: none;
}
.app-toast.show { opacity: 1; transform: translateY(0); }
.pagination .page-link { border: 0; border-radius: 8px !important; margin: 0 3px; color: var(--ink-2); }
.pagination .active .page-link { background: var(--accent); color: #fff; }
.btn-primary { --bs-btn-bg: #ff6a3d; --bs-btn-border-color: #ff6a3d; --bs-btn-hover-bg: #e8512a; --bs-btn-hover-border-color: #e8512a; }
.btn-outline-primary { --bs-btn-color: #ff6a3d; --bs-btn-border-color: #ff6a3d; --bs-btn-hover-bg: #ff6a3d; --bs-btn-hover-border-color: #ff6a3d; }

@media (max-width: 991px) {
    .search-box { width: 100%; margin: 8px 0; }
    .hero { padding: 36px 24px; }
    .hero h1 { font-size: 26px; }
    .auth-side { display: none; }
    .auth-form { border-radius: 20px; padding: 32px 24px; }
}
