/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --accent: #e67e22;
  --bg: #f0f2f5;
  --sidebar-bg: #1a252f;
  --sidebar-text: #bdc3c7;
  --sidebar-active: #2980b9;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #dce1e5;
  --card-bg: #ffffff;
  --success: #27ae60;
  --warning: #f39c12;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --sidebar-w: 260px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}

/* ===== App Layout ===== */
.app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.sidebar-brand h2 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.sidebar-brand small {
  color: var(--sidebar-text);
  font-size: 12px;
}

/* ===== Collapsible Nav ===== */
.sidebar-nav { padding: 8px 0; flex: 1; }

.nav-group { margin-bottom: 4px; }

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.nav-section-header:hover {
  background: rgba(255,255,255,0.04);
}

.nav-section-header .nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
}

.nav-section-header .nav-toggle-icon {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  transition: transform 0.25s;
}

.nav-group.collapsed .nav-toggle-icon {
  transform: rotate(-90deg);
}

.nav-group-items {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-group.collapsed .nav-group-items {
  max-height: 0 !important;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px 9px 24px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.nav-link.active {
  background: rgba(41,128,185,0.18);
  color: #fff;
  border-left-color: var(--sidebar-active);
}

.nav-link .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== Main Content ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Top Bar ===== */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-light);
}

.topbar-breadcrumb a {
  color: var(--primary-light);
  text-decoration: none;
}

.topbar-breadcrumb a:hover { text-decoration: underline; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* ===== Content Area ===== */
.content {
  padding: 28px;
  max-width: 1100px;
  width: 100%;
}

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

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg);
}

.card-header .icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 350px;
  height: 350px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.hero h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
  position: relative;
}

.hero p {
  font-size: 15px;
  opacity: 0.92;
  max-width: 720px;
  line-height: 1.7;
  position: relative;
}

.hero-meta {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
  position: relative;
}

.hero-meta span {
  background: rgba(255,255,255,0.14);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
}

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

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 16px;
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-3px); }

.stat-card .stat-number {
  font-size: 40px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
}

/* ===== Section Card (index objectives) ===== */
.section-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  padding-left: 14px;
  border-left: 4px solid var(--primary);
}

/* ===== Objective List ===== */
.objectives-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.objective-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.objective-number {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.objective-item h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.objective-item p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
}

/* ===== Lab Grid ===== */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.lab-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

.lab-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

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

.lab-badge {
  background: var(--primary);
  color: #fff;
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
}

.lab-date {
  font-size: 12px;
  color: var(--text-light);
}

.lab-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.lab-card-desc {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
}

/* ===== Experiment Page ===== */
.exp-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: 12px;
  padding: 32px 32px;
  margin-bottom: 24px;
}

.exp-header .exp-num {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 10px;
}

.exp-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.exp-header .exp-info {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
  opacity: 0.9;
  margin-top: 10px;
}

/* ===== Step List ===== */
.step-list { }

.step-item {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.step-num {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.7;
}

/* ===== Info Table ===== */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.info-table th,
.info-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 14px;
}

.info-table th {
  background: var(--bg);
  font-weight: 600;
  text-align: left;
  width: 110px;
  white-space: nowrap;
}

/* ===== Objective List (lab pages) ===== */
.obj-list {
  list-style: none;
  padding: 0;
}

.obj-list li {
  padding: 10px 14px 10px 40px;
  position: relative;
  font-size: 14px;
  line-height: 1.7;
  border-bottom: 1px solid var(--bg);
}

.obj-list li:last-child { border-bottom: none; }

.obj-list li::before {
  content: attr(data-num);
  position: absolute;
  left: 10px;
  top: 10px;
  background: var(--accent);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  text-align: center;
  line-height: 22px;
  font-size: 12px;
  font-weight: 700;
}

/* ===== Download Button ===== */
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success);
  color: #fff;
  padding: 11px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.download-btn:hover {
  background: #219a52;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(39,174,96,0.3);
}

.download-btn .dl-icon { font-size: 16px; }

/* ===== Resource List ===== */
.resource-list {
  display: grid;
  gap: 14px;
}

.resource-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.resource-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-lg);
}

.resource-icon {
  width: 44px;
  height: 44px;
  background: #eaf2f8;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.resource-info { flex: 1; min-width: 0; }
.resource-info h4 { font-size: 14px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resource-info p { font-size: 13px; color: var(--text-light); }

/* ===== Nav Buttons ===== */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s;
}

.nav-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ===== Footer ===== */
.footer {
  padding: 20px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--card-bg);
}

/* ===== Sidebar Overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 18px 14px; }
  .hero { padding: 26px 22px; }
  .hero h1 { font-size: 20px; }
  .lab-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .exp-header .exp-info { flex-direction: column; gap: 6px; }
  .exp-header { padding: 24px 20px; }
  .card { padding: 18px 16px; }
  .topbar { padding: 12px 16px; }
  .resource-item { flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .submit-card { max-width: 100%; }
}

/* ===== Submit Form ===== */
.submit-card { max-width: 680px; }

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

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

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

.form-group .required {
  color: #e74c3c;
  font-weight: 700;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #b0b8bf;
}

.form-group select {
  cursor: pointer;
  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='%237f8c8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* File Upload Area */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--primary-light);
  background: rgba(41,128,185,0.04);
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.file-upload-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 4px;
}

.file-upload-hint {
  font-size: 12px;
  color: var(--text-light);
}

/* File Info (after selection) */
.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #eaf2f8;
  border-radius: var(--radius);
  border: 1px solid var(--primary-light);
}

.file-info-icon { font-size: 20px; }
.file-info-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info-size {
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
}
.file-remove {
  background: none;
  border: none;
  font-size: 20px;
  color: #e74c3c;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.file-remove:hover { color: #c0392b; }

/* Submit Button */
.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 12px 32px;
  border-radius: var(--radius);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.submit-btn:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,82,118,0.3);
}

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

.submit-icon { font-size: 16px; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Submit Result */
.submit-result {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.submit-result.success {
  background: #eafaf1;
  color: #1e8449;
  border: 1px solid #a9dfbf;
}

.submit-result.error {
  background: #fdedec;
  color: #c0392b;
  border: 1px solid #f5b7b1;
}

/* Notice List */
.notice-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notice-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.notice-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.notice-item p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  padding-top: 2px;
}

/* ===== Print ===== */
@media print {
  .sidebar, .topbar, .nav-buttons, .download-btn, .menu-toggle { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
