:root {
  --cream: #FDF8F2;
  --warm-white: #FFFCF8;
  --peach: #F9E8D8;
  --rose: #F2C4B0;
  --terracotta: #D4785A;
  --deep-rose: #C05A42;
  --brown: #8B5E4A;
  --warm-gray: #9C8B7E;
  --text-dark: #3D2B1F;
  --text-mid: #6B4F3F;
  --text-light: #A08070;
  --sage: #8FAF8A;
  --light-sage: #D6E8D3;
  --teal: #5A9B8E;
  --gold: #C8963A;
  --light-gold: #F5E4C0;
  --border: #E8D5C4;
  --shadow: rgba(140, 80, 50, 0.12);
}

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

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

/* ===== NAV ===== */
nav {
  background: var(--warm-white);
  border-bottom: 1.5px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Noto Serif TC', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--terracotta);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--peach), var(--rose));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.nav-links { display: flex; gap: 4px; align-items: center; }

.nav-btn {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-mid);
  transition: all 0.2s;
  font-family: 'Noto Sans TC', sans-serif;
}

.nav-btn:hover { background: var(--peach); color: var(--terracotta); }
.nav-btn.active { background: var(--terracotta); color: white; }
.nav-btn.outline { border: 1.5px solid var(--terracotta); color: var(--terracotta); }
.nav-btn.outline:hover { background: var(--terracotta); color: white; }

.nav-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  padding: 7px 10px;
  background: var(--peach);
  border-radius: 20px;
  align-items: center;
  white-space: nowrap;
}

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(160deg, var(--warm-white) 0%, var(--peach) 60%, var(--rose) 100%);
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(242,196,176,0.4) 0%, transparent 70%);
  top: -50px; right: -50px;
  border-radius: 50%;
}

.hero-tag {
  display: inline-block;
  background: var(--light-sage);
  color: #3D6B38;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 1.2rem;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-family: 'Noto Serif TC', serif;
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.hero h1 span { color: var(--terracotta); }

.hero p {
  font-size: 15px;
  color: var(--text-mid);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.8;
}

.hero-cats {
  font-size: 48px;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.hero-cat { animation: float 3s ease-in-out infinite; display: inline-block; }
.hero-cat:nth-child(2) { animation-delay: 0.5s; }
.hero-cat:nth-child(3) { animation-delay: 1s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--terracotta);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  font-family: 'Noto Sans TC', sans-serif;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 16px rgba(212, 120, 90, 0.35);
}

.btn-primary:hover { background: var(--deep-rose); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212,120,90,0.4); }
.btn-full { width: 100%; }

.btn-secondary {
  background: white;
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
  padding: 12px 28px;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  font-family: 'Noto Sans TC', sans-serif;
}

.btn-secondary:hover { background: var(--peach); transform: translateY(-2px); }
.btn-sm-text { white-space: nowrap; padding: 8px 14px; font-size: 12px; }

.btn-sm {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: 'Noto Sans TC', sans-serif;
  transition: all 0.2s;
}

.btn-sm.primary { background: var(--terracotta); color: white; }
.btn-sm.primary:hover { background: var(--deep-rose); }
.btn-sm.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-mid); }
.btn-sm.ghost:hover { background: var(--peach); border-color: var(--rose); color: var(--terracotta); }
.btn-sm.danger { background: transparent; border: 1px solid var(--rose); color: var(--deep-rose); }

/* ===== STATS ===== */
.stats-bar {
  background: white;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 1.5rem;
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-num { font-family: 'Noto Serif TC', serif; font-size: 22px; font-weight: 700; color: var(--terracotta); }
.stat-label { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ===== SECTION ===== */
.section { padding: 3rem 1.5rem; max-width: 900px; margin: 0 auto; }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 2rem;
}

.section-title {
  font-family: 'Noto Serif TC', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-sub { font-size: 13px; color: var(--text-light); margin-bottom: 0; }

/* ===== INFO CARDS ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.info-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
}

.info-card-icon { font-size: 32px; margin-bottom: 10px; }
.info-card-title { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.info-card-desc { font-size: 12px; color: var(--text-light); line-height: 1.7; }

/* ===== MY CIRCLES ===== */
.my-circles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.my-circle-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
  transition: all 0.25s;
}

.my-circle-card:hover { box-shadow: 0 6px 20px var(--shadow); }

.circle-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.circle-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.circle-name { font-weight: 700; font-size: 14px; color: var(--text-dark); }
.circle-owner-label { font-size: 12px; color: var(--text-light); }

.tag {
  background: var(--peach);
  color: var(--brown);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.tag.sage { background: var(--light-sage); color: #3D6B38; }
.tag.gold { background: var(--light-gold); color: #7A5A18; }
.tag.owner { background: #E8D5F0; color: #6B3E8C; }
.tag.ml-auto { margin-left: auto; }

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

.members-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.member-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--peach);
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--terracotta);
  font-weight: 700;
}

.member-dot.empty {
  background: var(--cream);
  border: 1.5px dashed var(--border);
  color: var(--text-light);
  font-size: 14px;
}

.member-count { font-size: 12px; color: var(--text-light); margin-left: 4px; }

.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--terracotta), var(--rose)); border-radius: 3px; transition: width 0.3s; }

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

/* ===== LOCKED STATE ===== */
.locked-state {
  background: white;
  border: 1.5px dashed var(--border);
  border-radius: 20px;
  padding: 3rem 2rem;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.locked-icon { font-size: 52px; margin-bottom: 1rem; }
.locked-title { font-family: 'Noto Serif TC', serif; font-size: 18px; font-weight: 700; color: var(--text-dark); margin-bottom: 0.6rem; }
.locked-desc { font-size: 13px; color: var(--text-light); line-height: 1.9; margin-bottom: 1.5rem; }

.locked-steps {
  text-align: left;
  background: var(--cream);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}

.locked-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
}

.locked-step:last-child { margin-bottom: 0; }

.step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--terracotta);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.circle-count-info { font-size: 12px; color: var(--text-light); }
.circle-count-info strong { color: var(--terracotta); }

/* ===== CAT GALLERY ===== */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-select { width: auto; min-width: 120px; font-size: 13px; padding: 7px 30px 7px 12px; }

.cat-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }

.cat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.25s;
}

.cat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px var(--shadow); }

.cat-img {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
}

.cat-info { padding: 10px 12px; }
.cat-name { font-weight: 700; font-size: 13px; color: var(--text-dark); margin-bottom: 4px; }
.cat-detail { font-size: 11px; color: var(--text-light); line-height: 1.5; }

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
  margin-right: 3px;
  margin-top: 4px;
  font-weight: 500;
}

.badge.neutered { background: var(--light-sage); color: #3D6B38; }
.badge.unneutered { background: var(--light-gold); color: #7A5A18; }
.badge.tnr { background: #E8D5F0; color: #6B3E8C; }

/* ===== SHOP ===== */
.shop-hero {
  background: linear-gradient(135deg, var(--peach), var(--light-gold));
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.shop-title { font-family: 'Noto Serif TC', serif; font-size: 24px; font-weight: 700; color: var(--text-dark); margin-bottom: 0.5rem; }
.shop-sub { font-size: 13px; color: var(--text-mid); }

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

.product-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
}

.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px var(--shadow); }

.product-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--peach);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.product-info { padding: 12px; }
.product-name { font-weight: 700; font-size: 13px; color: var(--text-dark); margin-bottom: 4px; }
.product-desc { font-size: 11px; color: var(--text-light); margin-bottom: 8px; line-height: 1.5; }
.product-price { font-size: 16px; font-weight: 700; color: var(--terracotta); }
.product-original { font-size: 11px; color: var(--text-light); text-decoration: line-through; margin-left: 4px; }
.product-price-row { display: flex; align-items: baseline; }

/* ===== FORM ===== */
.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  max-width: 480px;
  margin: 0 auto;
}

.form-card-narrow { max-width: 400px; margin: 0; }
.form-card-icon-header { text-align: center; margin-bottom: 1.5rem; }
.form-title { font-family: 'Noto Serif TC', serif; font-size: 20px; font-weight: 700; color: var(--text-dark); margin-bottom: 0.3rem; }
.form-title-sm { font-size: 16px; }
.form-sub { font-size: 13px; color: var(--text-light); margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.2rem; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-mid); margin-bottom: 6px; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--text-dark);
  background: var(--warm-white);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--terracotta); }

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: 'Noto Sans TC', sans-serif;
  color: var(--text-dark);
  background: var(--warm-white);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23A08070' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.form-textarea { resize: none; height: 76px; }
.form-textarea-sm { resize: none; height: 56px; }
.form-hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .form-input { flex: 1; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--cream);
}

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== NOTICE ===== */
.notice-box {
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 1.2rem;
  font-size: 13px;
  line-height: 1.8;
}

.notice-box.peach { background: var(--peach); color: var(--text-mid); }
.notice-box.sage { background: var(--light-sage); color: #3D6B38; }

/* ===== QR ===== */
.qr-box {
  width: 160px; height: 160px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  border: 2px solid var(--border);
  padding: 8px;
}

.qr-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.timer-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sage);
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.qr-note { font-size: 12px; color: var(--text-light); padding: 0 1rem; line-height: 1.7; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(61, 43, 31, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 440px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-center { text-align: center; }

.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--peach);
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== ADMIN ===== */
.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  background: var(--cream);
  padding: 2rem 1rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: calc(100vh - 60px);
}

.admin-sidebar { background: var(--text-dark); padding: 1.5rem 0; }

.admin-logo {
  padding: 0 1.2rem 1.5rem;
  font-family: 'Noto Serif TC', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--rose);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 1rem;
}

.admin-menu-item {
  padding: 10px 1.2rem;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid transparent;
}

.admin-menu-item:hover { background: rgba(255,255,255,0.05); color: white; }
.admin-menu-item.active { color: var(--rose); border-left-color: var(--terracotta); background: rgba(212,120,90,0.1); }
.admin-logout { margin-top: 2rem; }

.admin-content { background: var(--cream); padding: 2rem; overflow-y: auto; }
.admin-section { display: none; }
.admin-section.active { display: block; }

.admin-header {
  font-family: 'Noto Serif TC', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
}

.admin-sub-header { font-size: 16px; }

.admin-notice {
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 1.2rem;
  font-size: 13px;
}

.admin-notice.sage { background: var(--light-sage); color: #3D6B38; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}

.metrics-3col { grid-template-columns: repeat(3, 1fr); }

.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
}

.metric-label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.metric-value { font-family: 'Noto Serif TC', serif; font-size: 28px; font-weight: 700; color: var(--terracotta); }
.metric-value.metric-warning { color: var(--gold); }
.metric-value.metric-success { color: var(--sage); }
.metric-sub { font-size: 11px; color: var(--sage); margin-top: 2px; }

.data-table {
  width: 100%;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.data-table th {
  background: var(--peach);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--brown);
}

.data-table td {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-mid);
  border-top: 1px solid var(--border);
}

.data-table tr:hover td { background: var(--cream); }

/* ===== NOTIFICATION ===== */
.notification {
  position: fixed;
  bottom: 20px; right: 20px;
  background: var(--text-dark);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 280px;
  pointer-events: none;
}

.notification.show { transform: translateY(0); opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { padding: 0 1rem; }
  .nav-links .nav-btn:not(.outline):not(.active) { display: none; }
  .hero { padding: 3rem 1rem 2rem; }
  .section { padding: 2rem 1rem; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .stats-bar { gap: 1.5rem; }
  .metrics-3col { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .cat-gallery { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; }
}
