/* components.css - Apple HIG 组件样式 v5.0 */

/* ================================================================
   首页头部
   ================================================================ */
.baike-header {
  text-align: center;
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--separator);
}
.baike-title {
  font-size: var(--fs-title);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
}
.baike-subtitle {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

/* ================================================================
   天气卡片
   ================================================================ */
.weather-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: relative;
  transition: box-shadow 0.2s var(--ease-in-out);
}
.weather-card:hover { box-shadow: var(--card-shadow-hover); }
.weather-card--loading { opacity: 0.6; }

.weather-location-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-size: var(--fs-meta);
  color: var(--text-secondary);
}

.weather-icon-temp-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.weather-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  width: 48px;
  height: 48px;
}
.weather-icon svg { width: 100%; height: 100%; }

.weather-temp {
  font-size: var(--fs-temp);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1.2;
}

.weather-info-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.weather-desc {
  font-size: var(--fs-secondary);
  color: var(--text-secondary);
}

.weather-details {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  font-size: var(--fs-meta);
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.weather-source-text {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  font-size: var(--fs-meta);
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  transition: color 0.2s var(--ease-in-out);
}
.weather-source-text:hover { color: var(--text-secondary); }

/* ================================================================
   首页操作行（关注公众号 + 主题切换）
   ================================================================ */
.home-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.wechat-qr-entry {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  color: var(--btn-text);
  font-size: var(--fs-caption);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s var(--ease-in-out);
  min-height: var(--touch-min);
}
.wechat-qr-entry:hover { color: var(--btn-hover-text); }
.wechat-qr-entry svg { flex-shrink: 0; }
.wechat-qr-entry-arrow { opacity: 0.5; transition: transform 0.2s; }
.wechat-qr-entry:hover .wechat-qr-entry-arrow { opacity: 0.8; transform: translateX(2px); }

.theme-switch-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  cursor: pointer;
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  transition: color 0.2s;
  min-height: var(--touch-min);
}
.theme-switch-bar:hover { color: var(--text-secondary); }
.theme-switch-bar .tsb-icon-wrap {
  position: relative;
  width: 14px; height: 14px;
}
.theme-switch-bar .tsb-icon {
  position: absolute;
  inset: 0;
  width: 14px; height: 14px;
  transition: opacity 0.25s, transform 0.25s;
}
.theme-switch-bar .tsb-icon.sun { opacity: 1; transform: scale(1); }
.theme-switch-bar .tsb-icon.moon { opacity: 0; transform: scale(0.5); }
[data-theme="dark"] .theme-switch-bar .tsb-icon.sun { opacity: 0; transform: scale(0.5); }
[data-theme="dark"] .theme-switch-bar .tsb-icon.moon { opacity: 1; transform: scale(1); }

/* ================================================================
   搜索页面
   ================================================================ */
.search-page-container {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}
.search-page-top-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.internal-search-header {
  text-align: center;
  margin-bottom: var(--space-lg);
  flex-shrink: 0;
}

.internal-search-logo {
  width: 50px; height: 50px;
  margin: 0 auto 8px;
  color: var(--text-primary);
  display: block;
}

.internal-search-title {
  font-size: var(--fs-title);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* 搜索框 */
.search-box-wrapper {
  width: 100%;
  max-width: 500px;
  margin-bottom: var(--space-md);
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  border: 1px solid var(--btn-border);
  border-radius: 24px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--text-secondary);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}

.search-input {
  flex: 1;
  height: 100%;
  padding: 0 var(--space-md);
  border: none;
  font-size: var(--fs-body);
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-sans);
}
.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s;
}
.search-button:hover { color: var(--text-primary); }
.search-button svg { width: 20px; height: 20px; }

.search-results { margin-top: var(--space-md); flex: 0 1 auto; overflow: hidden; }

/* 公众号文章折叠区 */
.wechat-articles-collapse {
  width: 100%;
  max-width: 500px;
  flex-shrink: 0;
  border-top: 1px solid var(--separator);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
}

.wechat-articles-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  cursor: pointer;
  transition: color 0.2s;
  min-height: var(--touch-min);
}
.wechat-articles-trigger:hover { color: var(--text-secondary); }
.wechat-articles-trigger svg { color: var(--text-tertiary); flex-shrink: 0; }
.wechat-articles-trigger span { font-size: var(--fs-caption); color: var(--text-tertiary); }
.wechat-articles-trigger:hover span,
.wechat-articles-trigger:hover svg { color: var(--text-secondary); }
.wechat-articles-chevron { transition: transform 0.25s; }
.wechat-articles-collapse--open .wechat-articles-chevron { transform: rotate(180deg); }

.wechat-articles-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease-spring);
}
.wechat-articles-collapse--open .wechat-articles-panel {
  max-height: 450px;
  overflow-y: auto;
}

.wechat-articles-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

/* 文章卡片 */
.wechat-article-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.wechat-article-item:hover { box-shadow: var(--card-shadow-hover); }

.wechat-article-cover {
  width: 60px; height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
}
.wechat-article-cover img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

.wechat-article-info {
  flex: 1; min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  overflow: hidden;
}

.wechat-article-title {
  font-size: var(--fs-body);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wechat-article-summary {
  font-size: var(--fs-secondary);
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wechat-article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.wechat-articles-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-sm);
}
.wechat-articles-page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--btn-text);
  cursor: pointer;
  transition: color 0.2s;
}
.wechat-articles-page-btn:hover:not(.disabled) {
  color: var(--btn-hover-text);
}
.wechat-articles-page-btn.disabled { opacity: 0.3; cursor: default; }
.wechat-articles-page-info { font-size: var(--fs-caption); color: var(--text-tertiary); }
.wechat-articles-empty { text-align: center; padding: var(--space-md); font-size: var(--fs-secondary); color: var(--text-tertiary); }

/* ================================================================
   搜索弹窗
   ================================================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9000;
  touch-action: none;
  animation: fadeIn 0.25s var(--ease-in-out) both;
}
.search-overlay.closing { animation: fadeOut 0.2s var(--ease-exit) both; }

.search-popup-container {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 560px;
  max-height: 80vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--popup-shadow);
  z-index: 9001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popupEnter 0.3s var(--ease-spring) both;
}
.search-popup-container.closing { animation: popupExit 0.2s var(--ease-exit) both; }

.search-popup-header {
  display: flex;
  align-items: center;
  padding: var(--space-lg) var(--space-lg) 0;
  border-bottom: 1px solid var(--separator);
  flex-shrink: 0;
  position: relative;
}
.search-popup-close {
  position: absolute;
  top: var(--space-lg); right: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--modal-close-text);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
}
.search-popup-close:hover { color: var(--text-primary); }

.search-popup-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-size: var(--fs-body);
  line-height: 1.6;
}
.search-popup-body::-webkit-scrollbar { display: none; }

/* MD 内容排版 */
.search-popup-body h1 { font-size: var(--font-title-2); font-weight: var(--weight-semibold); margin: 0 0 24px; }
.search-popup-body h2 { font-size: 17px; font-weight: var(--weight-medium); margin: 24px 0 12px; }
.search-popup-body h3 { font-size: var(--fs-body); font-weight: var(--weight-semibold); margin: 24px 0 12px; color: var(--text-secondary); }
.search-popup-body p { margin: 0 0 16px; color: var(--text-secondary); line-height: 1.6; }
.search-popup-body p:last-child { margin-bottom: 0; }
.search-popup-body ul { margin: 16px 0 24px; padding-left: 20px; }
.search-popup-body li { margin: 8px 0; color: var(--text-secondary); line-height: 1.6; }
.search-popup-body a { color: var(--accent-color); text-decoration: underline; text-underline-offset: 2px; }
.search-popup-body a:hover { opacity: 0.75; }
.search-popup-body blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--separator);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.search-popup-body hr { border: none; border-top: 1px solid var(--separator); margin: 16px 0; }
.search-popup-body strong { color: var(--text-primary); }
.search-popup-body code { font-family: var(--font-mono); font-size: var(--fs-caption); }

.md-match-item {
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.md-match-item:hover { box-shadow: var(--card-shadow-hover); }

/* ================================================================
   开屏动画
   ================================================================ */
.splash-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.4s, visibility 0.4s;
}
.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}
.splash-logo {
  width: 80px; height: 80px;
  color: var(--text-primary);
  animation: breathe 3s var(--ease-in-out) infinite;
}
.splash-brand {
  font-size: 32px;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: 4px;
  animation: fadeIn 0.6s var(--ease-in-out) 0.15s both;
}
.splash-tagline {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-align: center;
  animation: fadeIn 0.6s var(--ease-in-out) 0.3s both;
}

/* ================================================================
   Toast
   ================================================================ */
.toast-bubble {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--fs-meta);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--popup-shadow);
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s var(--ease-spring);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast-bubble.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================================================================
   公众号二维码弹窗
   ================================================================ */
.wechat-qr-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s;
  touch-action: none;
}
.wechat-qr-overlay--show { opacity: 1; }

.wechat-qr-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-width: 90vw;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--popup-shadow);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s var(--ease-spring);
  overflow: hidden;
}
.wechat-qr-popup--show { opacity: 1; }

.wechat-qr-header {
  display: flex;
  align-items: center;
  padding: var(--space-lg) var(--space-lg) 0;
  position: relative;
}
.wechat-qr-title {
  font-size: 17px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.wechat-qr-close {
  position: absolute;
  top: var(--space-lg); right: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--modal-close-text);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
}
.wechat-qr-close:hover { color: var(--text-primary); }

.wechat-qr-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.wechat-qr-image-wrap {
  width: 200px; height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--separator);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wechat-qr-image { width: 100%; height: 100%; object-fit: contain; }
.wechat-qr-account-name { font-size: 17px; font-weight: var(--weight-bold); color: var(--text-primary); }
.wechat-qr-desc { font-size: var(--fs-caption); color: var(--text-tertiary); }

/* ================================================================
   底部 Footer
   ================================================================ */
.app-footer {
  padding: var(--space-lg);
  text-align: center;
  flex-shrink: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.footer-link {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--text-secondary); }
.footer-sep {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

.footer-beian { margin-bottom: var(--space-sm); }
.footer-beian-link {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-beian-link:hover { color: var(--text-secondary); }

.footer-copyright {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

/* ================================================================
   响应式
   ================================================================ */
@media (max-width: 1024px) {
  .splash-logo { width: 70px; height: 70px; }
  .splash-brand { font-size: 28px; }
  .baike-header { text-align: center; }
}

@media (max-width: 767px) {
  .weather-card { padding: var(--space-md); }
  .weather-temp { font-size: 28px; }
  .weather-icon { width: 40px; height: 40px; }
  .weather-source-text { top: var(--space-md); right: var(--space-md); }

  .search-box-wrapper { max-width: 90vw; }
  .wechat-articles-collapse { max-width: 90vw; }
  .wechat-article-item { padding: var(--space-sm); gap: var(--space-sm); }
  .wechat-article-cover { width: 50px; height: 50px; }
  .wechat-article-title { font-size: var(--fs-secondary); }

  .wechat-qr-popup { width: 280px; }
  .wechat-qr-image-wrap { width: 170px; height: 170px; }
  .wechat-qr-header { padding: var(--space-md) var(--space-md) 0; }
  .wechat-qr-close { top: var(--space-md); right: var(--space-md); }
  .wechat-qr-body { padding: var(--space-md); }

  .search-popup-container { width: 95vw; border-radius: var(--radius-lg); max-height: 75vh; }
  .search-popup-header { padding: var(--space-md) var(--space-md) 0; }
  .search-popup-close { top: var(--space-md); right: var(--space-md); }
  .search-popup-body { padding: var(--space-md); }

  .splash-logo { width: 60px; height: 60px; }
  .splash-brand { font-size: 24px; letter-spacing: 2.5px; }
  .app-footer { padding: var(--space-md); }
  .home-action-row { flex-direction: column; gap: var(--space-sm); }
}

/* Device class fallbacks */
.device-phone .weather-card { padding: var(--space-md); }
.device-phone .weather-temp { font-size: 28px; }
.device-phone .weather-icon { width: 40px; height: 40px; }
.device-phone .weather-source-text { top: var(--space-md); right: var(--space-md); }
.device-phone .search-box-wrapper { max-width: 90vw; }
.device-phone .wechat-articles-collapse { max-width: 90vw; }
.device-phone .wechat-article-item { padding: var(--space-sm); gap: var(--space-sm); }
.device-phone .wechat-article-cover { width: 50px; height: 50px; }
.device-phone .wechat-article-title { font-size: var(--fs-secondary); }
.device-phone .wechat-qr-popup { width: 280px; }
.device-phone .wechat-qr-image-wrap { width: 170px; height: 170px; }
.device-phone .wechat-qr-header,
.device-phone .wechat-qr-body { padding: var(--space-md); }
.device-phone .wechat-qr-close { top: var(--space-md); right: var(--space-md); }
.device-phone .search-popup-container { width: 95vw; max-height: 75vh; }
.device-phone .search-popup-header,
.device-phone .search-popup-body { padding: var(--space-md); }
.device-phone .search-popup-close { top: var(--space-md); right: var(--space-md); }
.device-phone .app-footer { padding: var(--space-md); }
.device-phone .home-action-row { flex-direction: column; gap: var(--space-sm); }
