/*
 * Shop 插件内容样式（不含页面外壳/导航/侧边栏，这些由主题 shopnav.css 提供）。
 * 仅覆盖课程卡片、筛选栏、列表、表格、表单、按钮、客服浮窗等内容元素。
 */

/* CSS 变量（shopnav.css 在 .shop-sidenav 下也有定义，这里补充全局可用） */
body {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --line: #e8ebf2;
  --text: #172033;
  --muted: #7b8497;
  --primary: #5267d8;
  --primary-dark: #3f51bd;
  --primary-soft: #eef0ff;
  --success: #3ba58b;
  --danger: #eb7184;
  --shadow: 0 16px 40px rgba(38, 52, 94, .08);
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #172033;
}

/* 内容区 */
.shop-content { max-width: 1420px; margin: 0 auto; padding: 28px 40px 64px; }

/* 面包屑 */
.shop-breadcrumb { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.shop-breadcrumb a { color: var(--muted); text-decoration: none; }
.shop-breadcrumb a:hover { color: var(--primary); }
.shop-breadcrumb b { color: var(--text); font-weight: 600; }

/* 页面标题 */
.shop-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.shop-page-heading h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.04em; }
.shop-page-heading p { margin: 0; color: var(--muted); }
.heading-actions { display: flex; align-items: center; gap: 12px; }

/* 按钮 */
.primary-btn { display: inline-block; padding: 11px 18px; border-radius: 10px; color: #fff; background: var(--primary); font-weight: 700; box-shadow: 0 8px 18px rgba(82, 103, 216, .18); border: none; cursor: pointer; text-decoration: none; }
.primary-btn:hover { background: var(--primary-dark); }
.ghost-btn { display: inline-block; padding: 10px 16px; border: 1px solid var(--line); border-radius: 9px; color: #647087; background: #fff; text-decoration: none; }
.ghost-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn { display: inline-block; padding: 8px 13px; border-radius: 8px; font-size: 12px; font-weight: 600; text-decoration: none; }
.mini-btn.btn-primary,
.mini-btn.btn-primary:visited,
.mini-btn.btn-primary:link {
    color: #fff !important;
    background: var(--primary) !important;
    border: 1px solid var(--primary) !important;
}
.mini-btn.btn-primary:hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.btn-primary { color: #fff; background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { color: #647087; border: 1px solid var(--line); background: #fff; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* 筛选栏 */
.filter-bar { display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 26px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 230px; }
.search span { position: absolute; left: 13px; top: 11px; color: var(--muted); }
.search input, .filter-bar select { height: 38px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: var(--surface-soft); }
.search input { width: 100%; padding: 0 14px 0 36px; box-sizing: border-box; }
.filter-bar select { min-width: 145px; padding: 0 12px; }
.filter-bar select:focus, .search input:focus { border-color: var(--primary); }
.filter-divider { width: 1px; height: 24px; background: var(--line); }
.filter-status { color: var(--muted); white-space: nowrap; }

/* 区块标题 */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }
.section-head h3 { margin: 0; font-size: 18px; }
.section-head a { color: var(--primary); text-decoration: none; font-size: 12px; }

/* 推荐区块 */
.featured { display: grid; grid-template-columns: 1.15fr 1fr; overflow: hidden; min-height: 250px; margin-bottom: 30px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.featured-cover { min-height: 250px; padding: 30px; display: flex; align-items: end; background: linear-gradient(135deg, #dfe5ff, #bfcaf1 55%, #f0d4bd); background-position: center; background-size: cover; }
.cover-label { padding: 8px 11px; border-radius: 8px; color: #fff; background: rgba(28, 39, 74, .72); font-size: 11px; letter-spacing: .06em; }
.featured-info { padding: 32px 36px; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.featured-info h3 { margin: 10px 0 10px; font-size: 25px; letter-spacing: -.03em; }
.featured-info p { max-width: 460px; margin: 0 0 18px; color: var(--muted); line-height: 1.8; }
.featured-meta { display: flex; gap: 22px; margin-bottom: 22px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.featured-meta strong { display: block; margin-top: 4px; color: var(--text); font-size: 16px; }
.card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 课程网格 */
.course-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.course-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); transition: .2s ease; position: relative; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.course-cover { position: relative; height: 142px; padding: 14px; display: flex; align-items: end; background: linear-gradient(135deg, #e8edf9, #c5d1ed); background-position: center; background-size: cover; }
.course-card:nth-child(2) .course-cover { background-image: linear-gradient(135deg, #f3e2d2, #e9c3aa); }
.course-card:nth-child(3) .course-cover { background-image: linear-gradient(135deg, #d9eee5, #a5d5c5); }
.course-card:nth-child(4) .course-cover { background-image: linear-gradient(135deg, #e9dff2, #cfb9e4); }
.course-card:nth-child(5) .course-cover { background-image: linear-gradient(135deg, #f3edcf, #e4d48a); }
.course-card:nth-child(6) .course-cover { background-image: linear-gradient(135deg, #d6e9ef, #a4ccd8); }
.course-card:nth-child(7) .course-cover { background-image: linear-gradient(135deg, #f0d8df, #dfa9ba); }
.course-card:nth-child(8) .course-cover { background-image: linear-gradient(135deg, #dde4d4, #b3c5a6); }
.course-cover .cover-icon { font-size: 31px; opacity: .68; }
.favorite { position: absolute; top: 11px; right: 11px; width: 29px; height: 29px; border-radius: 50%; color: #71809c; background: rgba(255,255,255,.78); display: grid; place-items: center; font-size: 14px; text-decoration: none; }
.favorite.active { color: #eb7184; }
.course-body { padding: 16px; }
.course-tag { display: inline-block; padding: 4px 7px; border-radius: 5px; color: var(--success); background: #edf8f4; font-size: 10px; margin-right: 5px; }
.course-tag.group { color: #5267d8; background: #eef0ff; }
.course-body h3 { overflow: hidden; margin: 11px 0 14px; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.course-body h3 a { text-decoration: none; color: inherit; }
.course-body h3 a:hover { color: var(--primary); }
.course-footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.course-price { padding: 5px 9px; border-radius: 7px; color: #fff; background: var(--primary); font-size: 11px; font-weight: 700; text-decoration: none; }
.course-price.free { background: var(--success); }
.course-price.goto { background: #e6e9f2; color: var(--primary); }
.empty { display: none; padding: 50px; color: var(--muted); text-align: center; grid-column: 1 / -1; }

/* 通用列表行（资料库/收藏） */
.shop-list { display: flex; flex-direction: column; gap: 14px; }
.list-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); transition: .2s ease; }
.list-card:hover { box-shadow: var(--shadow); }
.list-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); font-size: 19px; flex-shrink: 0; }
.list-main { flex: 1; min-width: 0; }
.list-main h4 { margin: 0 0 4px; font-size: 15px; }
.list-main h4 a { text-decoration: none; color: inherit; }
.list-main h4 a:hover { color: var(--primary); }
.list-sub { color: var(--muted); font-size: 12px; line-height: 1.5; }
.list-meta { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.list-actions { display: flex; align-items: center; gap: 10px; }

/* 通用数据表（购买记录） */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 18px; text-align: left; font-size: 13px; }
.data-table thead th { color: var(--muted); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.data-table tbody tr { border-bottom: 1px solid var(--line); }
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table a { color: var(--primary); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

/* 状态标签 */
.pill { display: inline-block; padding: 4px 9px; border-radius: 20px; font-size: 11px; }
.pill.completed { color: var(--success); background: #edf8f4; }
.pill.pending { color: #b98a1a; background: #fbf4df; }
.pill.cancelled { color: var(--danger); background: #fdeef1; }

/* 空状态 */
.empty-block { padding: 60px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-md); background: var(--surface); }

/* 表单 */
.form-group { display: flex; gap: 14px; margin-bottom: 16px; align-items: flex-start; flex-wrap: wrap; }
.form-group > label, .form-group .col-form-label { flex: 0 0 180px; padding-top: 9px; color: var(--muted); font-weight: 500; }
.form-group .col-sm-9, .form-group .col-sm-10, .form-group .col-sm-8 { flex: 1; min-width: 220px; }
.form-group .offset-sm-3 { margin-left: 194px; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; font-family: inherit; font-size: 14px; color: var(--text); background: #fff; box-sizing: border-box; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(82, 103, 216, .12); }
textarea.form-control { resize: vertical; }
.form-control-file { font-family: inherit; }
.form-text { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.img-fluid { max-width: 100%; height: auto; }

/* 响应式 */
@media (max-width: 1250px) { .shop-content { padding: 28px 30px 64px; } .course-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- 客服浮窗 ---- */
.shop-chat-fab { position: fixed; bottom: 24px; right: 24px; width: 78px; height: 78px; background: #0d3b66; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 16px rgba(13,59,102,.3); z-index: 99998; transition: all .3s ease; user-select: none; }
.shop-chat-fab:hover { background: #0a3153; transform: scale(1.06); box-shadow: 0 6px 20px rgba(13,59,102,.4); }
.shop-chat-fab.active { opacity: 0; transform: scale(.5); pointer-events: none; }
.shop-chat-fab svg { display: block; width: 100%; height: 100%; }
.shop-chat-fab svg text { fill: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; font-family: Inter,"PingFang SC","Microsoft YaHei",sans-serif; }
.shop-chat-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; background: #e63946; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 6px; border: 2px solid #fff; line-height: 1; }
.shop-chat-window { position: fixed; bottom: 24px; right: 24px; width: 360px; max-width: calc(100vw - 48px); height: 520px; max-height: calc(100vh - 48px); background: #fff; box-shadow: 0 8px 32px rgba(0,0,0,.15); z-index: 99999; display: flex; flex-direction: column; overflow: hidden; font-family: Inter,"PingFang SC","Microsoft YaHei",sans-serif; animation: shopChatSlideUp .25s ease; }
@keyframes shopChatSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.shop-chat-header { background: #0d3b66; color: #fff; padding: 14px 18px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.shop-chat-title { font-size: 15px; font-weight: 600; flex: 1; }
.shop-chat-status { font-size: 11px; opacity: .85; padding: 2px 8px; background: rgba(255,255,255,.15); }
.shop-chat-status.online { background: rgba(76,175,80,.35); }
.shop-chat-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 0 4px; line-height: 1; opacity: .8; transition: opacity .2s; }
.shop-chat-close:hover { opacity: 1; }
.shop-chat-body { flex: 1; overflow-y: auto; padding: 16px; background: #f8fafc; display: flex; flex-direction: column; gap: 10px; }
.shop-chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.shop-chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.shop-chat-msg.mine .shop-chat-bubble { background: #0d3b66; color: #fff; border-radius: 12px 12px 2px 12px; }
.shop-chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.shop-chat-msg.theirs .shop-chat-bubble { background: #f1f4f8; color: #1a202c; border-radius: 12px 12px 12px 2px; }
.shop-chat-bubble { padding: 9px 14px; font-size: 13.5px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.shop-chat-time { font-size: 10px; color: #6c757d; margin-top: 3px; padding: 0 4px; }
.shop-chat-time.read::after { content: ' ✓'; color: #1565c0; }
.shop-chat-system { align-self: center; font-size: 12px; color: #6c757d; background: #fff8e1; padding: 5px 14px; margin: 4px 0; text-align: center; }
.shop-chat-typing { font-size: 11px; color: #6c757d; padding: 2px 16px; font-style: italic; flex-shrink: 0; }
.shop-chat-input { display: flex; align-items: flex-end; padding: 10px 12px; background: #fff; border-top: 1px solid #e0e7f1; gap: 8px; flex-shrink: 0; }
.shop-chat-input textarea { flex: 1; border: 1px solid #e0e7f1; padding: 8px 12px; font-size: 13.5px; resize: none; outline: none; font-family: inherit; line-height: 1.4; max-height: 100px; min-height: 36px; transition: border-color .2s; box-sizing: border-box; }
.shop-chat-input textarea:focus { border-color: #1565c0; }
.shop-chat-input button { background: #0d3b66; color: #fff; border: none; padding: 8px 18px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; white-space: nowrap; height: 36px; }
.shop-chat-input button:hover { background: #072946; }
.shop-chat-input button:disabled { background: #cbd5e1; cursor: not-allowed; }
@media (max-width: 575.98px) { .shop-chat-window { bottom: 0; right: 0; width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; } .shop-chat-fab { bottom: 16px; right: 16px; } }

/* ===== 首页 #page.drawers 高度修复 =====
   Trema header.scss 给 #page.drawers 设了 height: calc(100vh - 4em) + margin-top: 4em，
   为 Boost 固定导航栏留空间。但首页有 nonavbar=true（隐藏导航栏），
   这两个值导致 #page.drawers 固定高度，内容超出视口时被压缩。
   shop_content.css 在主题 CSS 之后加载，优先级最高，在此覆盖。 */
body#page-site-index #page.drawers {
    height: auto !important;
    min-height: calc(100vh - 4em);
    margin-top: 0 !important;
}
