/* ===== 搏硕汇科研通 - 论文辅导系统 全局样式 ===== */
:root {
  --brand: #2B5AED;
  --brand-light: #E8F0FF;
  --brand-dark: #1A3FBF;
  --brand-gradient: linear-gradient(135deg, #2B5AED 0%, #1A3FBF 100%);
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F0F2F5;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F0F0F0;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.app-header {
  background: white;
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text);
}

.logo-icon-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: 32px;
}

.nav-link {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

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

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px;
  display: none;
  z-index: 200;
}

.user-dropdown.show { display: block; }

.dropdown-item {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }

.role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.role-badge.student { background: #DBEAFE; color: #2563EB; }
.role-badge.tutor { background: #D1FAE5; color: #059669; }
.role-badge.admin { background: #FEF3C7; color: #D97706; }

/* ===== Sidebar Layout (for inner pages) ===== */
.app-body {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}

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

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 12px;
  margin-bottom: 8px;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active { 
  background: var(--brand-light); 
  color: var(--brand); 
  font-weight: 600;
}
.sidebar-item .icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon { font-size: 20px; }

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--brand);
  color: white;
}
.btn-primary:hover { 
  background: var(--brand-dark); 
  box-shadow: 0 4px 12px rgba(43,90,237,0.3);
}

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

.btn-outline {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }

.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

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

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}
.form-textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
}
.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 短信验证码按钮 */
.btn-sms {
  flex-shrink: 0;
  min-width: 120px;
  padding: 10px 16px;
  border: 2px solid var(--brand);
  border-radius: 10px;
  background: white;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-sms:hover:not(:disabled) {
  background: var(--brand);
  color: white;
}
.btn-sms:disabled {
  border-color: var(--border);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.7;
}
.btn-sms.sms-sent {
  border-color: #10b981;
  color: #10b981;
}
.btn-sms.sms-error {
  border-color: #ef4444;
  color: #ef4444;
}
}

/* File upload */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.file-upload-area:hover { border-color: var(--brand); background: var(--brand-light); }
.file-upload-area.dragover { border-color: var(--brand); background: var(--brand-light); }
.file-upload-icon { font-size: 40px; margin-bottom: 8px; }
.file-upload-text { font-size: 14px; color: var(--text-secondary); }
.file-upload-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

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

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-card .stat-trend {
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ===== Feature Modules Grid ===== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.module-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: '\'''\'';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--module-color, var(--brand));
  opacity: 0;
  transition: opacity 0.25s;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--module-color, var(--brand));
}

.module-card:hover::before { opacity: 1; }

.module-card .module-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 16px;
  background: var(--module-bg, var(--brand-light));
}

.module-card .module-name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.module-card .module-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.module-card .module-tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  background: var(--tag-bg, var(--brand-light));
  color: var(--tag-color, var(--brand));
}

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

.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(43,90,237,0.02); }

.table-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.status-pending { background: #FEF3C7; color: #D97706; }
.status-reviewing { background: #DBEAFE; color: #2563EB; }
.status-approved { background: #D1FAE5; color: #059669; }
.status-rejected { background: #FEE2E2; color: #DC2626; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  padding: 0 4px;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand); font-weight: 600; }
.tab-btn.active::after {
  content: '\'''\'';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 1px;
}

/* ===== Loading ===== */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

.loading-overlay .loading-text {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.show { display: flex; }

.modal-box {
  background: white;
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: white;
  border-radius: 10px;
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.3s ease;
  min-width: 260px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--brand); }

/* ===== Result Panel ===== */
.result-panel {
  background: #FAFBFC;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
  max-height: 600px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
}

.result-panel pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
}

/* ===== Progress Steps ===== */
.progress-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
}

.step.done { color: var(--success); }
.step.active { color: var(--brand); }

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid currentColor;
  background: white;
  flex-shrink: 0;
}

.step.done .step-dot { background: var(--success); color: white; border-color: var(--success); }
.step.active .step-dot { background: var(--brand); color: white; border-color: var(--brand); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
}

.step-line.done { background: var(--success); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .header-nav { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

