/**
 * 管理后台全局样式
 * 文件位置：admin-web/css/style.css
 * 说明：自媒体房源系统网页管理后台，纯原生CSS，零框架依赖
 */

/* ============ CSS变量（设计系统） ============ */
:root {
  --primary: #1677ff;
  --primary-light: #e6f4ff;
  --success: #52c41a;
  --success-light: #f6ffed;
  --warning: #faad14;
  --warning-light: #fffbe6;
  --danger: #ff4d4f;
  --danger-light: #fff2f0;
  --media-color: #1677ff;
  --media-light: #e6f4ff;
  --house-color: #ff7a45;
  --house-light: #fff2e8;

  --text: #1a1a1a;
  --text-secondary: #666;
  --text-hint: #999;
  --border: #f0f0f0;
  --bg: #f5f5f5;
  --bg-white: #fff;
  --sidebar-width: 220px;
  --header-height: 56px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ============ 全局重置 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
}
a { text-decoration: none; color: var(--primary); }
button { cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; outline: none;
  border: 1px solid #d9d9d9; border-radius: 6px; padding: 8px 12px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }

/* ============ 登录页 ============ */
.login-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #1677ff 0%, #4096ff 50%, #ff7a45 100%);
}
.login-box {
  width: 400px; background: #fff; border-radius: 16px; padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-title { font-size: 28px; font-weight: bold; text-align: center; margin-bottom: 8px; }
.login-subtitle { font-size: 14px; color: var(--text-hint); text-align: center; margin-bottom: 32px; }
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-secondary); }
.form-input { width: 100%; height: 44px; font-size: 14px; }
.btn-login { width: 100%; height: 44px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 500; margin-top: 8px; }
.btn-login:hover { opacity: 0.9; }
.login-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; }

/* ============ 主布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width); background: #001529; color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto;
}
.sidebar-logo { padding: 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: center; }
.sidebar-menu { padding: 8px 0; }
.menu-group { margin-bottom: 4px; }
.menu-group-title {
  padding: 12px 20px 8px; font-size: 12px; color: rgba(255,255,255,0.45);
  text-transform: uppercase;
}
.menu-item {
  display: flex; align-items: center; padding: 12px 20px;
  color: rgba(255,255,255,0.65); cursor: pointer; transition: all 0.2s;
  font-size: 14px;
}
.menu-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.menu-item.active { color: #fff; background: var(--primary); }
.menu-item-icon { margin-right: 10px; font-size: 16px; }

.main {
  margin-left: var(--sidebar-width); flex: 1;
  display: flex; flex-direction: column;
}
.header {
  height: var(--header-height); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.header-left { font-size: 16px; font-weight: 500; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user { color: var(--text-secondary); }
.btn-logout { padding: 6px 16px; border: 1px solid #d9d9d9; background: #fff; border-radius: 4px; color: var(--text-secondary); font-size: 13px; }
.btn-logout:hover { color: var(--danger); border-color: var(--danger); }
.content { padding: 24px; flex: 1; }

/* ============ 页面通用组件 ============ */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 20px; font-weight: bold; margin-bottom: 8px; }
.page-desc { font-size: 13px; color: var(--text-hint); }

/* 统计卡片 */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
}
.stat-card.media { border-left: 3px solid var(--media-color); }
.stat-card.house { border-left: 3px solid var(--house-color); }
.stat-card-value { font-size: 32px; font-weight: bold; margin-bottom: 4px; }
.stat-card-label { font-size: 13px; color: var(--text-hint); }

/* 面板容器 */
.panel {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px;
}
.panel-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-size: 16px; font-weight: 500; }
.panel-body { padding: 24px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 12px; border-bottom: 2px solid var(--border);
  font-weight: 500; color: var(--text-secondary); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: #fafafa; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 20px; border-radius: 6px; border: none; font-size: 14px; transition: opacity 0.2s; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-media { background: var(--media-color); color: #fff; }
.btn-house { background: var(--house-color); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* 标签 */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px;
}
.tag-new { background: var(--primary-light); color: var(--primary); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-media { background: var(--media-light); color: var(--media-color); }
.tag-house { background: var(--house-light); color: var(--house-color); }

/* 工具栏 */
.toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar input, .toolbar select { height: 36px; }

/* 分页 */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 0;
}
.pagination button {
  padding: 6px 14px; border: 1px solid #d9d9d9; background: #fff;
  border-radius: 4px; font-size: 13px;
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-info { font-size: 13px; color: var(--text-hint); }

/* 弹窗 */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; z-index: 1000;
}
.modal {
  background: #fff; border-radius: 12px; width: 520px; max-height: 80vh;
  overflow-y: auto; padding: 32px;
}
.modal-title { font-size: 18px; font-weight: bold; margin-bottom: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* 空状态 */
.empty { text-align: center; padding: 60px 0; color: var(--text-hint); font-size: 14px; }

/* Toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 6px; color: #fff; font-size: 14px;
  z-index: 2000; animation: toastIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; top: 0; } to { opacity: 1; top: 20px; } }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .menu-item span, .sidebar .menu-group-title, .sidebar-logo { display: none; }
  .sidebar .menu-item-icon { margin: 0; font-size: 20px; }
  .main { margin-left: 60px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
