/* ========================================================
   熊吨吨 くまとんとん - 手作工坊管理后台样式
   温暖、干净、好用的工坊管理控制台
   ======================================================== */

:root {
  --admin-bg: #F5EFE6;
  --admin-sidebar-bg: #EAE2D5;
  --admin-card-bg: #FFFDF9;
  
  --primary: #77866B;
  --primary-hover: #66755A;
  --primary-light: #EEF2EB;
  
  --linen: #C8B89D;
  --terracotta: #C9927E;
  --wood: #9A765E;
  
  --text-main: #3F3731;
  --text-sub: #786E66;
  --text-muted: #A3988F;
  
  --border: #E2D8CC;
  --border-light: #ECE5DC;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 16px rgba(63, 55, 49, 0.05);
}

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

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  display: flex;
}

/* 侧边栏导航 */
.admin-sidebar {
  width: 250px;
  background-color: var(--admin-sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  padding: 24px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  padding: 8px 10px 24px 10px;
  border-bottom: 1px dashed var(--linen);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--linen);
  background: #fff;
}

.sidebar-brand-name {
  font-size: 1.15rem;
  font-weight: 600;
}

.sidebar-brand-tag {
  font-size: 0.72rem;
  color: var(--wood);
  font-weight: 400;
}

.sidebar-menu {
  list-style: none;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-sub);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-item a:hover {
  background: rgba(255, 253, 249, 0.6);
  color: var(--text-main);
}

.sidebar-item.active a {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(119, 134, 107, 0.25);
}

.sidebar-footer {
  border-top: 1px dashed var(--linen);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.btn-sidebar-action {
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--admin-card-bg);
  color: var(--text-sub);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-sidebar-action:hover {
  background: #fff;
  color: var(--text-main);
}

/* 主内容工作区 */
.admin-main {
  margin-left: 250px;
  flex-grow: 1;
  padding: 28px 36px 60px 36px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
}

.page-actions {
  display: flex;
  gap: 12px;
}

/* 按钮通用 */
.btn-craft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--admin-card-bg);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #fff;
  border-color: var(--linen);
}

.btn-danger {
  background: #FAF0EE;
  border-color: #F1D4CD;
  color: var(--terracotta);
}

.btn-danger:hover {
  background: #F7E4E0;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* 概览统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.stat-val {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.8;
}

/* 数据表格与卡片面板 */
.panel-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text-main);
}

.craft-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.craft-table th {
  background: #F7F2E8;
  padding: 12px 18px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.craft-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.craft-table tr:hover td {
  background-color: #FAF6EF;
}

.table-thumb {
  width: 52px;
  height: 65px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.published {
  background: var(--primary-light);
  color: var(--primary);
}

.status-badge.draft {
  background: #EFEAE2;
  color: var(--text-muted);
}

/* 弹窗表单 Modal */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(63, 55, 49, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.admin-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.admin-modal-dialog {
  background: var(--admin-card-bg);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(63, 55, 49, 0.15);
  display: flex;
  flex-direction: column;
}

.admin-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #FAF6EF;
}

/* 表单控件 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sub);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #FFFDF9;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* 图片上传预览区 */
.upload-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.preview-img {
  width: 80px;
  height: 100px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  background: #EAE2D5;
}

.upload-btn-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-file-input {
  display: none;
}

/* 登录页独立样式 */
.login-container {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: var(--admin-bg);
}

.login-card {
  max-width: 420px;
  width: 100%;
  background: var(--admin-card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 12px 36px rgba(63, 55, 49, 0.08);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--linen);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-hint {
  padding: 10px 14px;
  background: #FAF6EF;
  border: 1px dashed var(--linen);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--wood);
  line-height: 1.5;
}
