/* ═══════════════════════════════════════
    折纸剧场 · 全局样式
   ═══════════════════════════════════════ */

/* ━━ 设计 Token 定义 ━━ */
:root {
  --paper:     #F7F3ED;
  --paper-warm:#EDE6D8;
  --paper-cool:#E8E4DE;
  --paper-dark:#D9D2C5;

  --ink:       #2C2C2C;
  --ink-mid:   #5A5A5A;
  --ink-light: #8C8C8C;

  --seal:      #C23A2B;
  --seal-soft:#E8D5D0;

  --fold:      #D4CFC7;
  --success:  #5B8C5A;
  --warning:  #C49A3C;

  /* 现代 UI 别名 */
  --surface:      var(--paper);
  --surface-warm: var(--paper-warm);
  --surface-ink:   var(--paper-dark);
  --surface-rose:  var(--seal-soft);
  --brand:        var(--seal);
  --brand-warm:   #B8352B;
  --brand-glow:   rgba(194, 58, 43, 0.08);
  --text-primary:   var(--ink);
  --text-secondary: var(--ink-mid);
  --text-faint:    var(--ink-light);
  --text-muted:    #999;
  --border:       var(--fold);
  --border-light:  #D9D3CA;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.08);
  --shadow-brand: 0 4px 16px rgba(194,58,43,0.2);
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  8px;
  --radius-xl: 12px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基础重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── 全屏页面（首页、详情页）不使用 flex 布局 ── */
body.fullpage {
  display: block;
}

body {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'SimSun', serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.8;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── 折痕线 ── */
.fold-line {
  width: 100%;
  height: 1px;
  background: var(--fold);
  position: relative;
  margin: 0;
}
.fold-line::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 1px;
  height: 2px;
  background: linear-gradient(180deg, rgba(0,0,0,0.03), transparent);
}

/* ── 翘角 ── */
.paper-lift {
  position: relative;
}
.paper-lift::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 24px; height: 24px;
  background: linear-gradient(135deg, var(--paper) 50%, var(--fold) 50%, var(--paper-warm) 56%);
  box-shadow: -2px -2px 4px rgba(0,0,0,0.04);
}

/* ── 朱印标记 ── */
.seal-mark {
  display: inline-block;
  padding: 2px 10px;
  border: 1.5px solid var(--seal);
  color: var(--seal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.6;
  transform: rotate(-1deg);
}

/* ── Header ── */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--fold);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-image {
  height: 42px;
  width: auto;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.nav-item {
  color: var(--ink-mid);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  padding: 6px 10px;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.nav-shop {
  color: var(--accent);
}

.nav-item:hover {
  color: var(--seal);
}

.nav-item.active {
  color: var(--seal);
  font-weight: 700;
}

.nav-sep {
  color: var(--fold);
  font-size: 12px;
}

.nav-highlight {
  background: var(--seal);
  color: var(--paper) !important;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  border: none;
}

.nav-highlight:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* 下拉菜单 */
.nav-dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  border: 1px solid var(--fold);
  min-width: 140px;
  padding: 6px 0;
  z-index: 100;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.nav-dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  color: var(--ink-mid);
  padding: 8px 18px;
  text-decoration: none;
  display: block;
  font-size: 13px;
  transition: all 0.15s ease;
}

.dropdown-content a:hover {
  background: var(--paper-warm);
  color: var(--seal);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 认证按钮 */
.auth-buttons {
  display: flex;
  gap: 10px;
}

.btn-login, .btn-register {
  padding: 6px 18px;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn-login {
  color: var(--ink-mid);
  border: 1px solid var(--fold);
}

.btn-login:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
}

.btn-register {
  background: var(--seal);
  color: var(--paper);
}

.btn-register:hover {
  opacity: 0.85;
}

/* 用户信息 */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.username {
  font-weight: 600;
  color: var(--seal);
  font-size: 13px;
  text-decoration: none;
}

.user-balance {
  color: var(--ink-light);
  font-size: 12px;
}

.btn-logout {
  padding: 4px 12px;
  background: var(--seal-soft);
  color: var(--seal);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: var(--seal);
  color: var(--paper);
}

/* 主题切换 */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--ink-mid);
  transition: color 0.2s;
}

.theme-toggle:hover {
  color: var(--seal);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}
body:not(.dark) .theme-toggle .icon-sun { display: block; }
body.dark .theme-toggle .icon-moon { display: block; }

/* ── Footer ── */
.site-footer {
  background: var(--paper-warm);
  margin-top: auto;
  border-top: 1px solid var(--fold);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 28px;
}

.footer-section h3 {
  color: var(--seal);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

.footer-section h4 {
  color: var(--ink);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.footer-section p {
  color: var(--ink-light);
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.7;
}

.footer-section a {
  color: var(--ink-light);
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  transition: color 0.2s ease;
}

.footer-section a:hover {
  color: var(--seal);
}

.footer-bottom {
  border-top: 1px solid var(--fold);
  padding-top: 16px;
  text-align: center;
}

.copyright p {
  color: var(--ink-light);
  font-size: 11px;
  margin-bottom: 4px;
}

.copyright a {
  color: var(--ink-light);
  text-decoration: none;
}

.copyright a:hover {
  color: var(--seal);
}

/* 主内容区 */
main {
  flex: 1;
  min-height: calc(100vh - 120px);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-light);
}

/* ── 移动端响应式 ── */
@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    position: relative;
  }

  .header-left { flex: 1; min-width: 0; }
  .logo-image { height: 32px; }

  .header-nav { display: none; }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }
  .mobile-menu-btn svg { width: 24px; height: 24px; color: var(--ink); }

  .mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-top: 1px solid var(--fold);
    padding: 16px;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-md);
  }
  .mobile-nav.open { display: flex; }

  .mobile-nav .nav-item {
    padding: 12px 16px;
    color: var(--ink);
    display: block;
  }

  .header-right { gap: 8px; }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer-section { text-align: center; }
}

/* 默认显示隐藏的移动端元素 */
@media (min-width: 769px) {
  .mobile-menu-btn,
  .mobile-nav { display: none !important; }
}

/* ── Toast 通知 ── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--paper);
  border: 1px solid var(--fold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  animation: toastIn 0.3s ease;
}

.toast.toast-exit {
  animation: toastOut 0.3s ease forwards;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--seal); }
.toast-info { border-left: 3px solid var(--ink-mid); }

.toast-icon svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--seal); }
.toast-info .toast-icon { color: var(--ink-mid); }

.toast-message {
  font-size: 14px;
  color: var(--ink);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--seal);
  animation: progressShrink 3s linear forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

@keyframes progressShrink {
  from { width: 100%; }
  to { width: 0%; }
}