/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: #333; background: #f0f2f5; }

/* ===== 登录页 ===== */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-card h1 { text-align: center; margin-bottom: 30px; font-size: 24px; color: #333; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; }
.form-group input { width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; transition: border-color 0.3s; outline: none; }
.form-group input:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.2); }
/* 勾选框/单选框：上面的 input{width:100%} 会把它们撑满一行，这里覆盖回行内尺寸 */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  margin: 0 6px 0 0;
  vertical-align: -2px;
  cursor: pointer;
  flex: none;
}
.form-group input[type="checkbox"]:focus,
.form-group input[type="radio"]:focus { border: none; box-shadow: none; }
.form-group label.inline-check { display: flex; align-items: center; font-weight: 400; cursor: pointer; user-select: none; margin-bottom: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; transition: all 0.3s; text-decoration: none; }
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a6fd6; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #e04345; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #49b018; }
.btn-warning { background: #faad14; color: #fff; }
.btn-warning:hover { background: #e8a012; }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-default:hover { border-color: #667eea; color: #667eea; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 布局 ===== */
.app-layout { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #001529; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo h2 { font-size: 18px; color: #fff; }
.sidebar-menu { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar-menu .menu-item { display: block; padding: 12px 24px; color: rgba(255,255,255,0.65); cursor: pointer; transition: all 0.3s; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.sidebar-menu .menu-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-menu .menu-item.active { color: #fff; background: #1890ff; border-left-color: #fff; }
.sidebar-menu .menu-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 16px; }
.sidebar-menu .menu-group-title { padding: 8px 24px 4px; font-size: 12px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; }
.sidebar-footer .user-info { margin-bottom: 8px; color: rgba(255,255,255,0.8); }
.sidebar-footer .user-info span { display: block; }
.sidebar-footer .user-role { font-size: 11px; color: rgba(255,255,255,0.5); }
.sidebar-footer .user-actions { display: flex; gap: 8px; }
.sidebar-footer .user-actions .btn { font-size: 12px; padding: 4px 10px; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page-header { padding: 16px 24px; background: #fff; border-bottom: 1px solid #e8e8e8; }
.page-header h3 { font-size: 18px; color: #333; }
.page-body { flex: 1; padding: 24px; overflow-y: auto; }

/* ===== 通用表格 ===== */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.data-table { width: 100%; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { background: #fafafa; padding: 12px 16px; text-align: left; font-weight: 600; font-size: 13px; color: #555; border-bottom: 1px solid #e8e8e8; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.data-table tr:hover td { background: #f5f7fa; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 40px; color: #999; }

/* ===== 弹窗 ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 8px; width: 520px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.15); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #e8e8e8; display: flex; justify-content: space-between; align-items: center; }
.modal-header h4 { font-size: 16px; }
.modal-close { cursor: pointer; font-size: 18px; color: #999; background: none; border: none; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #e8e8e8; display: flex; justify-content: flex-end; gap: 10px; }

/* ===== 表单 ===== */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }
.form-row .form-group.full { flex: 0 0 100%; }

.form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; resize: vertical; min-height: 80px; font-family: inherit; }
.form-group textarea:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.2); outline: none; }
.form-group select { width: 100%; padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; background: #fff; cursor: pointer; }
.form-group select:focus { border-color: #667eea; box-shadow: 0 0 0 2px rgba(102,126,234,0.2); outline: none; }

/* ===== 标签状态 ===== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.tag-pending { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }
.tag-live { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.tag-offline { background: #f5f5f5; color: #999; border: 1px solid #d9d9d9; }
.tag-active { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.tag-inactive { background: #fff2f0; color: #cf1322; border: 1px solid #ffa39e; }

/* ===== 商品规格表 ===== */
.spec-group { margin-bottom: 12px; }
.spec-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.spec-row input { flex: 1; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; }
.spec-row input:focus { border-color: #667eea; outline: none; }

/* ===== 图片预览 ===== */
.img-preview { max-width: 120px; max-height: 120px; border-radius: 4px; border: 1px solid #e8e8e8; display: block; margin-top: 6px; }

/* ===== 消息提示 ===== */
.message { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 24px; border-radius: 6px; z-index: 2000; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: msg-fadein 0.3s; }
.message-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.message-error { background: #fff2f0; color: #cf1322; border: 1px solid #ffa39e; }
.message-info { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }
@keyframes msg-fadein { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== 其他 ===== */
.text-link { color: #1890ff; cursor: pointer; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.text-muted { color: #999; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.align-center { align-items: center; }

/* ---- 表单填写说明（支付渠道等页面的字段提示）---- */
.form-group .form-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: #8c8c8c;
  font-weight: 400;
}
.form-group .form-hint b { color: #ff4d4f; font-weight: 600; }
.form-group .form-hint code {
  background: #f5f5f5; padding: 1px 5px; border-radius: 3px;
  font-size: 11px; color: #d4380d; font-family: ui-monospace, Consolas, monospace;
}

/* ============================================================
   ★ 2026-10-11 新增：品牌 logo + 移动端（手机浏览器）适配
   目标：手机上打开管理后台，侧边栏收起为抽屉、表格可横向滑动、
        按钮加大便于点按、弹窗近全屏，整体更简洁舒服。
   ============================================================ */

/* ---------- 品牌 logo ---------- */
.sidebar-logo { display: flex; align-items: center; gap: 10px; justify-content: center; }
.sidebar-logo img { width: 30px; height: 30px; border-radius: 7px; flex: none; }
.login-logo-wrap { text-align: center; margin-bottom: 14px; }
.login-logo { width: 84px; height: 84px; border-radius: 18px; }

/* ---------- 移动端顶部栏（桌面默认隐藏）---------- */
.mobile-topbar { display: none; }
.sidebar-mask { display: none; }

/* ============================================================
   手机 / 窄屏：<= 768px
   ============================================================ */
@media (max-width: 768px) {
  html, body { font-size: 15px; }

  /* ---- 布局骨架 ---- */
  .app-layout { display: block; height: auto; min-height: 100vh; }
  .main-content { display: block; overflow: visible; }

  /* ---- 顶部栏 ---- */
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 900;
    height: 56px; padding: 0 14px;
    background: #fff; border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  }
  .mobile-topbar .mt-title {
    font-size: 16px; font-weight: 600; color: #333;
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .hamburger {
    width: 40px; height: 40px; flex: none;
    border: none; background: #f5f7fa; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
  }
  .hamburger span, .hamburger span::before, .hamburger span::after {
    content: ''; display: block; width: 20px; height: 2px;
    background: #333; border-radius: 2px; position: relative;
    transition: transform .25s ease;
  }
  .hamburger span::before { position: absolute; top: -6px; }
  .hamburger span::after  { position: absolute; top: 6px; }
  .mobile-topbar .mt-logo { width: 28px; height: 28px; border-radius: 7px; flex: none; }

  /* ---- 侧边栏 → 抽屉 ---- */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: 260px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 30px rgba(0,0,0,.3);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-menu { flex: none; overflow-y: visible; padding-bottom: 20px; }
  .sidebar-menu .menu-item { padding: 15px 24px; font-size: 15px; }
  .sidebar-footer { padding: 16px 20px 24px; }

  /* ---- 抽屉遮罩 ---- */
  .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,.45); opacity: 0; visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
  }
  .sidebar-mask.show { opacity: 1; visibility: visible; }

  /* ---- 页面容器 ---- */
  .page-header { display: none; }          /* 标题已在顶部栏显示 */
  .page-body { padding: 12px; flex: none; overflow: visible; }

  /* ---- 工具栏：按钮排布更宽松 ---- */
  .table-toolbar { gap: 10px; margin-bottom: 12px; }
  .table-toolbar .btn { flex: none; }

  /* ---- 表格：外层可横向滑动，单元格不换行 ---- */
  .data-table { border-radius: 10px; overflow-x: auto; overflow-y: hidden;
                -webkit-overflow-scrolling: touch; }
  .data-table::-webkit-scrollbar { height: 6px; }
  .data-table::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 3px; }
  .data-table table { min-width: 560px; }   /* 保证列不挤压，超出则横滑 */
  .data-table th, .data-table td { padding: 12px 12px; font-size: 13.5px; }
  .data-table th { font-size: 12.5px; }
  /* 用一个横向滚动包裹层（由 JS 在渲染后自动加上） */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll::-webkit-scrollbar { height: 6px; }
  .table-scroll::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 3px; }

  /* 操作列的按钮：加大点按区域 */
  .data-table .actions { gap: 8px; }
  .data-table .actions .btn-sm { padding: 8px 14px; font-size: 13px; }

  /* ---- 表单：单列 ---- */
  .form-row { display: block; margin-bottom: 0; }
  .form-row .form-group { min-width: 0; margin-bottom: 14px; }
  .form-group input, .form-group select, .form-group textarea {
    padding: 12px 14px; font-size: 16px;   /* 16px 可避免 iOS 自动放大 */
  }
  .btn { padding: 12px 18px; font-size: 15px; }
  .btn-sm { padding: 8px 14px; font-size: 13.5px; }

  /* ---- 弹窗：近全屏 ---- */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%;
    max-height: 92vh; border-radius: 16px 16px 0 0;
    animation: sheet-up .25s ease;
  }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1; }

  /* ---- 消息提示 ---- */
  .message { top: auto; bottom: 28px; left: 16px; right: 16px; transform: none;
             text-align: center; padding: 13px 18px; font-size: 14.5px; }
  @keyframes msg-fadein { from { opacity: 0; transform: translateY(16px); }
                          to   { opacity: 1; transform: translateY(0); } }

  /* ---- 登录页 ---- */
  .login-page { align-items: flex-start; padding: 36px 16px 40px; min-height: 100vh; }
  .login-card { width: 100%; max-width: 420px; padding: 28px 22px; border-radius: 16px; }
  .login-card h1 { font-size: 20px; margin-bottom: 22px; }
  .login-logo { width: 72px; height: 72px; border-radius: 16px; }
  .login-card .btn-block { padding: 14px; font-size: 16px; }

  /* ---- 图片预览 ---- */
  .img-preview { max-width: 100%; }

  /* ---- 取消 hover 高亮残留（触摸端）---- */
  .data-table tr:hover td { background: transparent; }
}

/* ============================================================
   超小屏（<= 400px）
   ============================================================ */
@media (max-width: 400px) {
  .page-body { padding: 10px; }
  .data-table th, .data-table td { padding: 10px 10px; font-size: 13px; }
  .mobile-topbar { padding: 0 10px; }
  .modal-body { padding: 14px; }
}

/* ============================================================
   打印
   ============================================================ */
@media print {
  .sidebar, .mobile-topbar, .sidebar-mask { display: none !important; }
  .app-layout { display: block; height: auto; }
  .page-body { overflow: visible; padding: 0; }
}
