/* ============================================
   河南专技 H5 — 墨韵 Ink Rhythm
   Warm Stone Design System · v2.0
   ============================================ */

/* -------- CSS Variables -------- */
:root {
  /* Primary — 铜色 */
  --primary: #b1744b;
  --primary-dark: #8b5a3c;
  --primary-light: #f5ede5;

  /* Background */
  --bg: #faf8f5;
  --card-bg: #ffffff;

  /* Border */
  --border: #f0ebe3;
  --border-input: #e7dfd4;

  /* Text — 墨色系 */
  --text: #1c1917;
  --text-body: #57534e;
  --text-muted: #a8a29e;
  --text-link: #b1744b;

  /* Semantic */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;

  /* Radius */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;

  /* Spacing */
  --page-margin: 16px;
  --card-gap: 8px;
  --card-padding: 14px;

  /* Thumbnail — 3:2 */
  --thumb-w: 96px;
  --thumb-h: 54px;

  /* Font */
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --transition: 0.15s ease;
}

/* -------- Global -------- */
* { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
  line-height: 1.6;
}

.container, .page, .page__bd {
  background: var(--bg);
}

.page__bd {
  padding-bottom: 64px;
}

/* -------- WeUI Panel → Card -------- */
.weui-panel {
  background: transparent;
  margin: 0 var(--page-margin) var(--card-gap);
}

.weui-panel:after { border: none; }

.weui-panel__hd {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 0 8px;
}

.weui-panel__hd:empty { display: none; }

.weui-panel__bd { color: var(--text-body); }

/* -------- WeUI Cells -------- */
.weui-cells {
  background: transparent;
  border: none;
  margin: 0;
}
.weui-cells:before, .weui-cells:after { display: none; }

.weui-cell {
  padding: var(--card-padding);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.weui-cell:before { border: none; }

.weui-cell:active { background: var(--primary-light); }

.weui-cell + .weui-cell { border-top: none; }

.weui-cell__hd { margin-right: 12px; }

.weui-label {
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
}

.weui-cells_form .weui-cell {
  display: flex;
  align-items: center;
}

.weui-cells_form .weui-cell__hd {
  flex-shrink: 0;
  width: auto;
  max-width: 40%;
}

.weui-cells_form .weui-label {
  white-space: normal;
  word-break: keep-all;
  line-height: 1.3;
}

.weui-cells_form .weui-cell__bd {
  flex: 1;
  min-width: 0;
}

.weui-cells_form .weui-input,
.weui-cells_form .weui-select {
  width: 100%;
  box-sizing: border-box;
}

.weui-input {
  font-size: 14px;
  color: var(--text);
}

.weui-input[readonly] {
  color: var(--text-muted);
}

.weui-input::placeholder { color: var(--text-muted); }

.weui-input-helper {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.weui-cell_access .weui-cell__ft {
  color: var(--text-muted);
}

/* -------- WeUI Buttons -------- */
.weui-btn {
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 24px;
  transition: background var(--transition);
  border: none;
}

.weui-btn_primary {
  background: var(--primary);
  color: #fff;
}

.weui-btn_primary:active {
  background: var(--primary-dark);
}

.weui-btn_default {
  background: var(--card-bg);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.weui-btn_default:active {
  background: var(--primary-light);
}

.weui-btn_mini {
  font-size: 13px;
  padding: 4px 14px;
  margin: 4px;
  border-radius: var(--radius-sm);
}

/* -------- WeUI Media Box (Course Cards) -------- */
.weui-media-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--card-padding);
  margin-bottom: var(--card-gap);
  transition: background var(--transition);
}

.weui-media-box:before { border: none; }

.weui-media-box:active { background: var(--primary-light); }

.weui-media-box__hd {
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.weui-media-box_appmsg .weui-media-box__hd {
  width: var(--thumb-w);
  height: var(--thumb-h);
  line-height: normal;
  text-align: left;
  flex-shrink: 0;
}

.weui-media-box_appmsg .weui-media-box__thumb,
.weui-media-box__thumb {
  width: var(--thumb-w);
  height: var(--thumb-h);
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.weui-media-box__title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  white-space: normal;
}

.weui-media-box__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Chapter row with percentage */
.chapter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chapter-pct {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
  margin-left: 8px;
}

.chapter-pct--done {
  background: var(--success-bg);
  color: var(--success);
}

/* -------- WeUI Form -------- */
.weui-form { background: transparent; padding: 0; }

.weui-form__text-area {
  padding: 24px var(--page-margin) 8px;
  text-align: center;
}

.weui-form__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.weui-form__desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.weui-form__control-area { margin: 0; }

.weui-cells__group_form { margin: 0 var(--page-margin); }

.weui-cells_form .weui-cell {
  border-radius: var(--radius-md);
  margin-bottom: 1px;
}

.weui-cells_form .weui-cell:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.weui-cells_form .weui-cell:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.weui-cells_form .weui-cell:first-child:last-child { border-radius: var(--radius-md); }

.weui-form__opr-area {
  padding: 20px var(--page-margin);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* -------- WeUI Tab / Navbar -------- */
.weui-navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.weui-navbar__item {
  font-size: 15px;
  color: var(--text-muted);
  padding: 14px 0;
}

.weui-navbar__item.weui-bar__item_on {
  color: var(--primary);
  font-weight: 600;
}

.weui-navbar__item.weui-bar__item_on:after {
  background: var(--primary);
  height: 2px;
  border-radius: 1px;
}

/* -------- Tabbar (Bottom Nav) -------- */
.weui-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}

.weui-tabbar__item { padding: 4px 0; }

.weui-tabbar__icon {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
  /* Inactive: warm muted gray via reduced opacity */
  opacity: 0.45;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.weui-tabbar__label {
  color: var(--text-muted);
  font-size: 10px;
}

.weui-bar__item_on .weui-tabbar__icon {
  /* Active: copper #b1744b via CSS filter from black source */
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(56%) sepia(33%) saturate(768%) hue-rotate(343deg) brightness(95%) contrast(87%);
}

.weui-tabbar__item.weui-bar__item_on .weui-tabbar__label { color: var(--primary); }

/* -------- Select -------- */
.weui-cell_select {
  background: var(--card-bg);
  padding: 12px var(--page-margin);
  margin: 10px var(--page-margin);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.weui-select { font-size: 15px; color: var(--text); }

/* -------- Filter Row -------- */
.filter-row {
  display: flex;
  gap: 8px;
  margin: 8px var(--page-margin);
}

.filter-select {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 14px;
  color: var(--text);
}

/* -------- LoadMore / Year Section -------- */
.weui-loadmore { margin: 16px auto; }
.weui-loadmore_line { border-color: var(--border); }
.weui-loadmore__tips {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
}

.credit-year {
  text-align: center;
  padding: 14px var(--page-margin) 10px;
}

.credit-year span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 1px;
}

/* -------- Footer -------- */
.weui-footer {
  padding: 24px var(--page-margin);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.weui-footer__text { color: var(--text-muted); font-size: 14px; }

/* -------- Dialog / Toast -------- */
.weui-dialog { border-radius: var(--radius-md); overflow: hidden; }
.weui-dialog__btn_primary { color: var(--primary); font-weight: 600; }
.weui-toptips { font-size: 14px; padding: 10px; }

/* -------- Progress Bar -------- */
.weui-progress__bar {
  height: 4px;
  background: var(--border-input);
  border-radius: 2px;
}

.weui-progress__inner-bar {
  background: var(--primary);
  border-radius: 2px;
}

/* Custom progress component */
.progress-track {
  flex: 1;
  min-width: 0;
  height: 4px;
  background: var(--border-input);
  border-radius: 2px;
}

.progress-fill {
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
}

.progress-fill--done { background: var(--success); }

/* ============================================
   Custom Components
   ============================================ */

/* -------- Banner -------- */
.banner-container {
  width: 100%;
  background: var(--bg);
  padding: 0;
  overflow: hidden;
}

.banner-container img {
  width: 100%;
  height: auto;
  display: block;
}

/* -------- Customer Service QR -------- */
.customer-service {
  text-align: center;
  padding: 18px var(--page-margin);
  background: var(--card-bg);
  border-radius: var(--radius-md);
  margin: 0 var(--page-margin) var(--card-gap);
  border: 1px solid var(--border);
}

.customer-service p {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.customer-service img {
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  max-width: 240px;
  height: auto;
}

/* -------- Service Hotline -------- */
.service-hotline {
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* -------- Credit Panel (Ring + Stats) -------- */
.credit-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 0 var(--page-margin) var(--card-gap);
  display: flex;
  align-items: center;
  gap: 20px;
}

.credit-ring {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.credit-ring__track {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--border-input);
}

.credit-ring__fill {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
}

.credit-ring__value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.credit-stats {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credit-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.credit-stat__num {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.credit-stat__label {
  font-size: 13px;
  color: var(--text-muted);
}

/* -------- Credit Overview (General) -------- */
.info {
  margin: 0 var(--page-margin) 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.info.fs12 {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 400;
}

/* -------- Credit Bar (Table Style) -------- */
.credit-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0 var(--page-margin) var(--card-gap);
}

.credit-bar__row {
  display: flex;
  align-items: center;
  padding: 10px var(--page-margin);
}

.credit-bar__row + .credit-bar__row {
  border-top: 1px solid var(--border);
}

.credit-bar__name {
  width: 52px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.credit-bar__nums {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-around;
}

.credit-bar__item {
  text-align: center;
}

.credit-bar__item label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.credit-bar__item b {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.credit-bar__item.ok b { color: var(--success); }
.credit-bar__item.warn b { color: var(--primary); }
.credit-bar__item.need b { color: var(--warning); }

.credit-bar__item i {
  font-size: 11px;
  font-style: normal;
  color: var(--text-muted);
}

.credit-bar__tag {
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 8px;
}

.credit-bar__tag--ok   { background: var(--success-bg); color: var(--success); }
.credit-bar__tag--warn { background: var(--primary-light); color: var(--primary); }
.credit-bar__tag--need { background: var(--warning-bg); color: var(--warning); }

/* -------- Status Tags (Badge) -------- */
.credit-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.credit-tag--ok   { background: var(--success-bg); color: var(--success); }
.credit-tag--warn { background: var(--primary-light); color: var(--primary); }
.credit-tag--need { background: var(--warning-bg); color: var(--warning); }

/* Generic badge */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.badge--done    { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg); color: var(--danger); }
.badge--muted   { background: var(--primary-light); color: var(--text-muted); }

/* -------- Enroll / Selected Badge -------- */
.enroll-btn {
  display: inline-block;
  padding: 4px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}

.selected-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--success);
  color: #fff;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}

/* -------- Sort Tag -------- */
.sort-tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* -------- Highlight Colors -------- */
.yellow { color: var(--warning); font-weight: 600; }
.blue   { color: var(--primary); }

/* -------- Flex -------- */
.weui-flex__item { text-align: center; }

/* -------- Misc Utilities -------- */
.hide { display: none; }
.fs12 { font-size: 12px; color: var(--text-muted); }
.right { float: right; }
.button-sp-area { text-align: center; }
.button-sp-area .weui-btn { margin: 8px; }

/* My page action buttons */
.my-actions {
  padding: var(--page-margin);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.my-actions .weui-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 500;
}

/* Course card wrapper: unifies media-box + progress + footer */
.course-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: var(--card-gap);
  overflow: hidden;
}
.course-card .weui-media-box_appmsg {
  border-radius: 0;
  background: transparent;
}
.course-card .weui-progress {
  padding: 0 var(--page-margin);
}
.course-card .course-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--page-margin) 14px;
  gap: 12px;
}
.course-card-foot__info {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}
.course-card-foot__link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.course-card-foot__link:active {
  color: var(--primary-dark);
}

/* Record card: table-free flex layout */
.record-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: var(--card-gap);
  padding: 14px var(--page-margin);
}
.record-card__title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
}
.record-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.8;
}
.record-item {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
}
.record-label {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 2px;
}
.record-value {
  color: var(--text-secondary);
}
.record-link {
  color: var(--primary);
  text-decoration: none;
  margin-left: 2px;
}
.record-link:active {
  color: var(--primary-dark);
}

/* Back navigation link for non-tabbar pages */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  padding: 12px var(--page-margin);
}
.back-link:active {
  color: var(--primary-dark);
}

/* ============================================
   悬浮客服按钮 / Floating CS Button
   ============================================ */
.cs-float-btn {
  position: fixed; z-index: 99;
  width: 60px; height: 60px;
  left: 12px; top: 200px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: opacity .25s, transform .15s;
}
.cs-float-btn:active { transform: scale(.92); }
.cs-float-btn img { width: 100%; height: 100%; display: block; border-radius: 8px; }
.cs-float-btn .cs-close {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  font-size: 11px; line-height: 18px; text-align: center;
  color: var(--text-muted); box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.cs-float-btn.is-hidden { display: none; }

/* 底部地区面板 */
.cs-panel-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100;
  background: rgba(0,0,0,.4);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.cs-panel-backdrop.is-show { opacity: 1; pointer-events: auto; }

.cs-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 101;
  background: var(--card-bg); border-radius: 12px 12px 0 0;
  transform: translateY(100%); transition: transform .25s ease;
  max-height: 60vh; overflow-y: auto;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
.cs-panel.is-show { transform: translateY(0); }
.cs-panel__hd {
  text-align: center; padding: 14px; font-size: 16px; font-weight: 600;
  color: var(--text); border-bottom: 1px solid var(--border);
}
.cs-panel__item {
  display: block; width: 100%; padding: 14px 16px;
  font-size: 15px; color: var(--text-body);
  border-bottom: 1px solid var(--border); cursor: pointer;
  background: none; border-left: none; border-right: none; border-top: none;
  text-align: left; font-family: inherit;
}
.cs-panel__item:active { background: var(--primary-light); }

/* 二维码遮罩层 */
.cs-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex; justify-content: center; align-items: center;
  cursor: pointer;
}
.cs-overlay img {
  width: 220px; height: auto; border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
}

/* Order card: same pattern as record-card */
.order-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: var(--card-gap);
  padding: 14px var(--page-margin);
}
.order-row {
  display: flex;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.8;
}
.order-label {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 64px;
}
.order-value {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.order-value a {
  color: var(--primary);
  text-decoration: none;
}

/* Section year title */
.section-year {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 12px 0 8px;
  letter-spacing: 2px;
}
