/* 旗袍DAO管理后台 - 共享样式 */
:root {
  --brand: #9E2A2B;
  --brand2: #D5BDAF;
  --bg: #F9F6F0;
  --card: rgba(213, 189, 175, 0.3);
  --line: #D5BDAF;
  --muted: #9E2A2B;
  --ok: #9E2A2B;
  --err: #9E2A2B;
  --text: #2D2A26;
  --white: #F9F6F0;
  --shadow: 0 8px 24px rgba(213, 189, 175, 0.4);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  line-height: 1.5;
}

/* 移动端布局 */
.wrap {
  max-width: 100%;
  margin: 0 auto;
  padding: 14px;
  min-height: 100vh;
}

/* 导航栏 */
.admin-nav {
  background: var(--brand);
  color: var(--white);
  padding: 12px 16px;
  margin: -14px -14px 14px -14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(158, 42, 43, 0.3);
}

.nav-brand {
  font-weight: 700;
  font-size: 16px;
}

.nav-links {
  display: none; /* 移动端隐藏，使用汉堡菜单 */
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hamburger {
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* 移动端侧边栏 */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: var(--white);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar.open {
  left: 0;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.sidebar-overlay.open {
  display: block;
}

.sidebar-header {
  padding: 16px;
  background: var(--brand);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
}

.sidebar-nav {
  padding: 16px 0;
}

.nav-item {
  display: block;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background: var(--card);
  border-left-color: var(--brand);
}

.nav-item i {
  margin-right: 8px;
  width: 20px;
  text-align: center;
}

/* 卡片样式 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 14px 0;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 12px;
}

/* 网格布局 */
.grid {
  display: grid;
  gap: 12px;
}

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

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
  align-items: center;
}

/* 表单元素 */
.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
  background: #FFFFFF !important; /* 纯白色背景，方便用户输入 */
  background-color: #FFFFFF !important;
  border: 1px solid var(--line);
  color: #2D2A26 !important; /* 深色文字 */
  padding: 0 12px;
  font-family: "Noto Serif SC", serif;
  transition: border-color 0.3s ease;
  -webkit-text-fill-color: #2D2A26 !important; /* 修复 Safari 自动填充文字颜色 */
}

/* 修复浏览器自动填充样式 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important;
  -webkit-text-fill-color: #2D2A26 !important;
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
  transition: background-color 5000s ease-in-out 0s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(158, 42, 43, 0.2);
  background: #FFFFFF !important;
  background-color: #FFFFFF !important;
}

textarea {
  height: auto;
  padding: 12px;
  resize: vertical;
}

/* 按钮样式 */
.btn {
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: "Noto Serif SC", serif;
}

.btn-primary {
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  color: var(--white);
  box-shadow: 0 3px 14px rgba(158, 42, 43, 0.6);
}

.btn-primary:hover {
  background: linear-gradient(90deg, #7a1b1c, #bba997);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-secondary:hover {
  background: var(--brand2);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-ghost:hover {
  background: var(--brand2);
  color: var(--text);
}

.btn-sm {
  height: 36px;
  font-size: 12px;
  padding: 0 12px;
}

.btn-xs {
  height: 32px;
  font-size: 11px;
  padding: 0 8px;
}

.btn-block {
  width: 100%;
}

/* 状态标签 */
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--white);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--brand);
}

.pill-ok {
  background: var(--brand2);
  color: var(--brand);
  border-color: var(--brand);
}

.pill-warning {
  background: #fff3cd;
  color: #856404;
  border-color: #ffeaa7;
}

.pill-error {
  background: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

/* 列表样式 */
.list {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.list-item {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--card);
}

/* 统计卡片 */
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* 工具提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--white);
  color: var(--brand);
  padding: 10px 14px;
  border-radius: 10px;
  opacity: 0.98;
  border: 1px solid var(--brand);
  box-shadow: 0 0 10px rgba(158, 42, 43, 0.4);
  z-index: 1001;
  font-weight: 600;
}

/* 加载状态 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-radius: 50%;
  border-top-color: var(--brand);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (min-width: 768px) {
  .wrap {
    max-width: 768px;
  }
  
  .nav-links {
    display: flex;
    gap: 16px;
  }
  
  .hamburger {
    display: none;
  }
  
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    box-shadow: none;
    background: transparent;
  }
  
  .sidebar-overlay {
    display: none !important;
  }
}

/* 工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.hidden { display: none; }
.visible { display: block; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-content {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
  margin: 0;
}

.modal-body {
  padding: 0;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* 警告提示样式 */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* 按钮禁用状态 */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 轮廓按钮样式 */
.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-outline:hover:not(:disabled) {
  background: var(--brand);
  color: var(--white);
}
