﻿:root {
  --ink: #1e2529;
  --muted: #657078;
  --line: #d9dee2;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --brand: #2f6f73;
  --brand-dark: #1d4f52;
  --accent: #cf6d54;
  --shadow: 0 18px 50px rgba(30, 37, 41, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.ghost-button,
.text-button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.site-header {
  min-height: 120px;
  padding: 28px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 130px 110px 130px auto;
  gap: 12px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

label,
.control {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

.view-toggle {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.icon-button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.result-line {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
}

.products {
  display: grid;
  gap: 14px;
}

.products.list-view {
  grid-template-columns: 1fr;
}

.products.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  outline: 0;
}

.list-view .product-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 180px;
}

.list-view .product-card img {
  height: 100%;
  min-height: 180px;
  aspect-ratio: auto;
}

.grid-view .product-card {
  display: flex;
  flex-direction: column;
}

.product-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #edf1f2;
}

.grid-view .product-card img {
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.product-body {
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.product-meta strong {
  color: var(--accent);
}

.product-card h2,
.detail-dialog h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.product-card p,
.detail-dialog p,
.admin-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eaf2ef;
  color: var(--brand-dark);
  font-size: 12px;
}

.pager {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pager span {
  color: var(--muted);
  min-width: 110px;
  text-align: center;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-dialog {
  width: min(860px, calc(100% - 28px));
  border: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(18, 26, 28, 0.55);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  padding: 0;
  border-radius: 50%;
}

#detailContent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 28px;
}

#detailContent img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

#detailContent > div {
  display: grid;
  gap: 14px;
  align-content: center;
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.form-actions,
.admin-list-head {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-list-head {
  margin-top: 0;
  justify-content: space-between;
}

.admin-list-head input {
  max-width: 320px;
}

.admin-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.admin-item {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-item img {
  width: 82px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: #edf1f2;
}

.admin-item small {
  color: var(--muted);
}

.admin-item-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar,
  .form-grid,
  #detailContent {
    grid-template-columns: 1fr;
  }

  .list-view .product-card {
    grid-template-columns: 1fr;
  }

  .admin-item {
    grid-template-columns: 72px 1fr;
  }

  .admin-item-actions {
    grid-column: 1 / -1;
  }
}

.info-boxes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.info-boxes span {
  min-height: 34px;
  padding: 7px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8f7;
  color: var(--brand-dark);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.duration-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.product-card p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-dialog p {
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}

@media (max-width: 760px) {
  .info-boxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.price-stack {
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.price-stack small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.info-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  white-space: nowrap;
}

.info-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-boxes span {
  display: grid;
  gap: 3px;
}

.info-boxes b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

#detailContent img {
  max-height: min(72vh, 720px);
  object-fit: contain;
  background: #f3f5f5;
}

@media (max-width: 760px) {
  .info-line {
    gap: 7px;
    font-size: 11px;
  }

  #detailContent img {
    max-height: 62vh;
  }
}


@media (max-width: 760px) {
  .list-view .product-card img {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
}



/* ===== Enhanced Styles ===== */

/* Card image wrapper with number badge */
.card-img-wrap {
  position: relative;
  overflow: hidden;
}

.card-num-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(30, 37, 41, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  line-height: 1;
}

/* Card hover enhancement */
.product-card {
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.product-card:hover {
  border-color: var(--brand);
}

/* Grid view number badge adjustment */
.grid-view .card-num-badge {
  top: 8px;
  left: 8px;
  font-size: 10px;
  padding: 3px 8px;
}

/* Price emphasis */
.price-stack strong {
  font-size: 1.15em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Tag color refresh */
.tag {
  background: linear-gradient(135deg, #eaf2ef 0%, #dce8e4 100%);
  font-weight: 500;
  transition: background 160ms ease;
}

.tag:hover {
  background: linear-gradient(135deg, #d0e0da 0%, #c2d8d0 100%);
}

/* Detail dialog enhancements */
.detail-dialog {
  border-radius: 14px;
  overflow: hidden;
}

.detail-dialog::backdrop {
  background: rgba(18, 26, 28, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dialog-close {
  top: 14px;
  right: 14px;
  z-index: 10;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--line);
  font-size: 18px;
  transition: background 160ms ease;
}

.dialog-close:hover {
  background: #fff;
}

#detailContent {
  padding: 0;
  gap: 0;
}

.detail-img-wrap {
  background: #f3f5f5;
  display: grid;
  place-items: center;
  padding: 0;
}

.detail-img-wrap img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 0;
}

.detail-info {
  padding: 28px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.detail-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border-radius: 12px;
  flex-shrink: 0;
}

.detail-header h2 {
  font-size: 24px;
  margin: 0 0 6px;
}

.detail-header .product-meta {
  font-size: 13px;
}

/* Detail info boxes */
#detailContent .info-boxes {
  margin-top: 2px;
}

#detailContent .info-boxes span {
  background: #f6f8f7;
  font-size: 13px;
  min-height: 40px;
}

/* Detail description */
#detailContent p {
  max-height: 260px;
  line-height: 1.8;
  font-size: 14px;
  color: #4a5559;
}

/* Header refinement */
.site-header {
  background: linear-gradient(135deg, #ffffff 0%, #fbfaf6 100%);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* Toolbar refinement */
.toolbar {
  background: #fff;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

/* Result line */
.result-line {
  min-height: 44px;
  margin-bottom: 4px;
}

/* Pager buttons */
.pager button {
  border-radius: 8px;
  font-weight: 500;
  min-width: 70px;
  transition: background 160ms ease, border-color 160ms ease;
}

.pager button:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

/* Empty state */
.empty-state {
  border-radius: 12px;
  font-size: 15px;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 760px) {
  .detail-header {
    flex-direction: column;
    gap: 10px;
  }

  .detail-num {
    min-width: 44px;
    height: 44px;
    font-size: 16px;
    border-radius: 10px;
  }

  .detail-info {
    padding: 20px;
  }
}


/* Theme switcher */
.theme-switcher {
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  max-width: 180px;
}
