/* ============================================================
   风雅考研 — 专业课资料展示站
   设计方向：干净、可信、书卷气
   配色：深蓝主色 + 暖橙CTA + 灰色背景
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #1a202c;
  background: #f5f6f8;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Header --- */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e8ecf1;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #1e3a5f, #2c5282);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

.site-name {
  font-size: 17px;
  font-weight: 600;
  color: #1e3a5f;
}

.site-tagline {
  font-size: 12px;
  color: #8896a7;
  display: none;
}

@media (min-width: 480px) {
  .site-tagline {
    display: block;
  }
}

/* --- Main Content --- */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

/* --- Hero / Intro Section --- */
.intro-section {
  text-align: center;
  padding: 32px 16px 20px;
}

.intro-section h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 6px;
}

.intro-section p {
  font-size: 14px;
  color: #718096;
  max-width: 400px;
  margin: 0 auto;
}

/* --- Category Filter --- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.filter-pill:hover {
  border-color: #2c5282;
  color: #2c5282;
}

.filter-pill.active {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}

/* --- Product Grid --- */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 520px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

/* --- Product Card --- */
.product-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.product-card:active {
  transform: scale(0.985);
}

@media (hover: hover) {
  .product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  }
}

.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  background: #edf2f7;
}

..card-image-wrap img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.3s ease; }

.product-card:hover ..card-image-wrap img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.3s ease; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  background: #fff;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e0;
  transition: all 0.25s ease;
}

.carousel-dot.active {
  background: #1e3a5f;
  width: 20px;
  border-radius: 4px;
}

.carousel-counter {
  position: absolute;
  bottom: 12px;
  right: 14px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  pointer-events: none;
}

/* Product Info Section */
.detail-info {
  padding: 18px 16px 0;
  background: #fff;
}

.detail-school {
  font-size: 13px;
  color: #718096;
  margin-bottom: 6px;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.4;
  margin-bottom: 12px;
}

.detail-desc {
  font-size: 14px;
  color: #4a5568;
  line-height: 1.7;
  padding-bottom: 16px;
  border-bottom: 1px solid #edf2f7;
}

/* Variant Selector */
.variant-section {
  padding: 16px;
  background: #fff;
  border-top: 1px solid #edf2f7;
}

.variant-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 10px;
}

.variant-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.variant-btn {
  padding: 10px 18px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #4a5568;
  background: #fff;
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
}

.variant-btn:hover {
  border-color: #2c5282;
  color: #2c5282;
}

.variant-btn.selected {
  border-color: #1e3a5f;
  background: #eef3fa;
  color: #1e3a5f;
  font-weight: 600;
}

/* Price Display */
.price-section {
  padding: 14px 16px;
  background: #fff;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.price-current {
  font-size: 28px;
  font-weight: 700;
  color: #e8590c;
}

.price-yuan {
  font-size: 16px;
  font-weight: 500;
}

/* Fixed Bottom CTA */
.cta-bar { max-width: 500px; margin: 0 auto;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #edf2f7;
  z-index: 90;
}

.cta-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 500px; margin: 0 auto; padding: 14px 24px; background: linear-gradient(135deg, #e8590c, #f97316); color: #fff; font-size: 17px; font-weight: 600; border-radius: 10px; transition: opacity 0.2s, transform 0.15s; box-shadow: 0 4px 14px rgba(232, 89, 12, 0.3); }

.cta-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.cta-hint {
  text-align: center;
  font-size: 12px;
  color: #a0aec0;
  margin-top: 6px;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 24px 16px 20px;
  font-size: 13px;
  color: #a0aec0;
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, #edf2f7 25%, #e2e8f0 50%, #edf2f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

.skeleton-img {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.skeleton-text {
  padding: 14px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line:last-child {
  width: 60%;
  margin-bottom: 0;
}

/* --- Fade-in animation --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  animation: fadeInUp 0.4s ease backwards;
}

/* --- Toast --- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.detail-page { max-width: 500px; margin: 0 auto; padding: 0 12px 80px; }

/* --- Responsive tweaks --- */
@media (min-width: 768px) {
  .detail-page {
    padding-top: 8px;
  }
  .carousel-slide img {
    aspect-ratio: 16 / 10;
  }
}

@media (min-width: 960px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Search Box --- */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 480px;
  margin: 0 auto 12px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap:focus-within {
  border-color: #1e3a5f;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
  opacity: 0.5;
}

.search-input {
  flex: 1;
  padding: 11px 40px 11px 40px;
  border: none;
  outline: none;
  font-size: 15px;
  color: #1a202c;
  background: transparent;
  border-radius: 10px;
}

.search-input::placeholder {
  color: #a0aec0;
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #a0aec0;
  transition: background 0.15s, color 0.15s;
}

.search-clear:hover {
  background: #edf2f7;
  color: #4a5568;
}

.search-result-hint {
  text-align: center;
  font-size: 13px;
  color: #a0aec0;
  padding: 4px 0 8px;
}
/* ============================================================
   Admin Page
   ============================================================ */

.back-link {
  font-size: 14px;
  color: #2c5282;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}
.back-link:hover { background: #edf2f7; }

.admin-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* Toolbar */
.admin-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-hint {
  font-size: 13px;
  color: #38a169;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}
.btn-primary {
  background: #1e3a5f;
  color: #fff;
}
.btn-primary:hover { background: #2c5282; }
.btn-outline {
  background: #fff;
  border-color: #e2e8f0;
  color: #4a5568;
}
.btn-outline:hover { border-color: #2c5282; color: #2c5282; }
.btn-danger {
  background: #fff;
  border-color: #fed7d7;
  color: #c53030;
}
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-icon {
  width: 28px; height: 28px; padding: 0;
  justify-content: center; border-radius: 6px;
  color: #a0aec0; border-color: transparent;
}
.btn-icon:hover { color: #c53030; background: #fff5f5; }

/* Product list cards */
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-empty {
  text-align: center; padding: 40px;
  color: #a0aec0; font-size: 15px;
}

.admin-card {
  display: flex;
  gap: 14px;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  align-items: center;
}
.admin-card-img {
  width: 72px; height: 72px;
  border-radius: 8px; overflow: hidden;
  background: #edf2f7; flex-shrink: 0;
}
.admin-card-img img {
  width: 100%; height: 100%; object-fit: cover;
}
.admin-card-body { flex: 1; min-width: 0; }
.admin-card-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
}
.admin-card-school { font-size: 12px; color: #718096; }
.admin-card-title {
  font-size: 15px; font-weight: 600; color: #1a202c;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 6px;
}
.admin-card-meta {
  display: flex; gap: 14px; font-size: 12px; color: #a0aec0;
}
.admin-card-actions {
  display: flex; gap: 8px; flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 200; padding-top: 40px; overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 90%; max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalIn 0.2s ease;
}
.modal-wide { max-width: 620px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3 { font-size: 18px; margin-bottom: 8px; color: #1a202c; }
.modal-desc { font-size: 13px; color: #718096; margin-bottom: 12px; }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px;
}

.modal textarea {
  width: 100%; min-height: 180px;
  padding: 12px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 13px; font-family: monospace;
  resize: vertical;
}
.modal textarea:focus { outline: none; border-color: #1e3a5f; }

/* Form */
.form-row {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.form-row-end { align-items: center; }
.form-group { flex: 1; display: flex; flex-direction: column; }
.flex-2 { flex: 2; }
.form-group label, .section-label {
  font-size: 13px; font-weight: 600;
  color: #4a5568; margin-bottom: 6px;
  display: block;
}
.form-group input,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px; font-size: 14px; color: #1a202c;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none; border-color: #1e3a5f;
}
.form-group textarea { resize: vertical; min-height: 56px; font-family: inherit; }

.form-section { margin-bottom: 16px; }
.form-hint { font-size: 12px; color: #a0aec0; display: block; margin-top: 6px; }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: #4a5568; cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: #1e3a5f;
}

/* Image rows */
.image-row, .variant-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.img-input { flex: 1; }
.var-label { flex: 2; }
.var-price { flex: 1; }
.var-sep { color: #a0aec0; font-weight: 600; }

.image-row input, .variant-row input {
  padding: 8px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px; font-size: 14px;
}
.image-row input:focus, .variant-row input:focus {
  outline: none; border-color: #1e3a5f;
}
/* Image Upload */
.image-drop-zone {
  border: 2px dashed #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  min-height: 80px;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.image-drop-zone.dragover {
  border-color: #1e3a5f;
  background: #eef3fa;
}
.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.img-preview-item {
  position: relative;
  width: 80px; height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.img-preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.img-preview-del {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center; justify-content: center;
  border: none; cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.img-preview-item:hover .img-preview-del { opacity: 1; }

.image-add-btn {
  display: flex;
  align-items: center; justify-content: center;
  width: 80px; height: 80px;
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  color: #a0aec0;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.image-add-btn:hover {
  border-color: #2c5282;
  color: #2c5282;
  background: #f7fafc;
}
.form-hint-inline {
  font-weight: 400; font-size: 12px; color: #a0aec0; margin-left: 6px;
}
/* ============================================================
   Detail Page v2 — 封面图 + 详情图竖排
   ============================================================ */

.detail-cover img { width: 100%; height: auto; display: block; border-radius: 8px; }

.detail-images-section {
  background: #fff;
  margin-top: 12px;
  padding: 0 0 16px;
}
.detail-images-label {
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  padding: 18px 16px 12px;
  border-top: 1px solid #edf2f7;
}
.detail-image-item {
  padding: 0 16px 12px;
}
.detail-image-item img { border-radius: 6px;
  width: 100%;
  display: block;
  border-radius: 4px;
}
/* 详情图可拖拽排序 */
.img-preview-item {
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
}
.img-preview-item:active { cursor: grabbing; }
.img-preview-item.drag-over {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px #1e3a5f;
}
.img-preview-item.dragging {
  opacity: 0.5;
}
/* ---- Lightbox ---- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.zoomable { cursor: zoom-in; }
.lightbox-overlay.active ~ * .zoomable { cursor: default; }