@import "tailwindcss";

@theme inline {
  --font-sans: ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
}

/* ========== 黑白极简风格 ========== */

/* 重置基础样式 */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: #ffffff;
  color: #171717;
  margin: 0;
  padding: 0;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #0a0a0a;
    color: #ededed;
  }
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 链接 */
a {
  color: inherit;
  text-decoration: none;
}

/* 按钮基础 */
button {
  cursor: pointer;
  font-family: inherit;
}

/* 输入框 */
input,
textarea,
select {
  font-family: inherit;
}

/* ========== 布局工具 ========== */

.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid #e5e5e5;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (prefers-color-scheme: dark) {
  .admin-sidebar {
    border-right-color: #27272a;
    background: #09090b;
  }
}

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

.admin-topbar {
  height: 56px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .admin-topbar {
    border-bottom-color: #27272a;
    background: #09090b;
  }
}

.admin-content {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

/* ========== 页面容器 ========== */

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.page-subtitle {
  font-size: 14px;
  color: #737373;
  margin: 0;
}

/* ========== 卡片 ========== */

.card {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #ffffff;
  padding: 20px;
}

@media (prefers-color-scheme: dark) {
  .card {
    border-color: #27272a;
    background: #18181b;
  }
}

/* ========== 表格 ========== */

.table-container {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e5e5;
}

.data-table th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #737373;
  background: #fafafa;
}

@media (prefers-color-scheme: dark) {
  .data-table th,
  .data-table td {
    border-bottom-color: #27272a;
  }

  .data-table th {
    background: #09090b;
    color: #a1a1aa;
  }
}

.data-table tr:hover td {
  background: #fafafa;
}

@media (prefers-color-scheme: dark) {
  .data-table tr:hover td {
    background: #18181b;
  }
}

/* ========== 按钮 ========== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: #171717;
  color: #ffffff;
  border-color: #171717;
}

.btn-primary:hover {
  background: #404040;
}

.btn-secondary {
  background: #ffffff;
  color: #171717;
  border-color: #e5e5e5;
}

.btn-secondary:hover {
  background: #fafafa;
}

.btn-danger {
  background: #ffffff;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 表单 ========== */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 14px;
  background: #ffffff;
  color: #171717;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #171717;
}

.form-input::placeholder {
  color: #a3a3a3;
}

@media (prefers-color-scheme: dark) {
  .form-input {
    background: #18181b;
    border-color: #27272a;
    color: #ededed;
  }

  .form-input:focus {
    border-color: #ededed;
  }
}

.form-error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
}

/* ========== 徽章 ========== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-neutral {
  background: #f4f4f5;
  color: #52525b;
  border: 1px solid #e4e4e7;
}

@media (prefers-color-scheme: dark) {
  .badge-success {
    background: #14532d;
    color: #bbf7d0;
    border-color: #166534;
  }

  .badge-danger {
    background: #7f1d1d;
    color: #fecaca;
    border-color: #991b1b;
  }

  .badge-neutral {
    background: #27272a;
    color: #a1a1aa;
    border-color: #3f3f46;
  }
}

/* ========== 分页 ========== */

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.pagination-info {
  font-size: 14px;
  color: #737373;
  margin-right: auto;
}

/* ========== 登录页 ========== */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

@media (prefers-color-scheme: dark) {
  .login-container {
    background: #09090b;
  }
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: #737373;
  text-align: center;
  margin-bottom: 32px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 12px;
  color: #a3a3a3;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e5e5;
}

@media (prefers-color-scheme: dark) {
  .login-divider::before,
  .login-divider::after {
    background: #27272a;
  }
}

/* ========== 统计卡片 ========== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .stat-card {
    border-color: #27272a;
    background: #18181b;
  }
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #737373;
}

/* ========== 空状态 ========== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #737373;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* ========== 加载 ========== */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #737373;
}

/* ========== 模态框 ========== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

@media (prefers-color-scheme: dark) {
  .modal {
    background: #18181b;
  }
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e5e5e5;
}

@media (prefers-color-scheme: dark) {
  .modal-footer {
    border-top-color: #27272a;
  }
}

/* ========== 侧边栏菜单 ========== */

.sidebar-logo {
  padding: 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid #e5e5e5;
}

@media (prefers-color-scheme: dark) {
  .sidebar-logo {
    border-bottom-color: #27272a;
  }
}

.sidebar-nav {
  padding: 8px;
  flex: 1;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #a3a3a3;
  padding: 8px 12px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #52525b;
  transition: all 0.15s;
}

.sidebar-link:hover {
  background: #f4f4f5;
  color: #171717;
}

.sidebar-link.active {
  background: #171717;
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .sidebar-link {
    color: #a1a1aa;
  }

  .sidebar-link:hover {
    background: #27272a;
    color: #ededed;
  }

  .sidebar-link.active {
    background: #ededed;
    color: #09090b;
  }
}

/* ========== Toast / Alert ========== */

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

@media (prefers-color-scheme: dark) {
  .alert-error {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
  }

  .alert-success {
    background: #052e16;
    color: #86efac;
    border-color: #14532d;
  }
}

/* ========== 复选框组 ========== */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
}

@media (prefers-color-scheme: dark) {
  .checkbox-group {
    border-color: #27272a;
  }
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-item:hover {
  background: #f4f4f5;
}

@media (prefers-color-scheme: dark) {
  .checkbox-item:hover {
    background: #27272a;
  }
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ========== 搜索栏 ========== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
  max-width: 320px;
}

/* ========== 信息表格 ========== */

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table td {
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid #e5e5e5;
  vertical-align: top;
}

@media (prefers-color-scheme: dark) {
  .info-table td {
    border-bottom-color: #27272a;
  }
}

.info-label {
  font-weight: 500;
  color: #737373;
  width: 100px;
  flex-shrink: 0;
}

/* ========== 卡片标题 ========== */

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e5e5;
}

@media (prefers-color-scheme: dark) {
  .card-title {
    border-bottom-color: #27272a;
  }
}
