/* 管理后台样式 - 沿用 signup.html 的紫色渐变风格 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* ==================== 登录页样式 ==================== */

#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 100%;
  padding: 40px;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 28px;
  color: #1a202c;
  margin-bottom: 8px;
}

.login-header p {
  color: #718096;
  font-size: 15px;
}

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

label {
  display: block;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.2s;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-full-width {
  width: 100%;
}

/* ==================== 主界面布局 ==================== */

#main-view {
  display: none;
  min-height: 100vh;
}

.main-container {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 250px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px 10px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 20px;
  color: #1a202c;
  margin-bottom: 8px;
}

.sidebar-header p {
  font-size: 13px;
  color: #718096;
}

.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  padding: 12px 16px;
  border-radius: 8px;
  color: #2d3748;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover {
  background: #f7fafc;
  color: #667eea;
}

.nav-item.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.nav-footer {
  padding-top: 20px;
  border-top: 2px solid #e2e8f0;
}

.logout-btn {
  width: 100%;
  background: #e53e3e;
  padding: 10px;
  font-size: 14px;
}

.logout-btn:hover {
  background: #c53030;
}

/* 主内容区 */
.content-area {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.content-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 30px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.content-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}

.content-header h1 {
  font-size: 28px;
  color: #1a202c;
  margin-bottom: 8px;
}

.content-header p {
  color: #718096;
  font-size: 15px;
}

/* ==================== 筛选区域 ==================== */

.filters {
  background: #f7fafc;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-item {
  flex: 1;
  min-width: 150px;
}

.filter-item label {
  font-size: 13px;
  margin-bottom: 6px;
}

.filter-actions {
  display: flex;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-secondary {
  background: #718096;
}

.btn-secondary:hover {
  background: #4a5568;
}

/* ==================== 表格样式 ==================== */

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

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

thead {
  background: #f7fafc;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #2d3748;
  font-size: 14px;
  border-bottom: 2px solid #e2e8f0;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  color: #4a5568;
  font-size: 14px;
}

tbody tr:hover {
  background: #f7fafc;
}

code {
  background: #2d3748;
  color: #48bb78;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 13px;
}

/* ==================== 分页样式 ==================== */

#pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #e2e8f0;
}

.pagination-info {
  color: #718096;
  font-size: 14px;
}

.pagination-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pagination-buttons button {
  padding: 8px 16px;
  font-size: 14px;
}

/* ==================== Key 池管理样式 ==================== */

.keypool-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

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

/* 添加 Key 区域样式 */
.keypool-add-section {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 2px dashed #cbd5e0;
}

.keypool-add-section h3 {
  font-size: 18px;
  color: #2d3748;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-key-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.key-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: "Courier New", monospace;
  transition: all 0.2s;
}

.key-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
}

.key-input::placeholder {
  color: #a0aec0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.add-key-form button {
  white-space: nowrap;
  padding: 12px 24px;
}

.keypool-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

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

.keys-table {
  width: 100%;
}

.key-current {
  background: #c6f6d5 !important;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #48bb78;
  color: white;
}

.badge-danger {
  background: #e53e3e;
  color: white;
}

.badge-normal {
  background: #cbd5e0;
  color: #2d3748;
}

/* ==================== 响应式 ==================== */

@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .content-area {
    padding: 20px;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-item {
    width: 100%;
  }

  #pagination {
    flex-direction: column;
    gap: 15px;
  }

  .keypool-summary {
    grid-template-columns: 1fr;
  }
}
