/* Used Equipment System — Frontend Styles (matching FH Studio brand) */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700&family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --card-hover: #fafaf9;
  --border: #e8e6e1;
  --border-light: #f1f0ed;
  --input-bg: #fafaf8;
  --text: #1a1a1a;
  --text2: #666666;
  --text3: #999999;
  --brand: #c42b2b;
  --brand-light: rgba(196,43,43,0.06);
  --brand-border: rgba(196,43,43,0.15);
  --success: #16a34a;
  --success-bg: rgba(22,163,74,0.06);
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans TC', 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ========== Layout ========== */

.site-header {
  background: #ffffff;
  color: #333;
  padding: 16px 0;
  border-bottom: 1px solid #eee;
}
.site-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.site-logo span { color: var(--brand); }
.site-nav { display: flex; gap: 24px; }
.site-nav a {
  color: #666;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.site-nav a:hover { color: #fff; }

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ========== Page Header ========== */

.page-header {
  margin-bottom: 36px;
}
.page-header-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.page-header-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.3;
}
.page-header-title span { color: var(--brand); }
.page-header-line {
  width: 40px;
  height: 3px;
  background: var(--brand);
  border-radius: 2px;
  margin-top: 12px;
}
.page-header-desc {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text2);
  line-height: 1.8;
}

/* ========== Toolbar ========== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Noto Sans TC', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(196,43,43,0.08);
}
.search-box input::placeholder { color: var(--text3); }
.search-box .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 14px;
  pointer-events: none;
}

/* ========== Toolbar Controls ========== */

.sort-select select,
.brand-filter select {
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Noto Sans TC', sans-serif;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.sort-select select:focus,
.brand-filter select:focus {
  border-color: var(--brand);
}

.sold-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
  user-select: none;
}
.sold-toggle:hover { border-color: var(--text3); }
.sold-toggle input { accent-color: var(--brand); }
.sold-toggle:has(input:disabled) { opacity: 0.5; cursor: default; }

/* ========== LINE Button ========== */

.eq-card-line-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  background: #06C755;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.eq-card-line-btn:hover {
  background: #05b34c;
  transform: translateY(-1px);
}

/* ========== Category Tabs ========== */

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: wrap;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text2);
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover {
  background: var(--card);
  color: var(--text);
}
.tab-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.tab-btn .count {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 5px;
}
.tab-btn.active .count {
  background: rgba(255,255,255,0.2);
}

/* ========== Equipment Cards ========== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.eq-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  position: relative;
}
.eq-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.eq-card:hover {
  transform: translateY(-2px);
  border-color: #d5d3ce;
  box-shadow: var(--shadow-lg);
}
.eq-card:hover::before { transform: scaleX(1); }

.eq-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: var(--border-light);
}
.eq-card-img-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-light);
  color: var(--text3);
  font-size: 48px;
}

.eq-card-body {
  padding: 20px;
}

.eq-card-category {
  font-size: 10px;
  color: var(--text3);
  font-family: 'DM Sans', sans-serif;
  background: #f3f2ef;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-weight: 600;
}

.eq-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.4;
}

.eq-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.eq-card-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.eq-card-label {
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  min-width: 48px;
  flex-shrink: 0;
}
.eq-card-value {
  color: var(--text2);
}

/* ========== Price Drop ========== */

.eq-card.price-drop {
  border-color: var(--brand-border);
  box-shadow: 0 2px 8px rgba(196,43,43,0.08);
}
.eq-card.price-drop::before {
  transform: scaleX(1);
  background: linear-gradient(90deg, var(--brand), #e85d5d);
}

.eq-card-ribbon {
  position: absolute;
  top: 14px;
  left: -6px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px 4px 10px;
  border-radius: 0 6px 6px 0;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(196,43,43,0.3);
  letter-spacing: 0.5px;
}
.eq-card-ribbon::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 6px;
  height: 6px;
  background: #8b1a1a;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.eq-card-drop-badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.eq-card-original-price {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text3);
  font-family: 'DM Sans', 'Noto Sans TC', sans-serif;
}
.eq-card-original-price del {
  text-decoration: line-through;
}

.eq-card-price {
  font-size: 20px;
  font-weight: 900;
  color: var(--brand);
  margin-top: 4px;
  font-family: 'DM Sans', 'Noto Sans TC', sans-serif;
}
.eq-card:not(.price-drop) .eq-card-price {
  margin-top: 12px;
}

.eq-card-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
  line-height: 1.5;
}

.eq-card-date {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sold badge overlay */
.eq-card.sold { opacity: 0.65; }
.eq-card.sold::after {
  content: '已售出';
  position: absolute;
  top: 20px;
  right: -32px;
  background: var(--danger);
  color: #fff;
  padding: 4px 40px;
  font-size: 12px;
  font-weight: 700;
  transform: rotate(45deg);
  z-index: 3;
}
.eq-card.sold .eq-card-line-btn { display: none; }

/* ========== Contact Section ========== */

.contact-section {
  margin-top: 48px;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.contact-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.contact-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-light);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.contact-info {
  font-size: 13px;
}
.contact-info .label {
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.contact-info .value {
  color: var(--text);
  font-weight: 500;
}
.contact-info a {
  color: var(--brand);
  text-decoration: none;
}
.contact-info a:hover { text-decoration: underline; }

/* ========== Stats Bar ========== */

.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  padding: 6px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.stat-item strong {
  color: var(--brand);
  font-family: 'DM Sans', sans-serif;
}

/* ========== Empty State ========== */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text3);
  grid-column: 1 / -1;
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 14px;
}

/* ========== Loading ========== */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text3);
  grid-column: 1 / -1;
}
.loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Image Count Badge ========== */

.eq-card-img-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--border-light);
  overflow: hidden;
}
.eq-card-img-wrap .eq-card-img {
  height: 100%;
}
.eq-card-img-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
}

/* ========== Lightbox ========== */

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox-overlay.show { display: flex; }

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  z-index: 10;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 8px;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  padding: 0 60px;
  flex: 1;
}

.lightbox-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-height: 80vh;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-arrow:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-dots {
  display: flex;
  gap: 8px;
  padding: 16px;
  justify-content: center;
}

.lightbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-dot.active { background: #fff; }
.lightbox-dot:hover { background: rgba(255,255,255,0.6); }

.lightbox-counter {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  padding-bottom: 16px;
  text-align: center;
}

/* ========== Footer ========== */

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text3);
  border-top: 1px solid var(--border);
}
.site-footer a {
  color: var(--brand);
  text-decoration: none;
}

/* ========== Sold Badge ========== */
.eq-card-sold-badge {
  text-align: center;
  padding: 8px;
  background: #f5f5f5;
  color: #999;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  margin-top: 8px;
}

/* ========== Company Intro ========== */
.company-intro {
  text-align: center;
  padding: 16px 24px;
  margin-bottom: 16px;
  background: var(--bg2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.company-intro p {
  color: var(--text2);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

/* ========== Recent Sold Hint ========== */
.recent-sold-hint {
  text-align: center;
  padding: 8px 16px;
  margin-bottom: 16px;
  background: #fef3cd;
  color: #856404;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* ========== Purchase Info ========== */
.purchase-info {
  margin: 32px 0;
  padding: 24px;
  background: var(--bg2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.purchase-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.purchase-info-item {
  text-align: center;
}
.purchase-info-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.purchase-info-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text1);
  margin-bottom: 6px;
}
.purchase-info-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

/* ========== Product Detail Modal ========== */
.product-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.product-modal-overlay.active {
  display: flex;
}
.product-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 32px;
}
.product-modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
  z-index: 10;
}
.product-modal-close:hover { color: #000; }
.product-modal h2 {
  font-size: 20px;
  margin: 0 0 4px 0;
  color: var(--text1);
}
.product-modal .modal-category {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 16px;
}
.product-modal .modal-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f8f8;
  margin-bottom: 16px;
}
.product-modal .modal-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 16px;
}
.product-modal .modal-spec-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.product-modal .modal-spec-label { color: var(--text3); }
.product-modal .modal-spec-value { font-weight: 500; color: var(--text1); }
.product-modal .modal-desc {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f8f8;
  border-radius: 6px;
}
.product-modal .modal-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 16px;
}
.product-modal .modal-price .original {
  font-size: 14px;
  color: var(--text3);
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 8px;
}
.product-modal .modal-actions {
  display: flex;
  gap: 12px;
}
.product-modal .modal-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: block;
}
.product-modal .modal-btn-line {
  background: #06c755;
  color: #fff;
}
.product-modal .modal-btn-phone {
  background: var(--bg2);
  color: var(--text1);
  border: 1px solid var(--border);
}
.product-modal .modal-similar {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.product-modal .modal-similar h4 {
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 8px;
}
.product-modal .modal-similar-items {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.product-modal .similar-item {
  min-width: 120px;
  padding: 8px;
  background: #f8f8f8;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
}
.product-modal .similar-item:hover { background: #eee; }
.product-modal .similar-item-name { font-weight: 500; margin-bottom: 4px; }
.product-modal .similar-item-price { color: var(--brand); font-weight: 600; }

/* ========== Responsive ========== */

@media (max-width: 768px) {
  .app { padding: 24px 16px 48px; }
  .site-header .container { padding: 0 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 8px; }
  .page-header-title { font-size: 26px; }
  .contact-grid { grid-template-columns: 1fr; }
  .purchase-info-grid { grid-template-columns: 1fr; }
  .eq-card-img, .eq-card-img-placeholder { height: 160px; }
  .product-modal { padding: 20px; margin: 10px; }
  .product-modal .modal-specs { grid-template-columns: 1fr; }
  .product-modal .modal-actions { flex-direction: column; }
}

@media (max-width: 480px) {
  .page-header-title { font-size: 22px; }
  .tab-bar { gap: 4px; }
  .tab-btn { padding: 6px 12px; font-size: 12px; }
}
