/* ABOUTME: 化学实验平台主样式表 */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #ede9fe;
  --secondary: #0ea5e9;
  --secondary-dark: #0284c7;
  --accent: #10b981;
  --bg-white: #ffffff;
  --bg-light: #f8fafc;
  --bg-gray: #f1f5f9;
  --text-dark: #1e293b;
  --text-medium: #475569;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-hover: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --amber: #f59e0b;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --green: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

/* ===== Navigation ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
}

.navbar-logo svg {
  width: 32px;
  height: 32px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.navbar-links a {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--text-medium);
  font-weight: 500;
  transition: var(--transition);
}

.navbar-links a:hover {
  background: var(--bg-gray);
  color: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-medium);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, #7c3aed 0%, #0ea5e9 100%);
  color: #fff;
  padding: 80px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0.12;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero .subtitle {
  font-size: 1.1875rem;
  opacity: 0.9;
  line-height: 1.6;
  font-weight: 400;
}

.hero .badge {
  display: inline-block;
  margin-top: 24px;
  padding: 8px 20px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  font-size: 0.875rem;
  backdrop-filter: blur(4px);
}

/* ===== Section ===== */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.section-desc {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 36px;
}

/* ===== Experiment Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 16px;
  width: fit-content;
}

.card-tag-optional,
.card-tag-required,
.card-tag-sim {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  margin-left: 2px;
}
.card-tag-required { background: rgba(255,255,255,0.3); }
.card-tag-optional { background: rgba(255,255,255,0.3); }
.card-tag-sim { background: rgba(255,255,255,0.3); }

.card-chapter {
  font-size: 0.8125rem;
  color: var(--secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.card h3 {
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
  line-height: 1.4;
}

.card p {
  font-size: 0.9375rem;
  color: var(--text-light);
  line-height: 1.6;
  flex: 1;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  transition: var(--transition);
}

.card-link:hover {
  gap: 10px;
  color: var(--primary-dark);
}

.card-link svg {
  width: 16px;
  height: 16px;
  transition: var(--transition);
}

/* ===== Footer ===== */
.footer {
  background: var(--text-dark);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 32px 24px;
  font-size: 0.875rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px 0;
  font-size: 0.875rem;
  color: var(--text-light);
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 8px; color: var(--border); }

/* ===== Experiment Detail ===== */
.exp-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.exp-header {
  margin-bottom: 40px;
}

.exp-header .exp-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.exp-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
  line-height: 1.3;
}

.exp-header .exp-chapter {
  font-size: 0.9375rem;
  color: var(--secondary);
  font-weight: 600;
}

.exp-section {
  margin-bottom: 36px;
}

.exp-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg-gray);
  display: flex;
  align-items: center;
  gap: 10px;
}

.exp-section h2 .icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
  flex-shrink: 0;
}

.exp-section ul,
.exp-section ol {
  padding-left: 24px;
  margin-bottom: 8px;
}

.exp-section li {
  margin-bottom: 8px;
  line-height: 1.75;
  color: var(--text-medium);
}

.exp-section ol li::marker {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Data Table ===== */
.data-table-wrapper {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th {
  background: var(--bg-gray);
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text-medium);
}

.data-table tbody tr:nth-child(even) {
  background: var(--bg-light);
}

.data-table tbody tr:hover {
  background: #f0e7ff;
}

/* ===== Notice Box ===== */
.notice-box {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-top: 12px;
}

.notice-box ul { padding-left: 20px; margin: 0; }

.notice-box li {
  color: #92400e;
  margin-bottom: 6px;
  font-size: 0.9375rem;
}

/* ===== Safety Box ===== */
.safety-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-top: 12px;
}

.safety-box ul { padding-left: 20px; margin: 0; }

.safety-box li {
  color: #991b1b;
  margin-bottom: 6px;
  font-size: 0.9375rem;
}

/* ===== Formula Box ===== */
.formula-box {
  background: var(--primary-light);
  border: 1px solid #c4b5fd;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-top: 12px;
  font-size: 1rem;
  line-height: 2;
  text-align: center;
}

.formula-box sub { font-size: 0.8em; }
.formula-box sup { font-size: 0.8em; }

/* ===== Collapsible ===== */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 12px;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-white);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-dark);
  transition: var(--transition);
  user-select: none;
}

.collapsible-header:hover {
  background: var(--bg-gray);
}

.collapsible-header .arrow {
  transition: transform 0.3s ease;
  color: var(--text-light);
}

.collapsible-header.open .arrow {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 20px;
}

.collapsible-content.open {
  max-height: 2000px;
  padding: 14px 20px 20px;
}

/* ===== Back Button ===== */
.back-section {
  text-align: center;
  padding: 30px 24px 60px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-back:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ===== Simulation Styles ===== */
.sim-container { display: flex; gap: 24px; max-width: 1200px; margin: 0 auto; padding: 24px; flex-wrap: wrap; }
.sim-canvas-wrap { flex: 1; min-width: 320px; }
.sim-canvas-wrap canvas { width: 100%; border-radius: var(--radius-sm); background: #0f172a; display: block; }
.sim-controls { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; overflow: visible !important; }
.sim-control-group { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; overflow: visible !important; }
.sim-control-group h4 { font-size: 14px; color: var(--text-light); margin-bottom: 12px; font-weight: 500; }
.sim-control-row { margin-bottom: 10px; }
.sim-control-row label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-medium); margin-bottom: 4px; }
.sim-control-row label span { color: var(--primary); font-weight: 600; }
.sim-control-row input[type="range"] { width: 100%; accent-color: var(--primary); }
.sim-control-row select { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; position: relative; z-index: 1; }
.sim-data { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.sim-data h4 { font-size: 14px; color: var(--text-light); margin-bottom: 10px; font-weight: 500; }
.sim-data-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--bg-gray); }
.sim-data-row:last-child { border-bottom: none; }
.sim-data-row .val { font-weight: 600; color: var(--text-dark); font-variant-numeric: tabular-nums; }
.sim-buttons { display: flex; gap: 8px; }
.sim-btn { flex: 1; padding: 10px; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.sim-btn-primary { background: var(--primary); color: #fff; }
.sim-btn-primary:hover { background: var(--primary-dark); }
.sim-btn-secondary { background: var(--bg-gray); color: var(--text-dark); }
.sim-btn-secondary:hover { background: var(--border); }
.sim-final { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius-sm); padding: 12px; font-size: 13px; color: #065f46; }
.sim-principle-toggle { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; cursor: pointer; max-width: 1200px; margin: 0 auto 24px; }
.sim-principle-toggle h4 { font-size: 15px; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
.sim-principle-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.sim-principle-content.open { max-height: 600px; margin-top: 12px; }
.sim-principle-content p { font-size: 14px; color: var(--text-medium); line-height: 1.8; }

@media (max-width: 768px) {
  .sim-container { flex-direction: column; }
  .sim-controls { width: 100%; }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .navbar-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-white);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .navbar-links.open {
    display: flex;
  }

  .navbar-links a {
    width: 100%;
    padding: 12px 16px;
  }

  .mobile-menu-btn {
    display: block;
  }

  .exp-header h1 {
    font-size: 1.5rem;
  }
}
