/* ===== NiuNiu2027 Admin Dashboard Styles ===== */
/* 深色专业风格 */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
}

/* ===== Login Screen ===== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #0f1117 0%, #1a1d2e 50%, #0f1117 100%);
}

.login-card {
  background: rgba(30, 34, 50, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 40px 36px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
}

.login-logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: #888;
  margin-bottom: 28px;
}

#login-form input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}

#login-form input:focus {
  border-color: #4f8cf7;
  background: rgba(255,255,255,0.08);
}

.error-msg {
  color: #ef5350;
  font-size: 13px;
  margin-top: 10px;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: #888;
  font-size: 13px;
  text-decoration: none;
}

.back-link:hover { color: #aaa; text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #4f8cf7, #3b6edb);
  color: white;
  box-shadow: 0 2px 12px rgba(79,140,247,0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,140,247,0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.12);
}

.btn-secondary:hover { background: rgba(255,255,255,0.12); }

.btn-danger {
  background: linear-gradient(135deg, #ef5350, #d32f2f);
  color: white;
  box-shadow: 0 2px 12px rgba(239,83,80,0.3);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(239,83,80,0.4);
}

.btn-full { width: 100%; }

/* ===== Navigation ===== */
#admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(20, 23, 35, 0.98);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.nav-icon { font-size: 20px; }

.nav-tag {
  font-size: 11px;
  font-weight: 500;
  color: #4f8cf7;
  background: rgba(79,140,247,0.12);
  padding: 2px 8px;
  border-radius: 6px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  color: #aaa;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-link:hover { color: #fff; background: rgba(255,255,255,0.06); }

.btn-logout { color: #ef5350; }
.btn-logout:hover { background: rgba(239,83,80,0.1); color: #ff6b6b; }

/* ===== Content Layout ===== */
#admin-content {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ===== Sidebar ===== */
#admin-sidebar {
  width: 220px;
  background: rgba(18, 21, 32, 0.98);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  width: 100%;
}

.sidebar-btn:hover { background: rgba(255,255,255,0.06); color: #ddd; }

.sidebar-btn.active {
  background: rgba(79,140,247,0.12);
  color: #4f8cf7;
  font-weight: 600;
}

/* ===== Main Content ===== */
#admin-main {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
  overflow-y: auto;
}

.admin-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

.admin-section h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 13px;
  color: #888;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #bbb;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus {
  border-color: #4f8cf7;
  background: rgba(255,255,255,0.07);
}

select.form-input {
  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='%23999' d='M3 5l3 3 3-3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select.form-input option {
  background: #1e2232;
  color: #e0e0e0;
}

/* ===== Model Cards ===== */
.model-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.model-selector label {
  font-size: 14px;
  color: #bbb;
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #ccc;
  cursor: pointer;
}

.radio-item input[type="radio"] {
  accent-color: #4f8cf7;
  width: 16px;
  height: 16px;
}

.model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.model-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 18px;
}

.model-card h4 {
  font-size: 15px;
  color: #4f8cf7;
  margin-bottom: 14px;
}

.api-url-hint {
  font-size: 12px;
  color: #888;
  background: rgba(79,140,247,0.06);
  border: 1px solid rgba(79,140,247,0.15);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.api-url-hint code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #4f8cf7;
}

/* ===== Search Cards ===== */
.search-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.search-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.search-icon { font-size: 28px; }

.search-card-header h4 {
  font-size: 15px;
  color: #fff;
  margin: 0;
}

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

.badge-green { background: rgba(76,175,80,0.15); color: #66bb6a; }
.badge-blue { background: rgba(79,140,247,0.15); color: #4f8cf7; }
.badge-orange { background: rgba(255,152,0,0.15); color: #ffa726; }

.search-desc {
  font-size: 13px;
  color: #999;
  margin-bottom: 12px;
}

.search-desc a {
  color: #4f8cf7;
  text-decoration: none;
}

.search-desc a:hover { text-decoration: underline; }

/* ===== Font Preview ===== */
.font-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.color-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-picker {
  width: 44px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 2px;
}

.font-preview {
  margin-bottom: 20px;
}

.font-preview h4 {
  font-size: 14px;
  color: #bbb;
  margin-bottom: 10px;
}

#font-preview-box {
  background: #ffffff;
  padding: 24px;
  border-radius: 8px;
  line-height: 2;
  white-space: pre-line;
  min-height: 80px;
}

/* ===== Stats Cards ===== */
.stats-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-label {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}

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

.stat-sub {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: #999;
}

.stat-sub b { color: #ccc; }

/* ===== Token Table ===== */
.token-table-wrapper {
  overflow-x: auto;
  margin-top: 12px;
}

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

.token-table th {
  text-align: left;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  color: #aaa;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.token-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #ccc;
}

/* ===== Switches ===== */
.switch-items {
  margin-bottom: 20px;
}

.switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  margin-bottom: 10px;
}

.switch-label {
  font-size: 15px;
  font-weight: 600;
  color: #ddd;
  margin-bottom: 4px;
}

.switch-desc {
  font-size: 12px;
  color: #888;
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #444;
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: #4f8cf7;
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(50, 55, 75, 0.96);
  color: #fff;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.status-msg {
  margin-top: 14px;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #admin-content {
    flex-direction: column;
  }

  #admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .sidebar-btn {
    white-space: nowrap;
    font-size: 12px;
    padding: 8px 12px;
  }

  #admin-main {
    padding: 20px 16px;
  }

  .model-cards {
    grid-template-columns: 1fr;
  }

  .font-settings-grid {
    grid-template-columns: 1fr;
  }

  .stats-cards {
    grid-template-columns: 1fr;
  }
}
