/* ============================================================
   B2B 站全站样式（Static Asset，CDN + 浏览器长缓存）
   合并自原 layout.js 与 admin-dashboard.js 的内联 CSS，已去重。
   ============================================================ */

:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --accent-color: #f59e0b;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --border-color: #e5e7eb;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: #ffffff;
}

/* ---------- 导航 ---------- */
.navbar { background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 1000; }
.nav-container { max-width: 1200px; margin: 0 auto; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: bold; color: var(--primary-color); text-decoration: none; }
.nav-menu { display: flex; list-style: none; gap: 2rem; }
.nav-link { text-decoration: none; color: var(--text-dark); font-weight: 500; transition: color 0.3s; }
.nav-link:hover, .nav-link.active { color: var(--primary-color); }
.menu-toggle { display: none; flex-direction: column; cursor: pointer; }
.menu-toggle span { width: 25px; height: 3px; background: var(--text-dark); margin: 3px 0; transition: 0.3s; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.hero { background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: white; padding: 4rem 2rem; text-align: center; }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; max-width: 600px; margin: 0 auto; }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: 0.375rem; text-decoration: none; font-weight: 600; transition: all 0.3s; border: none; cursor: pointer; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--secondary-color); }
.btn-secondary { background: var(--accent-color); color: white; }
.btn-secondary:hover { background: #d97706; }
.btn-cancel { background: #6b7280; color: white; }
.btn-cancel:hover { background: #4b5563; }

/* ---------- 卡片 ---------- */
.card { background: white; border-radius: 0.5rem; box-shadow: 0 4px 6px rgba(0,0,0,0.1); overflow: hidden; transition: transform 0.3s; }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px rgba(0,0,0,0.15); }
.card-image { width: 100%; height: 200px; object-fit: cover; }
.card-content { padding: 1.5rem; }
.card-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.card-description { color: var(--text-light); margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 网格 ---------- */
.grid { display: grid; gap: 2rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-dark); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 0.75rem; border: 1px solid var(--border-color);
  border-radius: 0.375rem; font-size: 1rem; transition: border-color 0.3s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: var(--primary-color); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-checkbox { display: flex; align-items: center; gap: 0.5rem; }
.form-checkbox input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* ---------- 页脚 ---------- */
.footer { background: var(--text-dark); color: white; padding: 3rem 2rem 1rem; margin-top: 4rem; }
.footer-content { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; }
.footer-section h3 { margin-bottom: 1rem; color: var(--accent-color); }
.footer-section ul { list-style: none; }
.footer-section a { color: #9ca3af; text-decoration: none; transition: color 0.3s; }
.footer-section a:hover { color: white; }
.footer-bottom { text-align: center; padding-top: 2rem; margin-top: 2rem; border-top: 1px solid #374151; color: #9ca3af; }

/* ---------- 加载动画 & 通知 ---------- */
.spinner { border: 3px solid #f3f4f6; border-top: 3px solid var(--primary-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 2rem auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ============================================================
   后台管理（admin）专属
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 250px; background: var(--text-dark); color: white; padding: 2rem 0; position: fixed; height: 100vh; overflow-y: auto; }
.admin-content { flex: 1; margin-left: 250px; padding: 2rem; background: var(--bg-light); min-height: 100vh; }
.admin-header { background: white; padding: 1.5rem 2rem; margin: -2rem -2rem 2rem -2rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; justify-content: space-between; align-items: center; }
.sidebar-nav { list-style: none; }
.sidebar-nav a { display: flex; align-items: center; padding: 1rem 2rem; color: #9ca3af; text-decoration: none; transition: all 0.3s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: white; }

.stat-card { background: white; padding: 1.5rem; border-radius: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.stat-card h3 { color: var(--text-light); font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary-color); }

.table-container { background: white; border-radius: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: var(--bg-light); padding: 1rem; text-align: left; font-weight: 600; color: var(--text-dark); border-bottom: 2px solid var(--border-color); }
.table td { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.table tr:hover { background: var(--bg-light); }

.badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 1rem; font-size: 0.85rem; font-weight: 500; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }

.tab-nav { display: flex; gap: 0.5rem; margin-bottom: 2rem; border-bottom: 2px solid var(--border-color); }
.tab-btn { padding: 1rem 1.5rem; background: none; border: none; border-bottom: 3px solid transparent; color: var(--text-light); font-weight: 500; cursor: pointer; transition: all 0.3s; }
.tab-btn:hover { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* 模态框 */
.modal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); overflow-y: auto; }
.modal.active { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.modal-content { background: white; padding: 2rem; border-radius: 0.5rem; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.modal-header h2 { font-size: 1.5rem; color: var(--text-dark); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); width: 30px; height: 30px; }
.modal-close:hover { color: var(--text-dark); }
.modal-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }

/* 图片上传 */
.image-preview { margin-top: 1rem; display: flex; gap: 1rem; align-items: flex-start; }
.image-preview img { max-width: 200px; max-height: 200px; border-radius: 0.375rem; border: 1px solid var(--border-color); object-fit: cover; }
.upload-btn-wrapper { position: relative; overflow: hidden; display: inline-block; }
.upload-btn-wrapper input[type=file] { position: absolute; left: 0; top: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.btn-upload { background: var(--primary-color); color: white; padding: 0.5rem 1rem; border-radius: 0.375rem; border: none; cursor: pointer; font-weight: 500; }
.btn-upload:hover { background: var(--secondary-color); }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav-menu { position: fixed; left: -100%; top: 70px; flex-direction: column; background: white; width: 100%; text-align: center; transition: 0.3s; box-shadow: 0 10px 27px rgba(0,0,0,0.1); padding: 2rem 0; }
  .nav-menu.active { left: 0; }
  .menu-toggle { display: flex; }
  .hero h1 { font-size: 2rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .admin-content { margin-left: 0; }
}
