:root {
  --bg: #f5f7fb;
  --text: #1f2937;
  --primary: #0f3e8c;
  --secondary: #f0b90b;
  --danger: #b91c1c;
  --muted: #6b7280;
  --card: #ffffff;
  --line: #d9e0ee;
  --body-glow: #e6f0ff;
  --header-grad-1: #08275a;
  --header-grad-2: #114da8;
  --hero-grad-1: #0f3e8c;
  --hero-grad-2: #0a2b64;
  --hero-accent: rgba(167, 223, 255, 0.22);
  --hero-border: rgba(208, 241, 255, 0.28);
  --hero-dot: rgba(210, 240, 255, 0.34);
  --brand-grad-1: rgba(16, 76, 164, 0.97);
  --brand-grad-2: rgba(8, 47, 102, 0.97);
  --brand-accent: rgba(201, 236, 255, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 10%, var(--body-glow), transparent 30%), var(--bg);
}

body.theme-fresh-green {
  --bg: #f2f8f4;
  --text: #1f2b24;
  --primary: #1e6b4d;
  --secondary: #f4b53f;
  --line: #d6e5dc;
  --body-glow: #d9f3e2;
  --header-grad-1: #1f5a40;
  --header-grad-2: #2f8c5f;
  --hero-grad-1: #2e805a;
  --hero-grad-2: #1f5a40;
  --hero-accent: rgba(185, 240, 215, 0.24);
  --hero-border: rgba(191, 238, 215, 0.34);
  --hero-dot: rgba(219, 248, 233, 0.35);
  --brand-grad-1: rgba(37, 125, 83, 0.97);
  --brand-grad-2: rgba(24, 88, 59, 0.97);
  --brand-accent: rgba(213, 246, 226, 0.28);
}

body.theme-warm-gold {
  --bg: #faf6ef;
  --text: #362d1e;
  --primary: #8f4d17;
  --secondary: #f4b53f;
  --line: #eadfcd;
  --body-glow: #ffe8c6;
  --header-grad-1: #8b4c17;
  --header-grad-2: #c67a1d;
  --hero-grad-1: #9c5b1f;
  --hero-grad-2: #6f3f14;
  --hero-accent: rgba(255, 220, 168, 0.25);
  --hero-border: rgba(255, 223, 175, 0.35);
  --hero-dot: rgba(255, 241, 214, 0.4);
  --brand-grad-1: rgba(177, 109, 31, 0.97);
  --brand-grad-2: rgba(117, 67, 20, 0.97);
  --brand-accent: rgba(255, 230, 186, 0.3);
}

body.theme-clean-slate {
  --bg: #f5f7fa;
  --text: #1f2630;
  --primary: #2f4258;
  --secondary: #87a0b8;
  --line: #dbe2ea;
  --body-glow: #e2e9f2;
  --header-grad-1: #2b3a4d;
  --header-grad-2: #455e78;
  --hero-grad-1: #32475d;
  --hero-grad-2: #253748;
  --hero-accent: rgba(189, 208, 230, 0.22);
  --hero-border: rgba(204, 218, 235, 0.3);
  --hero-dot: rgba(219, 229, 241, 0.35);
  --brand-grad-1: rgba(57, 82, 109, 0.97);
  --brand-grad-2: rgba(38, 57, 78, 0.97);
  --brand-accent: rgba(202, 217, 235, 0.28);
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.site-header,
.admin-header {
  background: linear-gradient(120deg, var(--header-grad-1), var(--header-grad-2));
  border-bottom: 4px solid var(--secondary);
  position: relative;
  z-index: 60;
  overflow: visible;
}

.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  position: relative;
  overflow: visible;
}

.brand-logo {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-logo-mark {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  overflow: visible;
}

.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown .nav-link {
  color: #dbeafe;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: max-content;
  width: max-content;
  background: var(--bg);
  color: #111111;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 14px;
  border: 1px solid #cbd5e1;
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.3s;
  z-index: 120;
}

.dropdown-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.nav-dropdown:hover .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s;
}
.nav-dropdown.open .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s;
}
.dropdown-panel:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s;
}

.dropdown-title {
  font-weight: 700;
  color: #111111;
  margin-bottom: 10px;
}

.dropdown-grid {
  display: grid;
  gap: 10px;
}

.dropdown-item {
  position: relative;
}

.dropdown-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #111111;
  font-weight: 700;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
}

.dropdown-category:hover {
  background: #ffffff;
  color: #111111;
}

.dropdown-submenu {
  position: absolute;
  top: -6px;
  left: calc(100% + 8px);
  min-width: max-content;
  width: max-content;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 10px;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.3s;
  max-height: 320px;
  overflow: auto;
  z-index: 130;
}

.dropdown-submenu::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0;
  bottom: 0;
  width: 14px;
}

.dropdown-submenu.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.dropdown-item:hover .dropdown-submenu {
  display: grid;
  gap: 6px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition-delay: 0s;
}
.nav-dropdown.open .dropdown-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition-delay: 0s;
}
.dropdown-submenu:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition-delay: 0s;
}

.dropdown-product {
  text-decoration: none;
  color: #111111;
  padding: 6px 8px;
  border-radius: 8px;
}

.dropdown-product:hover {
  background: #ffffff;
  color: #111111;
}

.dropdown-panel a,
.dropdown-submenu a {
  color: #111111 !important;
}

.nav > a,
.nav > .nav-dropdown > .nav-link,
.admin-link {
  color: #dbeafe;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  position: relative;
  z-index: 10;
}

.nav > a.active,
.nav > a:hover,
.nav > .nav-dropdown > .nav-link:hover,
.admin-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(130deg, var(--hero-grad-1), var(--hero-grad-2)),
    radial-gradient(circle at 18% 24%, var(--hero-accent), transparent 40%);
  color: #fff;
  padding: 68px 0;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hero::before {
  width: min(58vw, 760px);
  height: min(58vw, 760px);
  right: -16%;
  top: -34%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(198, 237, 255, 0.22), rgba(198, 237, 255, 0.05) 46%, transparent 67%);
  border: 1px solid var(--hero-border);
}

.hero::after {
  inset: 0;
  opacity: 0.35;
  background:
    radial-gradient(circle at 12px 12px, var(--hero-dot) 1.5px, transparent 1.5px) 0 0 / 30px 30px,
    linear-gradient(105deg, rgba(255, 255, 255, 0.09), transparent 45%);
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.hero .tag {
  margin: 0;
  display: inline-block;
  background: rgba(240, 185, 11, 0.2);
  color: #ffe9a7;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 12px;
}

.hero h1 {
  margin: 14px 0 10px;
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.hero-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 20px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.section {
  padding: 44px 0;
}

.section-muted {
  background: #eef3ff;
}

.section-sm {
  margin-top: 24px;
}

.grid {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.product-card {
  text-decoration: none;
  color: inherit;
}

.product-subtitle {
  margin: 6px 0 0;
}

.product-image {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: block;
  padding: 0;
  margin-bottom: 10px;
}

.product-image img {
  display: block;
}

.fit-image {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px) !important;
  height: calc(100% - 16px) !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
}

.home-product-image-box {
  aspect-ratio: auto;
  height: 250px;
}

.product-image .img-placeholder {
  height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
}

.detail-image {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(320px, 46vw, 560px);
  padding: 8px;
  margin-bottom: 10px;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.img-placeholder {
  color: var(--muted);
  font-weight: 700;
}

.btn {
  text-decoration: none;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}

.btn-primary {
  background: var(--secondary);
  color: #2b2000;
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid #bfd2ff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.text-page {
  max-width: 900px;
}

.info-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.info-box {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 14px;
}

.detail-grid,
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.product-gallery {
  position: relative;
}

.detail-image img {
  transform-origin: center center;
  transition: transform 0.2s ease;
  cursor: zoom-in;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thumbs img {
  width: 84px;
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: block;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

.thumb-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 2px;
  background: transparent;
  cursor: pointer;
}

.thumb-btn.active {
  border-color: #2a5fbe;
  box-shadow: 0 0 0 2px #d6e6ff;
}

.zoom-controls {
  display: flex;
  gap: 8px;
}

.subtitle {
  color: var(--primary);
  font-weight: 700;
}

.spec-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.chip {
  border: 1px solid #bfd2ff;
  color: #143b82;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="checkbox"] {
  width: auto;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.category-filter {
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.category-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat {
  font-size: 2rem;
  font-weight: 800;
  margin: 8px 0 0;
}

.list {
  margin: 0;
  padding-left: 20px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #e3ecff, #f8fbff);
}

.login-card {
  width: min(460px, 92%);
}

.error {
  color: #b91c1c;
  font-weight: 600;
}

.success {
  color: #166534;
  font-weight: 700;
}

.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  padding: 24px 0;
  text-align: center;
  color: var(--muted);
}

.footer-brand {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-logo-mark {
  width: 22px;
  height: 22px;
}

.brand-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(120deg, var(--brand-grad-1), var(--brand-grad-2)),
    radial-gradient(circle at 82% 18%, var(--brand-accent), transparent 34%);
  color: #fff;
}

.brand-hero::before,
.brand-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.brand-hero::before {
  inset: 0;
  background:
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.22), transparent 26%),
    radial-gradient(circle at 72% 108%, rgba(145, 215, 255, 0.16), transparent 34%);
}

.brand-hero::after {
  width: min(52vw, 640px);
  height: min(52vw, 640px);
  left: -18%;
  bottom: -52%;
  border-radius: 52% 48% 60% 40%;
  border: 1px solid rgba(209, 238, 255, 0.26);
  background:
    linear-gradient(160deg, rgba(208, 239, 255, 0.18), rgba(208, 239, 255, 0.03));
}

.brand-hero .container {
  position: relative;
  z-index: 1;
}

.brand-kicker {
  margin: 0;
  letter-spacing: 1.2px;
  font-size: 0.86rem;
  color: #ffdfa1;
}

.brand-lead {
  max-width: 860px;
  line-height: 1.85;
}

.brand-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.brand-values .info-box {
  background: linear-gradient(180deg, #ffffff, #f7faff);
  border: 1px solid #d6e1f8;
  box-shadow: 0 12px 30px rgba(15, 62, 140, 0.08);
}

.brand-strip {
  margin-top: 18px;
  background: linear-gradient(90deg, #f8fbff, #edf4ff);
  border: 1px solid #d3dff6;
  border-radius: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
}

.strip-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.strip-item strong {
  color: #114da8;
  font-size: 1.1rem;
}

.strip-image {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  object-position: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.strip-item small {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 860px) {
  .hero-grid,
  .detail-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .detail-image {
    height: clamp(260px, 68vw, 420px);
  }

  .home-product-image-box {
    height: 220px;
  }

  .nav-wrap {
    align-items: flex-start;
    padding: 10px 0;
    flex-direction: column;
  }

  .nav {
    width: 100%;
  }

  .admin-link {
    display: none;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-strip {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    width: min(1120px, 95%);
  }

  .section {
    padding: 30px 0;
  }

  .hero {
    padding: 42px 0;
  }

  .hero-actions {
    flex-wrap: wrap;
  }

  .nav {
    overflow: visible;
    flex-wrap: wrap;
    padding-bottom: 0;
  }

  .nav a,
  .admin-link {
    white-space: nowrap;
  }

  .table th,
  .table td {
    padding: 8px;
    font-size: 0.9rem;
  }

  .card {
    padding: 14px;
  }

  .thumbs img {
    width: 68px;
    height: 68px;
  }

  .home-product-image-box {
    height: 190px;
  }

  .category-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .product-subtitle {
    display: none;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-filter .btn {
    width: 100%;
    text-align: center;
  }
}
