/* ============================================
   T恤定制管理后台 - 全局样式
   ============================================ */

:root {
  --pri: #FF3A44;
  --pri-dark: #E7000B;
  --pri-light: #FFF0F0;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --text: #1E2939;
  --text2: #4A5565;
  --text3: #6A7282;
  --text4: #99A1AF;
  --border: #E5E7EB;
  --input-bg: #F3F4F6;
  --green: #10B981;
  --orange: #F59E0B;
  --blue: #3B82F6;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.04);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { text-decoration:none; color: var(--pri); }
a:hover { color: var(--pri-dark); }
img { max-width:100%; vertical-align:middle; }

/* ===== 布局 ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #1E2939 0%, #2D3B4F 100%);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: var(--pri);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.sidebar-logo-text { font-size: 17px; font-weight: 700; }

.sidebar-nav { padding: 12px 0; }

.nav-group-title {
  padding: 16px 20px 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  margin: 2px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }

.nav-icon { font-size: 18px; width: 22px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--pri);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* 主内容区 */
.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
}

/* 顶部栏 */
.topbar {
  background: #fff;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.breadcrumb { font-size: 13px; color: var(--text4); }
.breadcrumb span { color: var(--text2); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-info { font-size: 13px; color: var(--text3); }
.topbar-info strong { color: var(--text); }

.topbar-dropdown {
  position: relative;
  cursor: pointer;
}

.topbar-avatar {
  width: 36px; height: 36px;
  background: var(--pri);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.topbar-dropdown-menu {
  position: absolute;
  top: 44px;
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  min-width: 160px;
  padding: 8px 0;
  display: none;
}

.topbar-dropdown:hover .topbar-dropdown-menu { display: block; }

.dropdown-item {
  display: block;
  padding: 10px 20px;
  color: var(--text2);
  font-size: 13px;
}

.dropdown-item:hover { background: var(--input-bg); color: var(--text); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 6px 0; }

/* 内容区 */
.content-wrap {
  padding: 28px;
}

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title { font-size: 17px; font-weight: 700; }

/* ===== 统计卡片组 ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.stat-icon.red { background: #FFF0F0; }
.stat-icon.blue { background: #F0F4FF; }
.stat-icon.green { background: #F0FFF4; }
.stat-icon.orange { background: #FFF8F0; }

.stat-body { flex:1; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--text4);
  margin-top: 4px;
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
}

.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--pri); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  background: var(--input-bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table tbody tr:hover { background: #FAFBFC; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}

.form-label .required { color: var(--pri); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(255,58,68,0.08);
}

.form-textarea { min-height: 100px; resize: vertical; }

.form-hint { font-size: 12px; color: var(--text4); margin-top: 4px; }

.form-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-inline .form-input,
.form-inline .form-select { width: auto; flex: 1; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-pri {
  background: var(--pri);
  color: #fff;
}

.btn-pri:hover { background: var(--pri-dark); }

.btn-outline {
  background: #fff;
  color: var(--pri);
  border: 1px solid var(--pri);
}

.btn-outline:hover { background: var(--pri-light); }

.btn-ghost {
  background: var(--input-bg);
  color: var(--text2);
}

.btn-ghost:hover { background: var(--border); }

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-danger { background: #f44336; color: #fff; }
.btn-danger:hover { background: #d32f2f; }
.btn-success { background: var(--green); color: #fff; }

/* ===== 搜索栏 ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-bar .form-input,
.search-bar .form-select {
  width: 200px;
  padding: 8px 12px;
}

/* ===== 标签/徽章 ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-red { background: #FFF0F0; color: var(--pri); }
.badge-blue { background: #F0F4FF; color: var(--blue); }
.badge-green { background: #F0FFF4; color: var(--green); }
.badge-orange { background: #FFF8F0; color: var(--orange); }
.badge-gray { background: var(--input-bg); color: var(--text4); }
.badge-dark { background: #1E2939; color: #fff; }

/* 状态标签 */
.status-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-0 { background: #FFF8F0; color: var(--orange); }
.status-1 { background: #F0F4FF; color: var(--blue); }
.status-2 { background: #F0F4FF; color: var(--blue); }
.status-3 { background: #F0FFF4; color: var(--green); }
.status-4 { background: var(--input-bg); color: var(--text4); }
.status-5 { background: #FFF0F0; color: var(--pri); }
.status-6 { background: var(--input-bg); color: var(--text4); }

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-info {
  font-size: 13px;
  color: var(--text4);
  margin-right: 16px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--text2);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.page-btn:hover { border-color: var(--pri); color: var(--pri); }
.page-btn.active { background: var(--pri); color: #fff; border-color: var(--pri); }

/* ===== 弹窗/提示 ===== */
.alert {
  padding: 14px 20px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-info { background: #F0F4FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-success { background: #F0FFF4; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: #FFF8F0; color: #92400E; border: 1px solid #FDE68A; }
.alert-error { background: #FFF0F0; color: #991B1B; border: 1px solid #FECACA; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr; }
  .search-bar .form-input { width: 100%; }
}

/* ===== 登录页 ===== */
.login-page {
  background: linear-gradient(135deg, #1E2939 0%, #2D3B4F 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text4);
  margin-bottom: 32px;
}

.login-box .form-input {
  padding: 12px 16px;
  font-size: 15px;
  border-radius: 10px;
}

.login-box .btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border-radius: 10px;
  margin-top: 8px;
}

.login-error {
  background: #FFF0F0;
  color: #991B1B;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* ===== 图片上传区 ===== */
.upload-area {
  width: 120px; height: 120px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 32px;
  color: var(--text4);
  transition: all 0.2s;
  background: var(--input-bg);
  position: relative;
  overflow: hidden;
}

.upload-area:hover { border-color: var(--pri); color: var(--pri); }
.upload-area img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.upload-area input[type="file"] { display: none; }

/* ===== 颜色预览 ===== */
.color-dot {
  display: inline-block;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  vertical-align: middle;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text4);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* ===== 行内操作链接 ===== */
.action-links a,
.action-links button {
  display: inline-block;
  margin: 0 4px;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 5px;
  cursor: pointer;
  border: none;
}

.action-links .link-edit { color: var(--blue); background: #F0F4FF; }
.action-links .link-del { color: #f44336; background: #FFF0F0; }
.action-links .link-view { color: var(--text3); background: var(--input-bg); }

/* ===== 快捷键提示 ===== */
kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text4);
}

/* ===== 移动端菜单按钮 ===== */
.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  border: none;
  background: var(--input-bg);
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .card { padding: 16px; }
  .content-wrap { padding: 16px; }
  .topbar { padding: 0 16px; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
}

/* 打印影藏 */
@media print {
  .sidebar, .topbar, .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
}
