/* 运营管理后台 UI 原型 - 桌面端样式 */
html,
body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.admin-toast {
  position: fixed;
  left: 50%;
  top: 72px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 9999;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.admin-toast.admin-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 主框架 */
.admin-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #f1f5f9;
}

.admin-topbar {
  height: 52px;
  background: #1e293b;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.admin-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.admin-sidebar {
  width: 220px;
  background: #0f172a;
  color: #94a3b8;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.2s;
}

.admin-sidebar.collapsed {
  width: 64px;
}

.admin-sidebar.collapsed .menu-text,
.admin-sidebar.collapsed .menu-dir-title {
  display: none;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.admin-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.admin-menu-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-left-color: #3b82f6;
}

.admin-menu-dir {
  padding: 14px 16px 6px;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 0;
  background: #e2e8f0;
  flex-shrink: 0;
  overflow-x: auto;
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  background: #cbd5e1;
  color: #475569;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.admin-tab.active {
  background: #f8fafc;
  color: #1e40af;
  font-weight: 600;
}

.admin-tab-close {
  opacity: 0.5;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
}

.admin-tab-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.admin-tab-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
  padding-right: 8px;
}

.admin-tab-actions button {
  font-size: 12px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px;
}

.admin-tab-actions button:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #334155;
}

.admin-content {
  flex: 1;
  background: #f8fafc;
  overflow: hidden;
  position: relative;
}

.admin-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: none;
}

.admin-iframe.active {
  display: block;
}

/* 子页面通用 */
.admin-page {
  padding: 20px 24px;
  min-height: 100%;
  box-sizing: border-box;
}

.admin-card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-filter-bar {
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  border-bottom: 1px solid #f1f5f9;
}

.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th {
  background: #f8fafc;
  text-align: left;
  padding: 10px 14px;
  color: #64748b;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

.admin-table tbody tr.clickable {
  cursor: pointer;
}

.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.admin-badge-success { background: #dcfce7; color: #166534; }
.admin-badge-warning { background: #fef3c7; color: #92400e; }
.admin-badge-danger { background: #fee2e2; color: #991b1b; }
.admin-badge-info { background: #dbeafe; color: #1e40af; }
.admin-badge-muted { background: #f1f5f9; color: #64748b; }

.admin-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 100;
  display: none;
}

.admin-drawer-overlay.open {
  display: block;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 92vw);
  height: 100%;
  background: #fff;
  z-index: 101;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.12);
  transform: translateX(100%);
  transition: transform 0.25s;
  display: flex;
  flex-direction: column;
}

.admin-drawer.open {
  transform: translateX(0);
}

.admin-drawer-wide {
  width: min(720px, 96vw);
}

.admin-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.admin-drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.admin-modal-overlay.open {
  display: flex;
}

.admin-modal {
  background: #fff;
  border-radius: 10px;
  width: min(440px, 92vw);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.admin-modal-wide {
  width: min(640px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.admin-modal-wide .admin-modal-body {
  overflow-y: auto;
  flex: 1;
}

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

@media (max-width: 640px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

.admin-form-field label {
  display: block;
  font-size: 13px;
  color: #475569;
  margin-bottom: 4px;
}

.admin-form-field input,
.admin-form-field select,
.admin-form-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.admin-form-field textarea {
  min-height: 72px;
  resize: vertical;
}

.admin-form-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

.admin-form-readonly {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  color: #64748b;
}

.admin-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  font-size: 16px;
}

.admin-modal-body {
  padding: 20px;
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

.admin-modal-footer {
  padding: 12px 20px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-perm-tree {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
}

.admin-perm-tree label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}

.admin-perm-tree .indent-1 { padding-left: 20px; }
.admin-perm-tree .indent-2 { padding-left: 40px; }
.admin-perm-tree .indent-3 { padding-left: 60px; }

.admin-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: #64748b;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.admin-upload-zone:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.admin-upload-zone.is-uploading {
  pointer-events: none;
  cursor: wait;
  border-color: #93c5fd;
  background: #f8fafc;
  color: #64748b;
}

.admin-upload-zone.is-uploading:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.admin-img-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.admin-login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  font-size: 13px;
  color: #64748b;
}

/* 私信聊天详情（对齐小程序 pages/chat 左右气泡） */
.admin-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #ededed;
}

.admin-chat-header {
  flex-shrink: 0;
  background: #ffffff;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
}

.admin-chat-header-users {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-chat-header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.admin-chat-header-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #111111;
}

.admin-chat-header-user-id {
  font-size: 12px;
  color: #888888;
}

.admin-chat-header-divider {
  color: #bbbbbb;
  font-size: 13px;
}

.admin-chat-header-desc {
  margin-top: 6px;
  font-size: 12px;
  color: #888888;
}

.admin-chat-messages {
  flex: 1;
  padding: 12px 10px;
}

.admin-chat-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
}

.admin-chat-row.is-other {
  justify-content: flex-start;
}

.admin-chat-row.is-self {
  justify-content: flex-end;
}

.admin-chat-row.is-deleted {
  opacity: 0.65;
}

.admin-chat-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: #c8c8c8;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-chat-avatar.is-self-avatar {
  background: #9fd86b;
}

.admin-chat-content {
  max-width: calc(100% - 56px);
  min-width: 0;
}

.is-other .admin-chat-content {
  margin-left: 8px;
}

.is-self .admin-chat-content {
  margin-right: 8px;
}

.admin-chat-bubble {
  padding: 9px 11px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-all;
  white-space: pre-wrap;
  border-radius: 4px;
}

.is-other .admin-chat-bubble {
  background: #ffffff;
  color: #111111;
}

.is-self .admin-chat-bubble {
  background: #95ec69;
  color: #111111;
}

.admin-chat-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: #888888;
}

.is-self .admin-chat-meta {
  justify-content: flex-end;
}

.admin-chat-pagination {
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
}
