/* ============ 管理后台样式 - 仿qyszyyy配色 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", Arial, sans-serif; background: #f6f9f9; color: #666; }
a { cursor: pointer; text-decoration: none; }
#ie-warning { display: none; background: #fff3cd; color: #856404; text-align: center; padding: 12px; font-size: 14px; border-bottom: 2px solid #ffc107; }
#ie-warning a { color: #378e9f; font-weight: bold; }

/* ===== 登录页 ===== */
.login-page { min-height: 100vh; background: #378e9f; display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 4px; padding: 44px; width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon { font-size: 52px; margin-bottom: 10px; }
.login-logo h2 { color: #378e9f; font-size: 20px; margin-bottom: 6px; font-family: "SimSun","宋体",serif; letter-spacing: 2px; }
.login-logo p { color: #888; font-size: 13px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: #444; margin-bottom: 6px; font-weight: bold; }
.form-control { width: 100%; padding: 11px 16px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; outline: none; transition: border .2s; }
.form-control:focus { border-color: #378e9f; }
.form-group input { width: 100%; padding: 11px 16px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; outline: none; }
.form-group input:focus { border-color: #378e9f; }
.alert-error { background: #fff2f0; border: 1px solid #ffccc7; color: #b71c1c; padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 18px; }

/* ===== 管理布局 ===== */
#adminApp { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar { width: 220px; background: #20626f; flex-shrink: 0; display: flex; flex-direction: column; transition: width .3s; overflow: hidden; }
.sidebar.collapsed { width: 56px; }
.sidebar-header { padding: 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo { font-size: 22px; flex-shrink: 0; }
.sidebar-title { color: #fff; font-size: 15px; font-weight: bold; white-space: nowrap; }
.sidebar-nav { padding: 8px 0; overflow-y: auto; flex: 1; }
.nav-section-title { color: rgba(255,255,255,.4); font-size: 11px; padding: 14px 16px 4px; text-transform: uppercase; white-space: nowrap; overflow: hidden; letter-spacing: 1px; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: rgba(255,255,255,.6); font-size: 14px; transition: all .2s; white-space: nowrap; }
.sidebar-link:hover, .sidebar-link.active { background: rgba(55,142,159,.5); color: #fff; }
.si { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

/* 主内容 */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; padding: 0 22px; height: 56px; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #378e9f; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: #555; }
#pageTitle { font-size: 16px; font-weight: bold; color: #378e9f; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #555; }
.module-content { flex: 1; padding: 22px; overflow-y: auto; }

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 4px; padding: 22px; border: 1px solid #e8eaea; margin-bottom: 22px; }
.card-title { font-size: 16px; font-weight: bold; color: #378e9f; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e8eaea; display: flex; align-items: center; justify-content: space-between; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: 4px; padding: 22px; display: flex; align-items: center; gap: 16px; border: 1px solid #e8eaea; }
.stat-icon { font-size: 38px; }
.stat-label { font-size: 13px; color: #888; }
.stat-value { font-size: 28px; font-weight: bold; color: #378e9f; }

/* ===== 按钮 ===== */
.btn-primary { background: #378e9f; color: #fff; border: none; padding: 9px 22px; border-radius: 4px; cursor: pointer; font-size: 14px; transition:.2s; font-weight: 600; letter-spacing: 1px; }
.btn-primary:hover { background: #20626f; }
.btn-secondary { background: #edf5f6; color: #20626f; border: 1px solid #8cb8c0; padding: 9px 22px; border-radius: 4px; cursor: pointer; font-size: 14px; transition:.2s; }
.btn-secondary:hover { background: #378e9f; color: #fff; border-color: #378e9f; }
.btn-danger { background: #b71c1c; color: #fff; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-danger:hover { background: #8e0000; }
.btn-default { background: #fff; color: #333; border: 1px solid #ccc; padding: 9px 22px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 4px; cursor: pointer; border: 1px solid #378e9f; color: #378e9f; background: #fff; }
.btn-outline { border: 1px solid #378e9f; color: #378e9f; padding: 5px 14px; border-radius: 4px; font-size: 12px; background: #fff; }
.btn-outline:hover { background: #378e9f; color: #fff; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-warning { background: #e65100; color: #fff; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; }

/* ===== 工具栏 ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.toolbar-left { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-input { border: 1px solid #ccc; border-radius: 4px; padding: 7px 14px; font-size: 13px; outline: none; width: 200px; }
.search-input:focus { border-color: #378e9f; }
.filter-select { border: 1px solid #ccc; border-radius: 4px; padding: 7px 10px; font-size: 13px; background: #fff; }

/* ===== 表格 ===== */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.admin-table th { background: #f6f9f9; font-weight: bold; padding: 10px 12px; border-bottom: 2px solid #378e9f; text-align: left; color: #378e9f; white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid #e8e8e8; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.admin-table tr:hover td { background: #f6f9f9; }
.admin-table img { width: 60px; height: 40px; object-fit: cover; border-radius: 2px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 11px; }
.badge-success { background: #edf5f6; color: #378e9f; border: 1px solid #8cb8c0; }
.badge-error { background: #fff2f0; color: #b71c1c; border: 1px solid #ffccc7; }
.badge-blue { background: #e6f7ff; color: #1565c0; border: 1px solid #91d5ff; }
.op-btns { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.action-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ===== 轮播图卡片网格 ===== */
.banner-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.banner-card { background: #fff; border: 1px solid #e1e1e1; border-radius: 8px; overflow: hidden; transition: box-shadow .2s; }
.banner-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.banner-card-img { position: relative; height: 160px; background: #f0f0f0; }
.banner-card-img img { width: 100%; height: 100%; object-fit: cover; }
.banner-card-order { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.55); color: #fff; padding: 2px 10px; border-radius: 3px; font-size: 11px; }
.banner-card-status { position: absolute; top: 8px; right: 8px; padding: 2px 10px; border-radius: 3px; font-size: 11px; }
.banner-card-body { padding: 12px 14px; }
.banner-card-title { font-size: 14px; font-weight: 600; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 10px; }
.banner-card-actions { display: flex; gap: 8px; }

/* ===== 分类管理区 ===== */
.cat-mgmt-section { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #e1e1e1; }
.cat-mgmt-header { font-size: 14px; font-weight: bold; color: #378e9f; margin-bottom: 10px; }
.cat-mgmt-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cat-mgmt-item { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: #f6f9f9; border: 1px solid #e1e1e1; border-radius: 4px; font-size: 13px; }
.cat-mgmt-item .cat-name { color: #333; }
.cat-mgmt-item .cat-sort { color: #888; font-size: 11px; }
.cat-mgmt-item .cat-active { color: #378e9f; font-size: 10px; }
.cat-mgmt-item .cat-inactive { color: #999; font-size: 10px; }
.cat-mgmt-item button { background: none; border: none; cursor: pointer; font-size: 12px; padding: 2px 4px; }
.cat-mgmt-item .cat-edit { color: #378e9f; }
.cat-mgmt-item .cat-del { color: #b71c1c; }
.cat-mgmt-add { display: flex; gap: 8px; align-items: center; }
.cat-mgmt-add input { padding: 5px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; width: 150px; }
.cat-mgmt-add input:focus { border-color: #378e9f; outline: none; }
.cat-mgmt-add .btn-sm { font-size: 11px; }

/* ===== 表单 ===== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-item { margin-bottom: 16px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 13px; color: #444; margin-bottom: 6px; font-weight: bold; }
.form-item label .req { color: #b71c1c; margin-left: 2px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; padding: 9px 14px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; outline: none; font-family: inherit; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: #378e9f; }
.form-item textarea { min-height: 100px; resize: vertical; }
.form-item .hint { font-size: 11px; color: #888; margin-top: 4px; }
.form-item .img-preview { margin-top: 8px; max-width: 200px; max-height: 120px; border: 1px solid #e8eaea; border-radius: 2px; }

/* ===== 图片上传组 ===== */
.upload-group { margin-top: 4px; }
.upload-group .btn-secondary { padding: 6px 16px; font-size: 13px; }
.upload-group .btn-danger.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== 分页 ===== */
.admin-pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; justify-content: flex-end; }
.ap-btn { padding: 5px 11px; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 13px; }
.ap-btn.active { background: #378e9f; color: #fff; border-color: #378e9f; }
.ap-btn:disabled { color: #ccc; cursor: not-allowed; }
.ap-info { font-size: 12px; color: #888; }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.modal-box { background: #fff; border-radius: 4px; width: 600px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,.15); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #e8eaea; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; color: #378e9f; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #888; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #e8eaea; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Toast ===== */
.toast { position: fixed; top: 70px; right: 20px; z-index: 10000; padding: 10px 20px; border-radius: 4px; font-size: 14px; min-width: 200px; text-align: center; animation: fadeIn .3s; }
.toast.success { background: #edf5f6; color: #378e9f; border: 1px solid #8cb8c0; }
.toast.error { background: #fff2f0; color: #b71c1c; border: 1px solid #ffccc7; }
.toast.info { background: #e6f7ff; color: #1565c0; border: 1px solid #91d5ff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* 批量导入区域 */
.import-area { border: 2px dashed #ccc; border-radius: 4px; padding: 22px; margin-bottom: 16px; text-align: center; }
.import-area:hover { border-color: #378e9f; }
.import-hint { color: #888; font-size: 13px; margin-top: 8px; }
.import-preview { max-height: 300px; overflow-y: auto; margin-top: 12px; }

/* 富文本编辑器区域 */
.rich-editor-toolbar { border: 1px solid #ccc; border-bottom: none; border-radius: 4px 4px 0 0; padding: 6px 10px; background: #f6f9f9; display: flex; flex-wrap: wrap; gap: 4px; }
.rich-editor-toolbar button { padding: 3px 8px; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; font-size: 13px; }
.rich-editor-toolbar button:hover { background: #378e9f; color: #fff; border-color: #378e9f; }
.rich-editor { border: 1px solid #ccc; border-radius: 0 0 4px 4px; min-height: 200px; padding: 10px; outline: none; font-size: 14px; line-height: 1.8; }

/* 响应式 - 手机 */
@media (max-width: 768px) {
  body{overflow-x:hidden}
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 999; transition: left .3s; width: 260px; }
  .sidebar.open { left: 0; }
  .sidebar.collapsed { width: 260px; }
  .sidebar.collapsed .sidebar-title,
  .sidebar.collapsed .nav-section-title { display: block; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 998; }
  .sidebar-overlay.show { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .module-content { padding: 14px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-left { flex-direction: column; }
  .search-input { width: 100%; }
  .filter-select { width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { font-size: 28px; }
  .stat-value { font-size: 22px; }
  .admin-table { font-size: 12px; }
  .admin-table th { padding: 8px 6px; }
  .admin-table td { padding: 8px 6px; }
  .table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll-wrap .admin-table { min-width: 600px; }
  .banner-card-grid { grid-template-columns: 1fr; }
  .modal-box { width: 100% !important; max-width: 100% !important; border-radius: 8px 8px 0 0; max-height: 90vh; }
  .modal-overlay { align-items: flex-end; }
  .modal-body { padding: 14px; }
  .modal-footer { padding: 10px 14px; }
  .topbar { padding: 0 12px; height: 50px; }
  .topbar-right { gap: 8px; font-size: 12px; }
  .topbar-right .btn-sm { display: none; }
  #pageTitle { font-size: 14px; }
  .card { padding: 14px; }
  .login-box { padding: 28px 20px; width: 100%; max-width: 360px; margin: 0 12px; }
  .toast { top: 50px; right: 10px; left: 10px; min-width: auto; }
  .op-btns { flex-direction: column; gap: 4px; }
  .cat-mgmt-list { flex-direction: column; }
  .cat-mgmt-add { flex-direction: column; align-items: stretch; }
  .cat-mgmt-add input { width: 100%; }
}

/* 响应式 - 小屏手机 */
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .stat-card { flex-direction: column; text-align: center; gap: 6px; }
  .login-box { padding: 24px 16px; }
  .login-logo h2 { font-size: 18px; }
  .btn-primary { padding: 10px 18px; font-size: 13px; }
  .btn-secondary { padding: 10px 18px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .admin-table { font-size: 11px; }
  .admin-table th { padding: 6px 4px; }
  .admin-table td { padding: 6px 4px; }
  .card { padding: 12px; }
  .module-content { padding: 10px; }
}

/* IE 10/11 兼容补丁 */
@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){
  #adminApp{display:block}
  .sidebar{float:left}
  .main-content{display:block;overflow:hidden}
  .topbar{display:block;height:auto;padding:10px 12px}
  .topbar-left{float:left}.topbar-right{float:right}
  .topbar::after{content:'';display:table;clear:both}
  .stats-row{display:block}
  .stats-row>*{display:inline-block;width:48%;margin:1%;vertical-align:top}
  .toolbar{display:block}
  .toolbar>*{display:block;margin-bottom:8px}
  .form-row{display:block}
  .form-row>*{display:block;width:100%;margin-bottom:10px}
  .modal-overlay{display:none}
  .modal-overlay.show{display:block}
}
