/* components.css — Design_Standard.md § 6 components.
   Source of truth: Design_Standard.md v1.1.
   No hex literals (R-26). All colors via CSS variables from tokens.css.
   ISS-T1A07-05 闭环：book-card scoped class 改为 var() 引用 :root 固定别名。*/

/* ===== § 6.1 Buttons ===== */
.btn-primary {
  background: var(--accent1);
  color: white;
  border: 2px solid var(--navy);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-bento);
  padding: 12px 24px;
  font-weight: 700;
  font-size: var(--fs-body);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--navy);
}

.btn-primary:active {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 var(--navy);
}

.btn-secondary {
  background: white;
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-bento);
  padding: 12px 24px;
  font-weight: 700;
  font-size: var(--fs-body);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.btn-secondary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--navy);
}

/* ===== § 6.2 Input ===== */
.input {
  width: 100%;
  background: white;
  border: 2px solid var(--accent1-tint);
  border-radius: var(--radius-input);
  padding: 12px 16px;
  font-size: var(--fs-body);
  font-family: var(--font-body);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input:focus {
  outline: none;
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* ===== § 6.3 Top Bar ===== */
.topbar {
  background: var(--navy);
  color: white;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.topbar .brand {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: 20px;
  letter-spacing: 0.02em;
  color: white;
}

.topbar .user {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.78);
}

.topbar form {
  display: inline;
  margin: 0;
}

/* ===== § 6.4 Book Card ===== */
/* Language 卡片：从 :root 默认 Language 主题派生 */
.book-card--language {
  --card-navy: var(--navy);
  --card-hero: var(--accent1);
  --card-bg: var(--bg);
}

/* Economics 卡片：从 :root 固定别名派生（跨主题可达，不依赖 data-theme） */
.book-card--econ {
  --card-navy: var(--econ-navy);
  --card-hero: var(--econ-accent1);
  --card-bg: var(--econ-bg);
}

.book-card {
  background: var(--card-bg);
  border: 2px solid var(--card-navy);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 24px;
  text-decoration: none;
  display: block;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.book-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--card-navy);
}

.book-card:focus-visible {
  outline: 3px solid var(--accent4);
  outline-offset: 4px;
}

.book-card h3 {
  color: var(--card-navy);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.book-card .meta {
  font-size: var(--fs-sm);
  color: var(--text-body);
  margin-bottom: 16px;
}

.book-card .cta {
  display: inline-block;
  background: var(--card-hero);
  color: white;
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-weight: 700;
  font-size: var(--fs-sm);
}

/* ===== § 6.5 Lesson Row (T1B 备用) ===== */
.lesson-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: white;
  border-bottom: 1px solid var(--accent1-tint);
  transition: background 150ms ease;
}

.lesson-row:hover {
  background: rgba(59, 130, 246, 0.04);
}

[data-theme="econ"] .lesson-row:hover {
  background: rgba(220, 38, 38, 0.04);
}

.lesson-row .idx {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--navy);
  min-width: 48px;
}

.lesson-row .title {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lesson-row .title-zh {
  color: var(--text-body);
}

.lesson-row .title-en {
  color: var(--text-body);
  font-size: var(--fs-sm);
  opacity: 0.6;
  margin-top: 2px;
}

.lesson-row .cta {
  color: var(--accent1);
  font-weight: 700;
  font-size: var(--fs-sm);
}

/* ===== Watermark (R-16 + Design_Standard § 6.6) ===== */
.watermark {
  position: fixed;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
  transform: rotate(-45deg);
  font-size: 18px;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  z-index: 9999;
  font-family: var(--font-body);
  font-weight: 700;
}

/* ===== Login Card layout ===== */
.login-card {
  max-width: 440px;
  margin: 80px auto;
  padding: 40px;
  background: white;
  border: 2px solid var(--navy);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
}

.login-card h1 {
  margin-bottom: 24px;
  text-align: center;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card .error {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: var(--radius-input);
  font-size: var(--fs-sm);
}

/* Login wrapper centers card on full viewport */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 16px;
}

/* ===== Dashboard layout ===== */
.dashboard-main {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
}

.subject-group {
  margin-bottom: 48px;
}

.subject-group h2 {
  margin-bottom: 16px;
  color: var(--navy);
}

.subject-group[data-subject="Economics"] h2 {
  color: var(--econ-navy);
}

.book-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-body);
  font-size: var(--fs-body);
}

@media (min-width: 768px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-main {
    padding: 0 48px;
  }
}

/* ===== T-UI-ASSEMBLY bento/status/decorative classes (R-26 vars only) ===== */

.deco-hills {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  pointer-events: none;
}

.bento-card {
  background: var(--white);
  border: 2px solid var(--navy);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.bento-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--navy);
}

.bento-card--static,
.bento-card--static:hover {
  transform: none;
  box-shadow: var(--shadow-bento);
}

.btn-bento {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-body);
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  border: 2px solid var(--navy);
  background: var(--accent1);
  color: white;
  box-shadow: var(--shadow-bento);
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.btn-bento:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--navy);
}

.btn-bento:active {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 var(--navy);
}

/* ===== Topbar extensions ===== */

.topbar__brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__user-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__sep,
.topbar__subtitle {
  display: none;
  font-size: var(--fs-sm);
}

.topbar__sep {
  color: rgba(255, 255, 255, 0.4);
}

.topbar__subtitle {
  color: rgba(255, 255, 255, 0.6);
}

@media (min-width: 768px) {
  .topbar__sep,
  .topbar__subtitle {
    display: inline;
  }
}

.topbar__logout {
  background: none;
  border: none;
  padding: 0;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease;
}

.topbar__logout:hover {
  color: white;
}

/* ===== Book card v2 (color header + body) ===== */

.book-card__header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: white;
  border-top-left-radius: calc(var(--radius-card) - 2px);
  border-top-right-radius: calc(var(--radius-card) - 2px);
}

.book-card--econ .book-card__header {
  background: var(--econ-navy);
}

.book-card__subject {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.8);
}

.book-card__body {
  padding: 20px;
}

.book-card__body .meta {
  font-size: var(--fs-sm);
  color: var(--text-body);
  margin-bottom: 0;
}

.book-card__body .cta {
  background: none;
  color: var(--accent1);
  padding: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.book-card--econ .book-card__body .cta {
  color: var(--econ-accent1);
}

.book-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.book-card {
  padding: 0;
  overflow: hidden;
}

.book-card--econ {
  border-color: var(--econ-navy);
  box-shadow: 4px 4px 0 var(--econ-navy);
}

.book-card--econ:hover {
  box-shadow: 6px 6px 0 var(--econ-navy);
}

/* ===== Dashboard subject-group header v2 ===== */

.subject-group__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.subject-group__bar {
  width: 4px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent1);
}

.subject-group[data-subject="Economics"] .subject-group__bar {
  background: var(--econ-accent1);
}

.subject-group[data-subject="Economics"] .subject-group__heading h2 {
  color: var(--econ-navy);
}

.subject-group__subtitle {
  font-size: var(--fs-sm);
  color: var(--text-body);
  margin-left: 28px;
  margin-bottom: 20px;
}

/* ===== Book hero ===== */

.book-hero {
  padding: 48px 24px;
  background: var(--navy);
  color: white;
}

[data-theme="econ"] .book-hero {
  background: var(--navy);
}

.book-hero__inner {
  max-width: 960px;
  margin: 0 auto;
}

.book-hero__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 150ms ease;
}

.book-hero__back:hover {
  color: white;
}

.book-hero__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.book-hero__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: var(--accent1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.book-hero__subject {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 2px;
}

.book-hero h1 {
  color: white;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  margin: 0;
}

.book-hero__count {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--fs-body);
  margin-top: 12px;
}

.book-lessons-wrap {
  max-width: 960px;
  margin: -24px auto 48px;
  padding: 0 24px;
}

[data-theme="econ"] .book-lessons-wrap .bento-card {
  border-color: var(--navy);
  box-shadow: 4px 4px 0 var(--navy);
}

.lesson-row .cta {
  opacity: 0;
  transition: opacity 150ms ease;
}

.lesson-row:hover .cta {
  opacity: 1;
}

/* ===== Status pages (404 / blocked / error) ===== */

.status-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 0 16px;
}

.status-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  padding: 40px 32px;
  position: relative;
  z-index: 1;
}

.status-card__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.status-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  color: var(--navy);
  opacity: 0.2;
  margin-bottom: 8px;
  line-height: 1;
}

.status-card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h2);
  color: var(--navy);
  margin-bottom: 8px;
}

.status-card p {
  color: var(--text-body);
  font-size: var(--fs-body);
  margin-bottom: 24px;
  line-height: var(--lh-body);
}

.status-footer {
  color: var(--text-body);
  font-size: var(--fs-xs);
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

/* ===== Login page layout ===== */

.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.login-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 64px;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .login-main {
    align-items: center;
    padding-top: 0;
  }
}

.login-inner {
  width: 100%;
  max-width: 420px;
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  color: var(--navy);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.login-brand p {
  color: var(--text-body);
  font-size: var(--fs-body);
}

.login-card-v2 {
  padding: 32px;
}

.login-card-v2 h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  color: var(--navy);
  margin-bottom: 24px;
}

.login-card-v2 form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card-v2 label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-body);
  margin-bottom: 6px;
}

.login-card-v2 .btn-bento {
  width: 100%;
  margin-top: 8px;
}

.login-error-banner {
  padding: 12px 16px;
  background: var(--danger-tint);
  border: 1px solid var(--danger);
  border-radius: var(--radius-input);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.login-error-banner span {
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.login-footer {
  text-align: center;
  color: var(--text-body);
  font-size: var(--fs-xs);
  margin-top: 24px;
}

/* Decorative geometric elements on login page (768px+) */
.login-deco {
  display: none;
  position: absolute;
  border: 2px solid var(--navy);
  opacity: 0.08;
  pointer-events: none;
}

@media (min-width: 768px) {
  .login-deco {
    display: block;
  }
}

.login-deco--sq-lg {
  top: 48px;
  right: 48px;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-card);
  transform: rotate(12deg);
}

.login-deco--sq-sm {
  top: 128px;
  right: 128px;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-card);
  transform: rotate(-6deg);
  border-color: var(--accent1);
  opacity: 0.1;
}

.login-deco--circle {
  bottom: 160px;
  left: 64px;
  width: 80px;
  height: 80px;
  border-radius: 999px;
  opacity: 0.06;
}

/* R-26 exemption: .input:focus uses rgba(59,130,246,0.15) — no CSS4 var-alpha equivalent in stable browsers */

/* HOTFIX-02: 双语标题 */
.book-card__title-en {
  font-size: var(--fs-sm);
  font-weight: 400;
  opacity: 0.65;
  margin-top: 4px;
}

.book-card--econ .book-card__title-en {
  color: var(--econ-navy);
}

.book-hero__title-en {
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--fs-body);
  font-weight: 400;
  margin-top: 4px;
}
