:root {
  --primary: #f16b8a;
  --primary-dark: #e14e72;
  --bg: #f7f8fb;
  --text: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #eceef3;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-inner-shop {
  min-height: 70px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}

.topbar-search {
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.brand-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.brand-logo {
  height: 40px;
  width: auto;
  max-width: min(220px, 52vw);
  object-fit: contain;
  display: block;
}

.brand-mark {
  background: #ffe4ec;
  color: var(--primary-dark);
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  font-size: 18px;
}

.brand h1 {
  font-size: 1.2rem;
  margin: 0;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.top-nav a {
  text-decoration: none;
  color: #374151;
  font-size: 0.95rem;
}

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

.hero {
  background: linear-gradient(135deg, #fff6f8, #fff);
  padding: 36px 0;
  border-bottom: 1px solid var(--border);
}

.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
}

.hero p {
  margin: 0 0 20px;
  color: var(--muted);
}

.search-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(120px, 1fr)) auto;
  gap: 10px;
}

.search-panel input,
.search-panel select,
.search-panel button {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 0.95rem;
}

.search-panel input,
.search-panel select {
  padding: 0 12px;
  background: #fff;
}

.search-panel button {
  border: 0;
  color: #fff;
  padding: 0 18px;
  background: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.search-panel button:hover {
  background: var(--primary-dark);
}

.shop-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.shop-card-link:hover {
  border-color: #f7a0b3;
}

.main-content {
  padding: 28px 0 48px;
}

.admin-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.admin-panel h2 {
  margin: 0 0 8px;
}

.admin-note {
  margin: 0 0 14px;
  color: var(--muted);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-form button {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
  padding: 10px 12px;
}

.admin-form textarea {
  resize: vertical;
}

.admin-form button {
  background: var(--primary);
  color: #fff;
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

.admin-status {
  margin: 12px 0 0;
  font-weight: 700;
}

.admin-preview {
  margin-top: 12px;
  width: min(100%, 320px);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  display: block;
}

.auth-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 22px;
  max-width: 440px;
  margin: 0 auto;
}

.auth-panel h2 {
  margin: 0 0 8px;
}

.auth-status {
  min-height: 1.5em;
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-form-hidden {
  display: none !important;
}

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: #3c4043;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.28);
}

.btn-google-icon {
  display: inline-flex;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px 14px;
  border: 0;
  background: #f9fafb;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.auth-tab.is-active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: inset 0 -2px 0 var(--primary);
}

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

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

.auth-form input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
  padding: 10px 12px;
}

.btn-primary-wide {
  margin-top: 4px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary-wide:hover {
  background: var(--primary-dark);
}

.auth-logged-in {
  text-align: left;
}

.auth-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.auth-user-photo {
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
}

.auth-user-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.auth-user-email {
  margin: 4px 0 0;
  font-weight: 700;
  word-break: break-all;
}

.auth-logged-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-danger-outline:hover {
  border-color: #fecaca;
  color: #b91c1c;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.result-head h3 {
  margin: 0;
  font-size: 1.25rem;
}

.result-head p {
  margin: 0;
  color: var(--muted);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* 首頁無限捲動：列表底部偵測用（不可見佔位） */
.shop-list-sentinel {
  width: 100%;
  height: 1px;
  margin-top: 8px;
  pointer-events: none;
  visibility: hidden;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.shop-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.shop-detail-head-title {
  color: var(--muted);
  font-weight: 700;
  flex: 1;
  text-align: center;
  min-width: 100px;
}

.shop-head-actions {
  flex-shrink: 0;
  margin-left: auto;
}

.shop-head-actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.shop-head-actions-logged .shop-head-name {
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-head-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.shop-head-avatar-placeholder {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 1rem;
}

.btn-sm {
  padding: 8px 12px !important;
  font-size: 0.88rem !important;
  border-radius: 10px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.shop-rating-summary {
  margin: 10px 0 12px;
}

.shop-avg-rating {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.stars-display {
  letter-spacing: 2px;
  color: #f59e0b;
  font-size: 1.15rem;
}

.star-on {
  color: #f59e0b;
}

.star-off {
  color: #d1d5db;
}

.shop-avg-num {
  color: var(--text);
  font-size: 1.25rem;
}

.shop-reviews-section {
  margin-top: 28px;
}

.shop-reviews-title {
  margin: 0 0 14px;
  font-size: 1.15rem;
}

.shop-reviews-empty {
  margin: 0;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.review-card-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.review-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.review-name-row {
  font-weight: 700;
  font-size: 0.98rem;
}

.review-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: #fff1f5;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.review-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.review-comment {
  margin: 10px 0 0;
  line-height: 1.55;
  color: #374151;
  font-size: 0.95rem;
}

.review-photo-wrap {
  margin-top: 10px;
}

.review-photo {
  max-width: min(100%, 360px);
  max-height: 280px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.star-rating-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 12px;
}

.star-rating-btn {
  min-width: 2.25rem;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9fafb;
  font: inherit;
  cursor: pointer;
  color: #6b7280;
}

.star-rating-btn.is-active {
  border-color: var(--primary);
  background: #fff1f5;
  color: var(--primary-dark);
  font-weight: 700;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  pointer-events: auto;
}

.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, 92vw);
  max-height: min(88vh, 640px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

.modal-body {
  padding: 16px;
}

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

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

.modal-form input[type="text"],
.modal-form input[type="email"],
.modal-form textarea {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
  padding: 10px 12px;
}

.modal-label {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
}

.modal-status {
  min-height: 1.25em;
  font-size: 0.88rem;
  font-weight: 600;
}

.modal-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-avatar-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.review-modal-thumb {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
  margin-top: 8px;
}

.back-link {
  text-decoration: none;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.95rem;
  background: #fff1f5;
  border: 1px solid #ffd4e0;
  padding: 8px 12px;
  border-radius: 999px;
}

.back-link:hover {
  background: #ffe7ee;
}

.shop-detail {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.shop-detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

.detail-cover {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.detail-cover img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.detail-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-title {
  margin: 0;
  font-size: 1.6rem;
  flex: 1 1 auto;
  min-width: 0;
}

.detail-meta {
  margin: 12px 0 0;
  color: #4b5563;
  font-size: 0.98rem;
}

.detail-info-list {
  margin-top: 12px;
}

.detail-info-list .shop-field {
  margin: 6px 0 0;
  font-size: 0.98rem;
}

.detail-desc {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.shop-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}

.cover-wrap {
  position: relative;
}

.cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  background: rgba(17, 24, 39, 0.75);
  color: #fff;
  font-size: 0.76rem;
  padding: 4px 8px;
  border-radius: 999px;
}

.shop-content {
  padding: 14px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-card .shop-card-title-row {
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.name {
  margin: 0;
  font-size: 1.05rem;
}

.shop-card .name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.25;
}

.shop-card .star-display {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.shop-card .star-display .stars-display {
  font-size: 0.92rem;
  letter-spacing: 1px;
}

.shop-card .star-display .star-on {
  color: #f59e0b;
}

.shop-card .star-display .star-off {
  color: #d1d5db;
}

.shop-card .tag {
  color: #6b7280;
}

.shop-field,
.desc {
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.shop-field {
  color: #4b5563;
}

.money-circle-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: text-bottom;
  margin: 0 4px 0 2px;
}

.desc {
  color: var(--muted);
  min-height: 42px;
}

.shortdesc {
  margin: 8px 0 0;
  font-size: 0.92rem;
  color: #374151;
  line-height: 1.45;
}

.detail-shortdesc {
  margin: 12px 0 0;
  color: #374151;
  line-height: 1.55;
  font-size: 0.98rem;
}

.tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags span {
  font-size: 0.76rem;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 4px 8px;
}

.empty {
  background: #fff;
  border: 1px dashed #d1d5db;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
  padding: 16px 0;
  text-align: center;
}

@media (max-width: 960px) {
  .search-panel {
    grid-template-columns: 1fr 1fr;
  }

  .search-panel button {
    grid-column: 1 / -1;
  }

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

  .admin-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 0;
  }

  .topbar-inner-shop {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 0;
  }

  .topbar-search {
    width: 100%;
    justify-content: flex-start;
  }

  .top-nav {
    overflow-x: auto;
    width: 100%;
    padding-bottom: 6px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .shop-detail-grid {
    grid-template-columns: 1fr;
  }
}
