/* 全局变量 */
:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --success-color: #10b981;
  --success-hover: #059669;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --warning-color: #f59e0b;
  --warning-hover: #d97706;
  --gray-color: #6b7280;
  --gray-hover: #4b5563;
  --gray-bg: #f9fafb;
  --gray-border: #e5e7eb;
  --dark-bg: #1f2937;
  --dark-border: #374151;
  --white: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--gray-bg);
  color: var(--text-primary);
}

/* 登录页面 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 24rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-primary);
}

/* 表单元素 */
.form-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background-color: var(--white);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 按钮样式 */
.btn {
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success-color);
  color: var(--white);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--success-hover);
}

.btn-danger {
  background-color: var(--danger-color);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
}

.btn-gray {
  background-color: var(--gray-color);
  color: var(--white);
}

.btn-gray:hover:not(:disabled) {
  background-color: var(--gray-hover);
}

.btn-sm {
  padding: 0.25rem 1rem;
  font-size: 0.875rem;
}

.btn-full {
  width: 100%;
}

/* 文本按钮 */
.btn-text {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.btn-text-primary {
  color: var(--primary-color);
}

.btn-text-primary:hover {
  color: var(--primary-hover);
}

.btn-text-danger {
  color: var(--danger-color);
}

.btn-text-danger:hover {
  color: var(--danger-hover);
}

/* 主布局 */
.main-layout {
  display: flex;
  height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 16rem;
  background-color: var(--dark-bg);
  color: var(--white);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  font-size: 1.25rem;
  font-weight: bold;
  border-bottom: 1px solid var(--dark-border);
}

.sidebar-nav {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: background-color 0.2s;
  font-size: 1rem;
}

.nav-item:hover {
  background-color: var(--dark-border);
}

.nav-item.active {
  background-color: var(--primary-color);
}

/* 内容区域 */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

/* 卡片 */
.card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.page-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* 表格 */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background-color: var(--gray-bg);
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--gray-border);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-border);
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background-color: var(--gray-bg);
}

/* 网格布局 */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Flex布局 */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

/* 间距 */
.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.p-2 {
  padding: 0.5rem;
}

.p-4 {
  padding: 1rem;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 0 1rem;
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

.pagination-btn {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background-color: var(--gray-bg);
}

.pagination-btn:disabled {
  background-color: var(--gray-bg);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-btn.active {
  background-color: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

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

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 66.666667%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.modal-section {
  margin-bottom: 1rem;
}

.modal-section-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* 权限项 */
.permission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background-color: var(--gray-bg);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
}

.permission-info {
  flex: 1;
}

.permission-type {
  font-weight: 500;
}

.permission-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.permission-actions {
  display: flex;
  gap: 0.5rem;
}

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

/* 错误提示 */
.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* 结果显示 */
.result-box {
  margin-top: 1rem;
  padding: 1rem;
  background-color: var(--gray-bg);
  border-radius: var(--radius-md);
}

.result-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-item {
  margin-bottom: 0.25rem;
}

.result-label {
  font-weight: 500;
}

/* 工具类 */
.hidden {
  display: none !important;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: bold;
}

.text-gray {
  color: var(--text-secondary);
}

.text-primary {
  color: var(--primary-color);
}

.text-success {
  color: var(--success-color);
}

.text-danger {
  color: var(--danger-color);
}

.text-warning {
  color: var(--warning-color);
}

.bg-gray {
  background-color: var(--gray-bg);
}

.rounded {
  border-radius: var(--radius-md);
}

.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.shadow {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

/* 响应式 */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
  }

  .content-area {
    padding: 1rem;
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    max-width: 95%;
  }

  .data-table {
    font-size: 0.75rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-hover);
}
