/* ============================================
   jiazheng2026ai - Admin Panel Stylesheet
   Eye-friendly theme matching the main site
   ============================================ */

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

:root {
  --bg-primary: #f4f4ef;
  --bg-secondary: #eaeae3;
  --bg-card: #faf9f5;
  --bg-white: #ffffff;
  --wood-border: #a0885a;
  --wood-light: #c4a96a;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --accent: #5a8a3c;
  --accent-light: #7ab55a;
  --accent-hover: #4a7a2c;
  --border: #d8d8cc;
  --input-focus: #8ab468;
  --danger: #d9534f;
  --danger-hover: #c9302c;
  --warning-bg: #fff8e1;
  --warning-border: #ffe082;
  --info-bg: #e8f5e9;
  --info-border: #a5d6a7;
  --radius: 10px;
  --shadow-soft: 0 2px 10px rgba(0,0,0,0.06);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.08);
  --transition: all 0.25s ease;
}

body {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================
   Login Screen
   ============================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.5s ease-out;
}

.login-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--accent-hover);
}

/* ============================================
   Admin Dashboard Layout
   ============================================ */
.admin-dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.header-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.header-link:hover {
  color: var(--accent-hover);
}

.admin-content {
  flex: 1;
  display: flex;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
}

/* ============================================
   Sidebar
   ============================================ */
.admin-sidebar {
  width: 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-secondary);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(90, 138, 60, 0.3);
}

/* ============================================
   Sections
   ============================================ */
.admin-sections {
  flex: 1;
  min-width: 0;
}

.section {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--shadow-soft);
  animation: fadeIn 0.3s ease-out;
}

.section.active {
  display: block;
}

.section-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

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

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(138, 180, 104, 0.15);
}

.form-input-sm {
  width: auto;
  min-width: 100px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  line-height: 1.5;
}

.form-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.form-color {
  width: 48px;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(90, 138, 60, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(90, 138, 60, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(90, 138, 60, 0.06);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(217, 83, 79, 0.25);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(217, 83, 79, 0.35);
}

.btn-sm {
  padding: 7px 16px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
}

.btn-success {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
  color: #fff;
}

.btn-warning-outline {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}

.btn-warning-outline:hover {
  background: rgba(217, 83, 79, 0.06);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.alert-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: #2e7d32;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #f57f17;
}

/* ============================================
   Model Tabs
   ============================================ */
.model-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.model-tab {
  padding: 10px 24px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}

.model-tab:hover {
  border-color: var(--accent);
}

.model-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.model-form {
  animation: fadeIn 0.2s ease-out;
}

.model-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.model-status.active {
  background: var(--info-bg);
  color: #2e7d32;
  border: 1px solid var(--info-border);
}

.model-status.inactive {
  background: #f5f5f5;
  color: #999;
  border: 1px solid #ddd;
}

.model-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================
   Status Indicator
   ============================================ */
.status-indicator {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.status-indicator.running {
  background: var(--info-bg);
  color: #2e7d32;
  border: 1px solid var(--info-border);
}

.status-indicator.stopped {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* ============================================
   Info Box
   ============================================ */
.info-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
}

.info-box h4 {
  margin-bottom: 8px;
  font-size: 14px;
}

.info-box code {
  background: rgba(0,0,0,0.04);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* ============================================
   Memory List
   ============================================ */
.memory-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.memory-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.memory-item .memory-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.empty-text {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 0;
  font-size: 15px;
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

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

.toast.toast-success {
  background: #43a047;
}

.toast.toast-error {
  background: #e53935;
}

.hidden {
  display: none !important;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .admin-content {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    min-width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .nav-item {
    padding: 8px 14px;
    font-size: 13px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .section {
    padding: 24px 20px;
  }
}

@media (max-width: 500px) {
  .admin-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-title {
    font-size: 1.1rem;
  }
  .login-card {
    padding: 36px 24px;
  }
  .model-tabs {
    flex-wrap: wrap;
  }
  .model-actions {
    flex-wrap: wrap;
  }
}
