/* ==========================================================================
   GCPlus 棒垒球比赛管理系统 - 核心设计系统与基础样式
   ========================================================================== */

/* 1. 变量与主题定义 */
:root {
  /* HSL 调色盘：棒垒球绿茵 (Ballpark Emerald) 暗夜主题 */
  --bg-primary-hsl: 140, 38%, 5%;
  --bg-secondary-hsl: 142, 40%, 9%;
  --bg-tertiary-hsl: 142, 38%, 15%;

  --bg-primary: hsl(var(--bg-primary-hsl));
  --bg-secondary: hsl(var(--bg-secondary-hsl));
  --bg-tertiary: hsl(var(--bg-tertiary-hsl));

  /* 品牌强调色 */
  --accent-green: #2ecc71;
  /* 绿茵草皮亮绿 */
  --accent-green-glow: rgba(46, 204, 113, 0.35);
  --accent-gold: #f1c40f;
  /* 荣耀黄金 */
  --accent-gold-glow: rgba(241, 196, 15, 0.3);
  --accent-red: #e74c3c;
  /* 棒垒球缝线红 */
  --accent-red-glow: rgba(231, 76, 60, 0.3);

  /* 文本颜色 */
  --text-primary: #ffffff;
  --text-secondary: #a6b9ad;
  /* 带墨绿相偏的柔和灰 */
  --text-muted: #677d70;
  /* 喑哑灰绿 */

  /* 毛玻璃与边框 */
  --glass-bg: rgba(15, 43, 24, 0.75);
  --glass-border: rgba(46, 204, 113, 0.15);
  --glass-border-focus: rgba(46, 204, 113, 0.4);
  --glass-blur: blur(20px);

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 15px var(--accent-green-glow);

  /* 布局与层级 */
  --header-height: 52px;
  --nav-height: 68px;
  --z-index-header: 100;
  --z-index-nav: 100;
  --z-index-overlay: 500;
  --z-index-drawer: 600;
  --z-index-toast: 1000;

  /* 安全区域适配 (iOS 底部刘海) */
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-top: env(safe-area-inset-top, 0px);
}

/* 2. 全局重置与基础配置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  /* 移除移动端点击高亮 */
}

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  background-color: #030805;
  /* 桌面端外围背景，突出居中的手机模拟器 */
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* 3. 手机视口主容器 (锁定手机端尺寸，桌面居中，真机全屏) */
#app-container {
  width: 100%;
  max-width: 480px;
  /* 锁死最大宽度 */
  height: 100vh;
  /* 动态高度适配移动端浏览器工具栏 */
  height: -webkit-fill-available;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  border-left: 1px solid rgba(46, 204, 113, 0.08);
  border-right: 1px solid rgba(46, 204, 113, 0.08);
}

/* 4. 顶部 Header 样式 */
#app-header {
  height: var(--header-height);
  background: linear-gradient(180deg, rgba(12, 35, 20, 0.95) 0%, rgba(8, 20, 12, 0.95) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: var(--z-index-header);
  flex-shrink: 0;
}

/* 状态与时间栏 */
.header-status {
  display: none;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.network-badge {
  display: flex;
  align-items: center;
  gap: 4px;
}

.network-badge i {
  font-size: 6px;
  color: var(--accent-green);
  animation: pulse-green 2s infinite;
}

/* 头部主标题区 */
.header-main {
  display: flex;
  align-items: center;
  gap: 5px;
}

.logo-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-green) 0%, #1e8449 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
}

.logo-icon-wrapper i {
  color: #ffffff;
  font-size: 16px;
}

.app-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, #ffffff 60%, var(--accent-green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.accent-text {
  font-weight: 400;
}

.active-season-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: rgba(241, 196, 15, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(241, 196, 15, 0.25);
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.active-season-badge:hover {
  background: rgba(241, 196, 15, 0.22);
  border-color: rgba(241, 196, 15, 0.45);
  transform: translateY(-0.5px);
}

.active-season-badge:active {
  transform: scale(0.96);
}

/* 5. 主页面视图容器与视图切换 */
#app-content {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 5px 5px;
  padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 16px);
  /* 留出底部导航空间 */
  position: relative;
  /* 隐藏滚动条，但保持滚动能力 */
  scrollbar-width: none;
}

#app-content::-webkit-scrollbar {
  display: none;
}

/* 视图显示隐藏控制器 */
.app-view {
  display: none;
  flex-direction: column;
  width: 100%;
}

.app-view.active {
  display: flex;
  animation: view-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 6. 通用排版与按钮 */
h2.view-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.view-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}

/* 按钮基础设计 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-green) 0%, #27ae60 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.25);
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 6px rgba(46, 204, 113, 0.15);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-outline:active {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(0.96);
}

/* 占位图视图 (用于未实现模块) */
.placeholder-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  height: 50vh;
}

.placeholder-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(46, 204, 113, 0.05);
  border: 1px dashed var(--glass-border);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.placeholder-icon i {
  font-size: 32px;
  color: var(--text-muted);
}

.placeholder-view h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.placeholder-view p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  max-width: 280px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-outline {
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

/* 7. 加载旋转动画 */
.loading-spinner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  width: 100%;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(46, 204, 113, 0.1);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner-wrapper p {
  font-size: 12px;
  color: var(--text-muted);
}

/* 8. 动画关键帧 */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-green {
  0% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
  }

  70% {
    transform: scale(1.05);
    opacity: 0.6;
    box-shadow: 0 0 0 4px rgba(46, 204, 113, 0);
  }

  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
  }
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}