
:root {
  --bg-1: #f8f5f2;
  --bg-2: #e9f0f7;
  --bg-3: #f4eaf1;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.35);
  --text: #2c2b2d;
  --muted: #6c6870;
  --accent: #b49acb;
  --accent-2: #91a8d0;
  --shadow: 0 20px 50px rgba(33, 33, 40, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

/* Hide scrollbar but keep scroll functionality */
html {
  scrollbar-width: none; /* Firefox */
}

html::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
  font-size: 18px;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-2), transparent 60%),
    radial-gradient(circle at 10% 20%, var(--bg-3), transparent 55%),
    linear-gradient(140deg, var(--bg-1), #fefefe 65%);
}

h1,
h2,
h3,
h4 {
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
  margin: 0;
}

p {
  margin: 0;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 5vw;
  background: var(--glass-strong);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 24px rgba(33, 33, 40, 0.08);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 5vw 36px;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 43, 45, 0.35);
  backdrop-filter: blur(8px);
}

.admin-modal {
  position: relative;
  width: 360px;
  max-width: 90vw;
  padding: 36px 32px 28px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(33, 33, 40, 0.22);
  backdrop-filter: blur(20px);
  text-align: center;
}

.admin-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1;
  transition: color 0.2s ease;
}

.admin-modal-close:hover {
  color: var(--text);
  transform: none;
}

.admin-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  margin-bottom: 16px;
}

.admin-modal h3 {
  font-size: 22px;
  margin-bottom: 6px;
}

.admin-modal-hint {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 20px;
}

.admin-modal-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
  font-size: 18px;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 154, 203, 0.18);
}

.admin-modal-error {
  font-size: 15px;
  color: #d4566a;
  margin-top: 8px;
}

.admin-modal-btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 17px;
}

.admin-modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.modal-enter-active,
.modal-leave-active {
  transition: opacity 0.25s ease;
}

.modal-enter-active .admin-modal,
.modal-leave-active .admin-modal {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.modal-enter-from,
.modal-leave-to {
  opacity: 0;
}

.modal-enter-from .admin-modal {
  transform: scale(0.92) translateY(10px);
  opacity: 0;
}

.modal-leave-to .admin-modal {
  transform: scale(0.95);
  opacity: 0;
}

.brand h1 {
  font-size: 28px;
  letter-spacing: 1px;
}

.brand p {
  color: var(--muted);
  font-size: 16px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: var(--glass-strong);
  box-shadow: 0 12px 24px rgba(33, 33, 40, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s ease;
}

.user-badge:hover {
  background: rgba(255, 255, 255, 0.85);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.user-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 15px;
  font-weight: 600;
}

.user-name {
  font-size: 17px;
  color: var(--text);
  font-weight: 700;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  text-decoration: none;
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
  font-size: 17px;
  box-shadow: 0 10px 30px rgba(145, 168, 208, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
  transform: translateY(-1px);
}

button {
  border: none;
  cursor: pointer;
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
  padding: 10px 18px;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 10px 30px rgba(145, 168, 208, 0.35);
}

button.ghost {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
}

.main-content {
  flex: 1;
  padding: 28px 0;
  min-height: 0;
}

.footer {
  margin-top: 12px;
  padding: 24px 26px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: 0 -4px 30px rgba(33, 33, 40, 0.06);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

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

.footer-logo {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(33, 33, 40, 0.1);
}

.footer-title {
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
}

.footer-divider {
  width: 40px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.5;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-mail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 5px;
  background: rgba(145, 168, 208, 0.08);
  transition: background 0.2s ease, color 0.2s ease;
}

.footer-mail:hover {
  background: rgba(145, 168, 208, 0.18);
  color: var(--text);
}

.footer-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 5px;
  background: rgba(180, 154, 203, 0.08);
}

.footer-stat-visit {
  color: var(--accent-2);
  background: rgba(145, 168, 208, 0.08);
}

.footer-copy {
  font-size: 14px;
  color: var(--muted);
  opacity: 0.7;
  letter-spacing: 0.3px;
}

.page-card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(33, 33, 40, 0.1);
  height: 100%;
}

.product-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 6px;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.product-price {
  font-weight: 600;
  color: var(--accent-2);
}

.product-actions {
  margin-top: 12px;
}

.secondary-link {
  display: inline-flex;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  font-size: 15px;
  transition: background 0.2s ease;
}

.secondary-link:hover {
  background: rgba(255, 255, 255, 0.85);
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

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

.detail-image {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 10px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.buy-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 12px 22px;
  border-radius: 8px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-field input,
.form-field textarea {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 10px 12px;
  font-family: 'KaiTi', 'STKaiti', '楷体', '楷体_GB2312', serif;
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}

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

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

.table th,
.table td {
  text-align: left;
  padding: 12px;
  font-size: 16px;
}

.table tr {
  border-bottom: 1px solid var(--line);
}

.tag {
  font-size: 14px;
  color: var(--muted);
}

.markdown {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

@media (max-width: 900px) {
  .app-body {
    padding: 12px 2vw 20px;
  }

  /* ── Navigation: keep everything on one row, compress ── */
  .top-bar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 8px 3vw;
    gap: 6px;
  }

  .brand {
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .brand h1 {
    font-size: 16px;
    white-space: nowrap;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .top-actions {
    gap: 3px;
    flex-shrink: 0;
    overflow: hidden;
  }

  /* Compress nav buttons on mobile */
  button.ghost {
    font-size: 12px;
    font-weight: 700;
    padding: 5px 7px;
    white-space: nowrap;
  }

  .login-btn {
    font-size: 12px;
    padding: 5px 8px;
    white-space: nowrap;
  }

  .user-badge {
    padding: 3px 6px 3px 4px;
    gap: 4px;
  }

  .user-name {
    font-size: 12px;
    max-width: 50px;
  }

  .user-avatar {
    width: 20px;
    height: 20px;
  }

  .wishlist-icon {
    font-size: 12px;
  }

  .wishlist-badge {
    min-width: 14px;
    height: 14px;
    font-size: 9px;
  }

  /* ── Product grid: tighter ── */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 2px;
  }

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

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

  .detail-image {
    height: 240px;
  }

  .footer {
    padding: 20px 14px;
  }

  .footer-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
  }

  .page-card {
    padding: 14px;
  }

  .product-card {
    padding: 10px 8px;
  }

  .product-card img {
    height: 110px;
  }

  .markdown {
    -webkit-line-clamp: 2;
  }
}

/* ── Wishlist navigation ── */
.wishlist-nav {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wishlist-icon {
  font-size: 15px;
}

.wishlist-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* PWA update toast */
.pwa-update-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 24px;
  background: #1a1a1a;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  white-space: nowrap;
}

.pwa-update-toast button {
  background: #4ade80;
  color: #111;
  border: none;
  border-radius: 12px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pwa-toast-enter-active,
.pwa-toast-leave-active {
  transition: opacity 0.3s, transform 0.3s;
}

.pwa-toast-enter-from,
.pwa-toast-leave-to {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
}
