/* ============================================================
   国康堂中医馆 · 管理后台样式
   配色体系：深玉绿 + 暖金色（与小程序品牌统一）
   ============================================================ */

:root {
  --green-dark: #1B3A2D;
  --green-mid: #2D5A3D;
  --green-light: #3A6B4A;
  --gold: #C9A96E;
  --gold-light: #D4B87A;
  --gold-pale: #F5EFE0;
  --gold-bg: #FDFAF3;
  --bg-warm: #F5F5F0;
  --bg-card: #FFFFFF;
  --border-warm: #EBE5D9;
  --border-light: #F0EDE6;
  --text-primary: #2C2416;
  --text-secondary: #6B5E4A;
  --text-muted: #A89A82;
  --text-placeholder: #C4B9A6;
  --danger: #A94442;
  --danger-bg: #FFF2F0;
  --success: #4A8C5C;
  --success-bg: #F0F7F2;
  --warning: #C9A96E;
  --warning-bg: #FDF6EE;
  --info: #1B3A2D;
  --info-bg: #EDF2EE;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-warm);
  color: var(--text-primary);
  font-size: 14px;
}

/* ===== Login Page ===== */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1B3A2D 0%, #2D5A3D 40%, #1B3A2D 100%);
  position: relative;
  overflow: hidden;
}

/* 登录页背景纹理 */
body.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}

body.login-page::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-header .login-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #1B3A2D, #2D5A3D);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  color: #C9A96E;
}

.login-header h1 {
  font-size: 24px;
  color: var(--green-dark);
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 2px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 1px;
}

.login-form .form-group { margin-bottom: 20px; }

.login-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.login-form input {
  width: 100%;
  height: 46px;
  border: 2px solid var(--border-warm);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 14px;
  transition: border-color 0.25s, box-shadow 0.25s;
  outline: none;
  background: #FAF8F4;
  color: var(--text-primary);
}

.login-form input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 169, 110, 0.12);
  background: #fff;
}

.login-form input::placeholder {
  color: var(--text-placeholder);
}

.btn-block { width: 100%; }

.login-tip {
  text-align: center;
  color: var(--text-placeholder);
  font-size: 12px;
  margin-top: 20px;
  letter-spacing: 0.5px;
}

/* ===== Buttons ===== */
.btn-primary {
  height: 46px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #1B3A2D, #2D5A3D);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(27, 58, 45, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(27, 58, 45, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active { transform: scale(0.98); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-success {
  background: linear-gradient(135deg, #4A8C5C, #5BA86D);
  color: #fff;
  box-shadow: 0 4px 12px rgba(74, 140, 92, 0.25);
}

.btn-success:hover { box-shadow: 0 6px 20px rgba(74, 140, 92, 0.35); }

.btn-danger {
  background: linear-gradient(135deg, #A94442, #C05550);
  color: #fff;
  box-shadow: 0 4px 12px rgba(169, 68, 66, 0.25);
}

.btn-danger:hover { box-shadow: 0 6px 20px rgba(169, 68, 66, 0.35); }

.btn-warning {
  background: linear-gradient(135deg, #C9A96E, #D4B87A);
  color: #fff;
  box-shadow: 0 4px 12px rgba(201, 169, 110, 0.25);
}

.btn-warning:hover { box-shadow: 0 6px 20px rgba(201, 169, 110, 0.35); }

.btn-sm {
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn-sm:hover { opacity: 0.9; transform: translateY(-1px); }

.btn {
  height: 42px;
  padding: 0 22px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: #fff;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

/* ===== Layout ===== */
.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #1B3A2D 0%, #163026 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* 侧边栏纹理装饰 */
.sidebar::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.sidebar-header {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.sidebar-header h2 {
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 2px;
  font-weight: 700;
}

.sidebar-header span {
  font-size: 11px;
  color: rgba(201, 169, 110, 0.5);
  display: block;
  margin-top: 4px;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  position: relative;
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 22px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  border-left: 3px solid transparent;
  margin: 2px 0;
  position: relative;
}

.nav-item:hover {
  color: #fff;
  background: rgba(201, 169, 110, 0.08);
}

.nav-item.active {
  color: #fff;
  background: rgba(201, 169, 110, 0.15);
  border-left-color: var(--gold);
}

.nav-item .nav-icon {
  margin-right: 10px;
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.sidebar-footer .user-info {
  font-size: 13px;
  color: rgba(201, 169, 110, 0.6);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-warm);
}

.topbar {
  height: 56px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 28px;
  box-shadow: 0 1px 4px rgba(27, 58, 45, 0.06);
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}

.topbar h3 {
  font-size: 16px;
  color: var(--green-dark);
  font-weight: 600;
  letter-spacing: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ===== Cards & Tables ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 1px 4px rgba(27, 58, 45, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

/* stat-card 左侧装饰条 */
.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 4px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(27, 58, 45, 0.08);
  border-color: var(--gold-light);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--green-dark);
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--success);
  margin-top: 6px;
  font-weight: 500;
}

.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.quick-actions .btn {
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  font-weight: 500;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.quick-actions .btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.panel {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(27, 58, 45, 0.04);
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.panel-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h4 {
  font-size: 15px;
  color: var(--green-dark);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.panel-body { padding: 22px; }
.panel-body.no-padding { padding: 0; }

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

table th {
  background: #FAF8F4;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

table tr:hover td { background: var(--gold-bg); }

.tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.tag-blue  { background: var(--info-bg);     color: var(--green-dark); }
.tag-green { background: var(--success-bg);   color: var(--success); }
.tag-orange{ background: var(--warning-bg);   color: var(--warning); }
.tag-red   { background: var(--danger-bg);    color: var(--danger); }
.tag-gray  { background: #F5F5F0;             color: var(--text-muted); }

/* ===== Forms ===== */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-gr { flex: 1; min-width: 200px; }

.form-gr label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.form-gr input,
.form-gr select,
.form-gr textarea {
  width: 100%;
  height: 42px;
  border: 2px solid var(--border-warm);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  background: #FAF8F4;
  color: var(--text-primary);
}

.form-gr textarea {
  height: 80px;
  padding: 10px 14px;
  resize: vertical;
}

.form-gr input:focus,
.form-gr select:focus,
.form-gr textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 169, 110, 0.1);
  background: #fff;
}

.form-gr input::placeholder,
.form-gr textarea::placeholder {
  color: var(--text-placeholder);
}

.form-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(27, 58, 45, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(27, 58, 45, 0.2);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  color: var(--green-dark);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ===== Search Bar ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-bar input,
.search-bar select {
  height: 38px;
  border: 2px solid var(--border-warm);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.25s;
  background: #FAF8F4;
  color: var(--text-primary);
}

.search-bar input { width: 240px; }

.search-bar input:focus,
.search-bar select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
  background: #fff;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 52px;
  margin-bottom: 14px;
  opacity: 0.6;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 30px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  z-index: 9999;
  animation: slideDown 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.toast.success { background: linear-gradient(135deg, #4A8C5C, #5BA86D); }
.toast.error   { background: linear-gradient(135deg, #A94442, #C05550); }
.toast.warning { background: linear-gradient(135deg, #C9A96E, #D4B87A); }

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  height: 34px;
  padding: 0 16px;
  border: 2px solid var(--border-warm);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-weight: 500;
}

.pagination button:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-bg);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination span {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ===== Rich Text Preview ===== */
.rich-preview {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  background: #FAF8F4;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
}

.rich-preview img { max-width: 100%; border-radius: 6px; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 18px;
}

.tab-item {
  padding: 10px 22px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.tab-item:hover { color: var(--gold); }

.tab-item.active {
  color: var(--green-dark);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2,
  .sidebar-header span,
  .nav-item span:not(.nav-icon),
  .sidebar-footer .user-info { display: none; }
  .nav-item { justify-content: center; padding: 14px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
}

/* ===== Text Utilities ===== */
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted   { color: var(--text-muted); font-size: 12px; }
.text-gold    { color: var(--gold); }

.ml-8  { margin-left: 8px; }
.mt-8  { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }

.page-hidden { display: none !important; }

/* ===== Quill Editor ===== */
#quillEditor { font-size: 14px; }

#quillEditor .ql-editor {
  min-height: 300px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

#quillEditor .ql-toolbar {
  border-radius: 10px 10px 0 0;
  border-color: var(--border-warm);
  background: #FAF8F4;
}

#quillEditor .ql-container {
  border-radius: 0 0 10px 10px;
  border-color: var(--border-warm);
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201, 169, 110, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201, 169, 110, 0.5); }

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Select & Option ===== */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A89A82' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px !important;
}

/* ===== Focus ring ===== */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
