/* ============================================
   style.css — 服装库系统全局样式
   移动端优先（扫码页），管理后台兼容桌面
   ============================================ */

/* ---- CSS 变量 ---- */
:root {
  --primary: #6c5ce7;
  --primary-light: #a29bfe;
  --success: #00b894;
  --danger: #d63031;
  --warning: #fdcb6e;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #2d3436;
  --text-muted: #636e72;
  --border: #dfe6e9;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

/* ---- 基础重置 ---- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a {
  color: var(--primary);
  text-decoration: none;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  min-height: 44px;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  min-height: 32px;
}
.btn-lg {
  padding: 14px 24px;
  font-size: 17px;
  font-weight: 700;
  min-height: 52px;
}
.btn-block {
  width: 100%;
}

/* ---- 输入框 ---- */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.input:focus {
  border-color: var(--primary);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 15px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
}
.toast-show {
  opacity: 1;
}

/* ---- 弹窗 ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}
.modal-sheet {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  padding: 20px 20px 30px;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-size: 18px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}
.modal-body {
  margin-bottom: 16px;
}
.modal-footer {
  margin-top: 12px;
}
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   单品页（扫码页）
   ======================================== */

.item-page {
  background: #fff;
  max-width: 500px;
  margin: 0 auto;
}

/* 顶部栏 */
.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.item-id-badge {
  background: var(--primary-light);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}
.item-status-badge {
  font-size: 14px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.status-in {
  background: #d4fceb;
  color: #007a5e;
}
.status-out {
  background: #ffe0e0;
  color: #b00020;
}
.status-wash {
  background: #fff3cd;
  color: #856404;
}
.status-broken {
  background: #e9ecef;
  color: #495057;
}

/* 搭配图 */
.item-gallery {
  background: #f5f5f5;
  position: relative;
}
.gallery-main {
  width: 100%;
  aspect-ratio: 3/4;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f5f5f5;
}
.gallery-empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}
.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: background 0.2s;
}
.dot.active {
  background: var(--primary);
}

/* 衣服信息 */
.item-info {
  padding: 20px 16px;
}
.item-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}
.item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.meta-tag {
  background: #f0f0f0;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.meta-price {
  color: var(--danger);
  font-weight: 700;
}
.item-styling {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 12px;
  background: #fdf6e3;
  border-radius: var(--radius);
}

/* 操作区 */
.item-actions {
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.borrower-notice {
  text-align: center;
  padding: 16px;
  background: #f0f0f0;
  border-radius: var(--radius);
  font-size: 15px;
}

/* ========================================
   管理后台
   ======================================== */

.view {
  min-height: 100vh;
}

/* 登录页 */
.login-container {
  max-width: 380px;
  margin: 80px auto 0;
  padding: 24px;
  text-align: center;
}
.login-title {
  font-size: 28px;
  margin-bottom: 8px;
}
.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 8px;
}

/* 管理头部 */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-header h1 {
  font-size: 20px;
}

/* 统计卡片 */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num {
  font-size: 28px;
  font-weight: 800;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-total .stat-num {
  color: var(--text);
}
.stat-in .stat-num {
  color: var(--success);
}
.stat-out .stat-num {
  color: var(--primary);
}
.stat-wash .stat-num {
  color: var(--warning);
}

/* 工具栏 */
.admin-toolbar {
  padding: 0 16px 12px;
}
.filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.filter-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  white-space: nowrap;
}
.filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 列表 */
.admin-list {
  padding: 0 16px 32px;
}
.loading,
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* 衣服卡片 */
.item-card {
  display: flex;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--success);
}
.item-card.card-out {
  border-left-color: var(--primary);
}
.item-card.card-dirty {
  border-left-color: var(--warning);
}
.item-card-left {
  width: 72px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
}
.item-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item-card-noimg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #ccc;
}
.item-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.item-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.item-card-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- 响应式 ---- */
@media (max-width: 500px) {
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .item-card-left {
    width: 60px;
    height: 80px;
  }
}
