/* ============================================
   LLMWate - 全套纯白高端轻奢风 API中转网站
   Global Unified AI API Gateway
   Mobile-First Responsive Design
   ============================================ */

:root {
  --bg-main: #ffffff;
  --bg-card: #f8f9fa;
  --bg-sidebar: #ffffff;
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --text-dark: #1e293b;
  --text-gray: #64748b;
  --text-light: #94a3b8;
  --success: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* === 滚动条美化 === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* === 通用布局 === */
.page-container {
  display: flex;
  min-height: 100vh;
}

/* === 移动端顶部栏 === */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
}

.mobile-header .logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  text-decoration: none;
}

.mobile-header .logo span {
  color: var(--primary);
}

.hamburger {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-dark);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* === 侧边栏 === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  font-size: 1.6rem;
  font-weight: 700;
  padding: 1.8rem 1.5rem 1rem;
  color: var(--text-dark);
}

.sidebar-logo span {
  color: var(--primary);
}

.sidebar-menu {
  flex: 1;
  padding: 0.5rem 0.75rem;
  overflow-y: auto;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius-sm);
  color: var(--text-gray);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-height: 48px;
}

.sidebar-menu a:hover {
  background: var(--bg-card);
  color: var(--text-dark);
}

.sidebar-menu a.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
}

.sidebar-menu a .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-menu a .icon svg {
  width: 18px;
  height: 18px;
}

/* === 主内容区 === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem;
  min-height: 100vh;
  transition: margin 0.3s ease;
}

.main-content.bg-gray {
  background: var(--bg-card);
}

/* === 移动端遮罩层 === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* === 顶部栏 === */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.top-bar h1 {
  font-size: 1.6rem;
  color: var(--text-dark);
}

.top-bar p {
  color: var(--text-gray);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-gray);
  font-size: 0.9rem;
}

/* === 卡片 === */
.card {
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 1.2rem;
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  background: #fee2e2;
  color: var(--red);
}

.btn-success {
  background: #d1fae5;
  color: var(--success);
}

/* === 统计卡片网格 === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.3rem;
  min-height: 120px;
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: rgba(37, 99, 235, 0.1);
}

.stat-card .stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card h4 {
  color: var(--text-gray);
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.stat-num {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.stat-tag {
  font-size: 0.75rem;
  margin-top: 0.3rem;
  color: var(--success);
}

/* === 表格 === */
.table-wrapper {
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  background: var(--bg-card);
}

th {
  padding: 1rem;
  text-align: left;
  color: var(--text-gray);
  font-weight: 500;
  font-size: 0.78rem;
  white-space: nowrap;
}

td {
  padding: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-dark);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* === 网格布局 === */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* === 价格卡片 === */
.price-card {
  background: var(--bg-sidebar);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.8rem;
  position: relative;
  transition: all 0.3s ease;
}

.price-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.price-card.hot {
  border-color: var(--primary);
  transform: scale(1.03);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.15);
}

.price-card.hot:hover {
  transform: scale(1.03) translateY(-4px);
}

.hot-label {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================
   响应式 - 平板 (768px - 1024px)
   ============================================ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .main-content {
    padding: 1.8rem 1.5rem;
  }
}

/* ============================================
   响应式 - 手机 (≤768px)
   ============================================ */
@media (max-width: 768px) {
  /* 显示移动端头部 */
  .mobile-header {
    display: flex;
  }
  
  /* 隐藏桌面侧边栏 */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    width: 280px;
    z-index: 300;
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  /* 遮罩层 */
  .sidebar-overlay {
    display: block;
  }
  
  /* 主内容调整 */
  .main-content {
    margin-left: 0;
    margin-top: 60px;
    padding: 1.2rem 1rem;
    min-height: calc(100vh - 60px);
  }
  
  /* 统计卡片 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .stat-card {
    padding: 1.1rem;
    min-height: 100px;
  }
  
  .stat-num {
    font-size: 1.4rem;
  }
  
  /* 网格 */
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* 顶部栏 */
  .top-bar {
    margin-bottom: 1.5rem;
  }
  
  .top-bar h1 {
    font-size: 1.4rem;
  }
  
  /* 卡片 */
  .card {
    padding: 1.2rem;
    margin-bottom: 1rem;
  }
  
  /* 价格卡片 */
  .price-card {
    padding: 1.5rem;
  }
  
  .price-card.hot {
    transform: none;
  }
  
  .price-card.hot:hover {
    transform: translateY(-4px);
  }
  
  .price-num {
    font-size: 2rem;
  }
  
  /* 表格 */
  .table-wrapper {
    margin: 0 -1rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
  
  table {
    min-width: 500px;
  }
  
  th, td {
    padding: 0.85rem 0.75rem;
    font-size: 0.82rem;
  }
  
  /* 快捷操作按钮 */
  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  
  .quick-btn {
    padding: 1rem 0.5rem;
  }
  
  .quick-btn .icon svg {
    width: 24px;
    height: 24px;
  }
  
  /* 内容行 */
  .content-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* 表单 */
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* 分页 */
  .pagination {
    padding: 1rem;
    gap: 0.4rem;
  }
  
  .page-btn {
    width: 34px;
    height: 34px;
  }
}

/* ============================================
   响应式 - 小手机 (≤480px)
   ============================================ */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  .main-content {
    padding: 1rem 0.85rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  
  .stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: auto;
    padding: 1rem;
  }
  
  .stat-card .stat-icon {
    width: 38px;
    height: 38px;
    margin-bottom: 0;
    flex-shrink: 0;
  }
  
  .stat-card .stat-content {
    flex: 1;
  }
  
  .stat-card h4 {
    margin-bottom: 0.2rem;
  }
  
  .stat-num {
    font-size: 1.3rem;
  }
  
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
  
  .user-info {
    width: 100%;
  }
  
  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }
  
  .quick-btn {
    padding: 0.8rem 0.4rem;
  }
  
  .quick-btn .icon svg {
    width: 20px;
    height: 20px;
  }
  
  .quick-btn .label {
    font-size: 0.7rem;
  }
  
  .log-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .log-result {
    width: 100%;
    justify-content: space-between;
  }
  
  .filter-bar {
    flex-direction: column;
    gap: 0.8rem;
  }
  
  .filter-bar select,
  .filter-bar input {
    width: 100%;
  }
  
  .date-range {
    width: 100%;
    flex-wrap: wrap;
  }
  
  /* 充值页 */
  .recharge-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .money-select {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .recharge-sidebar {
    order: -1;
  }
  
  /* 文档页 */
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .docs-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
  }
  
  .docs-nav-title {
    display: none;
  }
  
  .docs-nav-item {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    background: var(--bg-card);
    border-radius: 20px;
    margin: 0;
  }
  
  /* 设置页 */
  .profile-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .profile-sidebar {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }
  
  .avatar-upload {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    margin: 0;
    flex-shrink: 0;
  }
  
  /* 支付方式 */
  .pay-methods {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }
  
  .pay-method {
    padding: 0.9rem;
    margin: 0;
  }
  
  /* 节点状态 */
  .node-item {
    padding: 0.75rem 0;
  }
}

/* ============================================
   触摸优化
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* 触摸设备 */
  .btn {
    min-height: 48px;
  }
  
  .sidebar-menu a {
    min-height: 52px;
  }
  
  a, button, .clickable {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 移除hover效果 */
  .btn:hover {
    transform: none;
  }
  
  /* 激活态 */
  .btn:active, .sidebar-menu a:active {
    opacity: 0.8;
  }
}

/* ============================================
   横屏手机
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-header {
    height: 50px;
  }
  
  .main-content {
    margin-top: 50px;
    padding: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   iOS 安全区域
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-header {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .main-content {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ============================================
   首页特殊响应式
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    display: none;
  }
  
  .hero {
    padding: 8rem 1.5rem 3rem !important;
  }
  
  .hero-title {
    font-size: 1.8rem !important;
    line-height: 1.3;
  }
  
  .hero-desc {
    font-size: 0.95rem !important;
    line-height: 1.6;
  }
  
  .data-box {
    gap: 1.5rem;
  }
  
  .data-num {
    font-size: 1.6rem;
  }
  
  .hero-btns {
    flex-direction: column;
    width: 100%;
    gap: 0.8rem;
  }
  
  .hero-btns .btn {
    width: 100%;
  }
  
  .status-bar {
    padding: 0.9rem 1rem;
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
  }
  
  .status-list {
    gap: 1.2rem;
  }
  
  .section {
    padding: 3rem 1.5rem !important;
  }
  
  .section-head h2 {
    font-size: 1.5rem;
  }
  
  .section-head p {
    font-size: 0.9rem;
  }
  
  .advantage-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .model-wrap {
    gap: 0.6rem;
  }
  
  .model-tag {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
  }
  
  .price-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  
  .price-card.hot {
    transform: none;
  }
  
  .code-box {
    padding: 1.2rem;
  }
  
  pre {
    font-size: 0.78rem;
    line-height: 1.6;
  }
  
  footer {
    padding: 2.5rem 1.5rem 1.5rem;
  }
  
  .footer-inner {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .footer-col {
    width: 100%;
  }
  
  .footer-col h4 {
    margin-bottom: 0.8rem;
  }
  
  .footer-col a {
    display: inline-block;
    margin-right: 1rem;
    margin-bottom: 0.4rem;
  }
  
  .copyright {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
}