/* ==================== 基础重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
  background: #FFF5EB;
  color: #2D3436;
  min-height: 100vh;
}

/* ==================== 登录页 ==================== */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFB5A7 0%, #FFD6A5 30%, #FDFFB6 60%, #CAFFBF 100%);
  z-index: 1000;
}

.login-card {
  background: #FFFFFF;
  border: 4px solid #2D3436;
  border-radius: 24px;
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 8px 8px 0 rgba(45,52,54,0.15);
  text-align: center;
}

.login-icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  color: #2D3436;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 28px;
}

.login-input {
  width: 100%;
  padding: 14px 18px;
  border: 3px solid #2D3436;
  border-radius: 16px;
  font-size: 16px;
  margin-bottom: 14px;
  outline: none;
  background: #FFF8F0;
  transition: box-shadow 0.2s;
}

.login-input:focus {
  box-shadow: 4px 4px 0 rgba(45,52,54,0.12);
}

.login-error {
  color: #E74C3C;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  border: 3px solid #2D3436;
  border-radius: 16px;
  background: #FFB5A7;
  font-size: 18px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 4px 4px 0 #2D3436;
  transition: all 0.15s;
}

.login-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #2D3436;
}

.login-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #2D3436;
}

/* ==================== 主应用 ==================== */
.main-app {
  min-height: 100vh;
}

/* ==================== Navbar ==================== */
.navbar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #FFFFFF;
  border-bottom: 4px solid #2D3436;
  padding: 0 24px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 0 rgba(45,52,54,0.08);
}

.navbar-brand {
  font-size: 20px;
  font-weight: 800;
  margin-right: 8px;
  white-space: nowrap;
}

.navbar-nav {
  display: flex;
  gap: 8px;
  flex: 1;
}

.nav-btn {
  padding: 8px 16px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #FFF8F0;
  font-size: 14px;
  font-weight: 600;
  color: #2D3436;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-btn:hover {
  background: #FFD6A5;
  transform: translateY(-1px);
}

.nav-btn.active {
  background: #FFB5A7;
  box-shadow: 3px 3px 0 #2D3436;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-user {
  font-size: 13px;
  color: #666;
}

.logout-btn {
  background: #FFC8DD !important;
}

.logout-btn:hover {
  background: #FF9BB3 !important;
}

/* ==================== 角色标签 ==================== */
.role-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid #2D3436;
}

.role-badge.superadmin {
  background: #FFD6A5;
  color: #2D3436;
}

.role-badge.subadmin {
  background: #9BF6FF;
  color: #2D3436;
}

/* ==================== 页面 ==================== */
.page {
  display: none;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.page.active {
  display: block;
}

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

.page-header h2 {
  font-size: 24px;
  font-weight: 800;
}

/* ==================== 按钮 ==================== */
.btn-add {
  padding: 10px 20px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #CAFFBF;
  font-size: 14px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2D3436;
  transition: all 0.15s;
}

.btn-add:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #2D3436;
}

.btn-save {
  padding: 10px 24px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #A0E7A0;
  font-size: 14px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2D3436;
  transition: all 0.15s;
}

.btn-save:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #2D3436;
}

.btn-cancel {
  padding: 10px 24px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #E8E8E8;
  font-size: 14px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2D3436;
  transition: all 0.15s;
}

.btn-cancel:hover {
  background: #D5D5D5;
}

.btn-danger {
  padding: 10px 24px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #FF8A8A;
  font-size: 14px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2D3436;
  transition: all 0.15s;
}

.btn-danger:hover {
  background: #FF6B6B;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #2D3436;
}

.btn-export {
  padding: 10px 20px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #9BF6FF;
  font-size: 14px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2D3436;
  transition: all 0.15s;
}

.btn-export:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #2D3436;
}

.btn-import {
  display: inline-block;
  padding: 10px 20px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #FFD6A5;
  font-size: 14px;
  font-weight: 700;
  color: #2D3436;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2D3436;
  transition: all 0.15s;
}

.btn-import:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #2D3436;
}

.btn-edit, .btn-delete, .btn-ship {
  padding: 6px 12px;
  border: 2px solid #2D3436;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin: 2px;
  transition: all 0.15s;
}

.btn-edit {
  background: #FDFFB6;
  color: #2D3436;
}

.btn-edit:hover {
  background: #FFE873;
}

.btn-delete {
  background: #FFC8DD;
  color: #2D3436;
}

.btn-delete:hover {
  background: #FF9BB3;
}

.btn-ship {
  background: #9BF6FF;
  color: #2D3436;
}

.btn-ship:hover {
  background: #6DE3F0;
}

/* ==================== 表格 ==================== */
.table-wrap {
  overflow-x: auto;
  border: 4px solid #2D3436;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 4px 4px 0 rgba(45,52,54,0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #FFB5A7;
}

.data-table th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 700;
  border-bottom: 3px solid #2D3436;
  white-space: nowrap;
  color: #2D3436;
}

.data-table td {
  padding: 10px;
  border-bottom: 2px solid #E8E8E8;
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: #FFF8F0;
}

.data-table tbody tr:hover {
  background: #FFF0E0;
}

.data-table img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #2D3436;
}

.empty-row {
  text-align: center;
  color: #AAA;
  padding: 24px;
}

/* ==================== Modal ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45,52,54,0.4);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  background: #FFFFFF;
  border: 4px solid #2D3436;
  border-radius: 20px;
  box-shadow: 8px 8px 0 rgba(45,52,54,0.2);
  max-width: 800px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #FFD6A5;
  border-bottom: 3px solid #2D3436;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.close-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: #2D3436;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 3px solid #2D3436;
  background: #FFF8F0;
}

.confirm-card {
  max-width: 420px;
}

/* ==================== 表单 ==================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #2D3436;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 2px solid #2D3436;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #FFF8F0;
  transition: box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  box-shadow: 3px 3px 0 rgba(45,52,54,0.1);
}

.form-group input[readonly] {
  background: #E8E8E8;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.full-width {
  grid-column: 1 / -1;
}

.image-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.image-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #2D3436;
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border: 4px solid #2D3436;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: 4px 4px 0 rgba(45,52,54,0.08);
  transition: transform 0.15s;
}

.stat-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(45,52,54,0.12);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: #555;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: #2D3436;
}

/* ==================== 数据统计 ==================== */
.data-stats {
  margin-bottom: 24px;
}

.data-stats h3,
.admin-section h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}

/* ==================== 管理后台区域 ==================== */
.admin-section {
  background: #FFFFFF;
  border: 4px solid #2D3436;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 4px 4px 0 rgba(45,52,54,0.08);
}

/* ==================== 二级管理员管理 ==================== */
.sub-admin-section {
  background: #FFF8F0;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.form-input {
  padding: 10px 14px;
  border: 2px solid #2D3436;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #FFFFFF;
  min-width: 140px;
}

.form-input:focus {
  box-shadow: 3px 3px 0 rgba(45,52,54,0.1);
}

.data-mgmt-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border: 3px solid #2D3436;
  border-radius: 12px;
  background: #2D3436;
  color: #FFF;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
  box-shadow: 4px 4px 0 rgba(45,52,54,0.2);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #00B894;
  color: #FFF;
}

.toast.error {
  background: #E74C3C;
  color: #FFF;
}

.toast.warn {
  background: #FDA65A;
  color: #2D3436;
}

/* ==================== 状态标签 ==================== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid #2D3436;
}

.status-badge.pending {
  background: #FDFFB6;
}

.status-badge.shipped {
  background: #9BF6FF;
}

.status-badge.delivered {
  background: #CAFFBF;
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #FFF8F0;
}

::-webkit-scrollbar-thumb {
  background: #FFB5A7;
  border-radius: 5px;
  border: 2px solid #2D3436;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px;
  }

  .navbar-brand {
    font-size: 16px;
  }

  .navbar-nav {
    flex-wrap: wrap;
  }

  .nav-btn {
    font-size: 12px;
    padding: 6px 10px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .page {
    padding: 12px;
  }

  .login-card {
    padding: 32px 20px;
  }
}
