/* =============================================================
   ZenPass 禪流 — 共享 CSS（Shared Styles）
   所有頁面共用嘅變數、base styles 及 components
   ============================================================= */

/* ===== CSS Variables ===== */
:root {
  /* Brand Colors */
  --orange-500: #ff6b35;
  --orange-600: #e55a2b;
  --orange-600-bg: #c94420;
  --orange-700: #aa3218;
  --orange-400: #ff8555;
  --orange-300: #ffa075;
  --orange-100: #fff0e8;
  --orange-50: #fff8f4;

  /* Neutral Colors */
  --dark-900: #1a1a2e;
  --dark-800: #2d2d3a;
  --dark-700: #6b7280;
  --gray-300: #888;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;

  /* Semantic Colors */
  --green-500: #059669;
  --green-600: #047857;
  --green-50: #ecfdf5;
  --red-500: #ef4444;
  --red-50: #fef2f2;
  --blue-500: #3b82f6;
  --blue-50: #eff6ff;
  --purple-500: #8b5cf6;
  --purple-50: #f5f3ff;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Typography */
  --font-en: "Inter", -apple-system, sans-serif;
  --font-zh: "Noto Sans TC", -apple-system, sans-serif;

  /* Layout */
  --max-width: 480px;
  --nav-height: 64px;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Base Body ===== */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-zh);
  background: var(--gray-50);
  color: var(--dark-900);
  min-height: 100vh;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: calc(var(--nav-height) + 20px);
  -webkit-font-smoothing: antialiased;
  animation: fadeIn 0.4s ease-out;
}

/* ===== Page Fade-in ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Header (Sticky) ===== */
.zen-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.zen-header h1 {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}
.zen-header .back-btn {
  font-size: 20px;
  cursor: pointer;
  text-decoration: none;
  color: var(--dark-900);
  background: none;
  border: none;
  padding: 4px;
}

/* ===== Container ===== */
.zen-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
}

/* ===== Cards ===== */
.zen-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.zen-card-hover {
  transition: all 0.2s ease;
}
.zen-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== Buttons ===== */
.zen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-zh);
  transition: all 0.15s ease;
  text-decoration: none;
}
.zen-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}
.zen-btn:active {
  transform: scale(0.97);
}
.zen-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.zen-btn-primary {
  background: var(--orange-600-bg);
  color: var(--white);
}
.zen-btn-primary:hover:not(:disabled) {
  background: var(--orange-600);
}
.zen-btn-secondary {
  background: var(--gray-100);
  color: var(--dark-700);
}
.zen-btn-ghost {
  background: transparent;
  color: var(--orange-700);
  border: 1px solid var(--orange-700);
}
.zen-btn-success {
  background: var(--green-500);
  color: var(--white);
}
.zen-btn-block {
  width: 100%;
}
.zen-btn-small {
  padding: 8px 16px;
  font-size: 12px;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
  z-index: 1000;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  font-size: 10px;
  color: var(--dark-700);
  padding: 4px 12px;
  transition: color 0.2s;
}
.nav-item.active {
  color: var(--orange-700);
}
.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
}

/* ===== Footer ===== */
.zen-footer {
  text-align: center;
  padding: 20px 16px;
  margin-top: 24px;
  border-top: 1px solid var(--gray-200);
  font-size: 12px;
  color: var(--dark-700);
}
.zen-footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}
.zen-footer a {
  color: var(--orange-700);
  text-decoration: none;
  font-weight: 500;
}

/* ===== Loading Spinner ===== */
.zen-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--orange-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Skeleton Loading ===== */
.zen-skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Toast Notifications ===== */
.zen-toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}
.zen-toast {
  pointer-events: auto;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  width: 100%;
  animation: toastIn 0.3s ease-out;
  border-left: 4px solid var(--green-500);
}
.zen-toast.error { border-left-color: var(--red-500); }
.zen-toast.info  { border-left-color: var(--blue-500); }
.zen-toast .toast-icon { font-size: 20px; flex-shrink: 0; }
.zen-toast .toast-text { flex: 1; }
.zen-toast.out { animation: toastOut 0.3s ease-in forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

/* ===== Modal Overlay ===== */
.zen-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.zen-modal-overlay.show { display: flex; }
.zen-modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.zen-modal .modal-icon { font-size: 48px; margin-bottom: 12px; }
.zen-modal .modal-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.zen-modal .modal-desc { font-size: 14px; color: var(--dark-700); margin-bottom: 16px; }
.zen-modal .modal-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-zh);
  transition: all 0.15s ease;
}
.zen-modal .modal-btn.primary { background: var(--orange-600-bg); color: white; margin-bottom: 8px; }
.zen-modal .modal-btn.secondary { background: var(--gray-100); color: var(--dark-700); }

/* ===== Empty States ===== */
.zen-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--dark-700);
}
.zen-empty .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }
.zen-empty .empty-title { font-size: 15px; font-weight: 600; color: var(--dark-900); margin-bottom: 6px; }
.zen-empty .empty-desc { font-size: 13px; color: var(--dark-700); }

/* ===== Form Elements ===== */
.zen-form-group { margin-bottom: 14px; }
.zen-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--dark-700);
}
.zen-form-group input,
.zen-form-group select,
.zen-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-zh);
  background: var(--white);
  transition: border-color 0.2s;
}
.zen-form-group input:focus,
.zen-form-group textarea:focus {
  border-color: var(--orange-700);
  outline: none;
}
.zen-form-row { display: flex; gap: 10px; }
.zen-form-row .zen-form-group { flex: 1; }

/* ===== Section Title ===== */
.zen-section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== Tag / Badge ===== */
.zen-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.zen-tag-orange { background: var(--orange-100); color: var(--orange-700); }
.zen-tag-green  { background: var(--green-50); color: var(--green-600); }
.zen-tag-red    { background: var(--red-50); color: var(--red-500); }
.zen-tag-blue   { background: var(--blue-50); color: var(--blue-500); }
.zen-tag-gray   { background: var(--gray-100); color: var(--dark-700); }

/* ===== Section Divider ===== */
.zen-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 16px 0;
}

/* ===== Flex Helpers ===== */
.zen-flex { display: flex; }
.zen-flex-center { display: flex; align-items: center; justify-content: center; }
.zen-flex-between { display: flex; align-items: center; justify-content: space-between; }
.zen-gap-sm { gap: 8px; }
.zen-gap-md { gap: 12px; }
.zen-gap-lg { gap: 16px; }
.zen-flex-wrap { flex-wrap: wrap; }
.zen-flex-1 { flex: 1; }

/* ===== Text Helpers ===== */
.zen-text-center { text-align: center; }
.zen-text-sm { font-size: 13px; }
.zen-text-xs { font-size: 11px; }
.zen-text-bold { font-weight: 700; }
.zen-text-muted { color: var(--dark-700); }
.zen-text-error { color: var(--red-500); }
.zen-text-success { color: var(--green-500); }

/* ===== Spacing Helpers ===== */
.zen-mt-sm { margin-top: 8px; }
.zen-mt-md { margin-top: 16px; }
.zen-mt-lg { margin-top: 24px; }
.zen-mb-sm { margin-bottom: 8px; }
.zen-mb-md { margin-bottom: 16px; }
.zen-p-sm { padding: 8px; }
.zen-p-md { padding: 16px; }

/* ===== Hidden ===== */
.zen-hidden { display: none !important; }

/* ===== Scrollbar Styling ===== */
.zen-scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.zen-scroll-x::-webkit-scrollbar { display: none; }

/* ===== Pull to Refresh Indicator ===== */
.zen-pull-indicator {
  text-align: center;
  padding: 12px;
  font-size: 12px;
  color: var(--dark-700);
  display: none;
}

/* ===== Staggered Animation ===== */
.zen-stagger > * {
  opacity: 0;
  animation: staggerIn 0.4s ease-out forwards;
}
.zen-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.zen-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.zen-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.zen-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.zen-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.zen-stagger > *:nth-child(6) { animation-delay: 0.3s; }
@keyframes staggerIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Gradient Card ===== */
.zen-card-gradient {
  background: linear-gradient(135deg, #1a1a2e, #2d2d44);
  color: white;
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.zen-card-gradient.orange {
  background: linear-gradient(135deg, #ff6b35, #e85d2c);
  box-shadow: 0 2px 8px rgba(255,107,53,0.2);
}
.zen-card-gradient .g-icon { font-size: 32px; flex-shrink: 0; }
.zen-card-gradient .g-body { flex: 1; min-width: 0; }
.zen-card-gradient .g-title { font-weight: 700; font-size: 15px; }
.zen-card-gradient .g-desc { font-size: 12px; opacity: 0.6; margin-top: 2px; }
.zen-card-gradient .g-action {
  background: var(--orange-600-bg);
  color: white;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Stats Row ===== */
.zen-stats {
  display: flex;
  gap: 8px;
  padding: 14px 12px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.zen-stat {
  flex: 1;
  text-align: center;
}
.zen-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--orange-700);
}
.zen-stat-label {
  font-size: 11px;
  color: var(--dark-700);
}
.zen-stat-divider {
  width: 1px;
  background: var(--gray-200);
}

/* ===== Section Padded ===== */
.zen-section {
  padding: 12px 16px;
}

/* ===== Search Bar ===== */
.zen-search-bar {
  display: flex;
  gap: 8px;
  margin: 0 16px 12px;
  background: var(--white);
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid var(--gray-200);
  align-items: center;
  transition: box-shadow 0.2s;
}
.zen-search-bar:focus-within {
  box-shadow: 0 0 0 3px rgba(255,107,53,0.15);
  border-color: var(--orange-700);
}
.zen-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: var(--font-zh);
  padding: 10px 0;
  background: transparent;
}
.zen-search-bar button {
  background: var(--orange-600-bg);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== Category Pills ===== */
.zen-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.zen-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.9);
  font-size: 13px;
  text-decoration: none;
  color: var(--dark-900);
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.zen-pill:hover {
  background: var(--orange-100);
  color: var(--orange-700);
  border-color: var(--orange-300);
}
.zen-pill.active {
  background: var(--orange-600-bg);
  color: white;
}

/* ===== Floating Action Button ===== */
.zen-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--orange-600-bg);
  color: white;
  border: none;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(255,107,53,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: all 0.2s;
}
.zen-fab:hover { transform: scale(1.1); }
.zen-fab:active { transform: scale(0.95); }

/* ===== Count Badge ===== */
.zen-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Price Display ===== */
.zen-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--orange-700);
}
.zen-price small {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-700);
}

/* ===== Image Placeholder ===== */
.zen-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--orange-100), var(--gray-100));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--orange-300);
}

/* ===== Quick Action Grid ===== */
.zen-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.zen-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  background: var(--white);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--dark-900);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.zen-action-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.zen-action-icon { font-size: 24px; }
.zen-action-label { font-size: 11px; font-weight: 500; }

/* ===== Horizontal Card Scroll ===== */
.zen-h-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.zen-h-scroll-item {
  flex: 0 0 150px;
  padding: 12px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.zen-avatar-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  margin: 0 auto 6px;
}

/* ===== Desktop Layout Enhancements ===== */
@media (min-width: 768px) {
  :root {
    --max-width: 800px;
  }
  .zen-container {
    max-width: 800px;
  }
}
@media (min-width: 1024px) {
  :root {
    --max-width: 960px;
  }
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --dark-900: #f3f4f6;
    --dark-800: #d1d5db;
    --dark-700: #9ca3af;
    --gray-200: #374151;
    --gray-100: #1f2937;
    --gray-50: #111827;
    --white: #1f2937;
    --orange-50: #2d1a0e;
    --green-50: #0d1f14;
    --red-50: #1f0d0d;
    --blue-50: #0d1a2d;
    --purple-50: #1a0d2d;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
  body { background: #111827; }
}

/* Course Card Image Colors by Category */
.class-card-img[data-cat="瑜伽"] { background: linear-gradient(135deg, #667eea, #764ba2) !important; }
.class-card-img[data-cat="健身"] { background: linear-gradient(135deg, #f093fb, #f5576c) !important; }
.class-card-img[data-cat="伸展"] { background: linear-gradient(135deg, #4facfe, #00f2fe) !important; }
.class-card-img[data-cat="冥想"] { background: linear-gradient(135deg, #a18cd1, #fbc2eb) !important; }
.class-card-img[data-cat="舞蹈"] { background: linear-gradient(135deg, #ffecd2, #fcb69f) !important; }
.class-card-img[data-cat="新興運動"] { background: linear-gradient(135deg, #43e97b, #38f9d7) !important; }
.class-card-img[data-cat="拳擊搏擊"] { background: linear-gradient(135deg, #fa709a, #fee140) !important; }
.class-card-img[data-cat="長者體適能"] { background: linear-gradient(135deg, #a1c4fd, #c2e9fb) !important; }
.class-card-img[data-cat="空中瑜伽"] { background: linear-gradient(135deg, #d4fc79, #96e6a1) !important; }
.class-card-img[data-cat="皮拉提斯"] { background: linear-gradient(135deg, #89f7fe, #66a6ff) !important; }
.class-card-img[data-cat="兒童體適能"] { background: linear-gradient(135deg, #fddb92, #d1fdff) !important; }
.class-card-img[data-cat="太極養生"] { background: linear-gradient(135deg, #c1f5c0, #91e7b8) !important; }
.class-card-img[data-cat="高爾夫球"] { background: linear-gradient(135deg, #a8edea, #fed6e3) !important; }
.class-card-img[data-cat="攀岩"] { background: linear-gradient(135deg, #e0c3fc, #8ec5fc) !important; }
.class-card-img[data-cat="射箭"] { background: linear-gradient(135deg, #fccb90, #d57eeb) !important; }
.class-card-img[data-cat="劍擊"] { background: linear-gradient(135deg, #e9defa, #fbfcdb) !important; }
.class-card-img[data-cat="網球"] { background: linear-gradient(135deg, #f5f7fa, #c3cfe2) !important; }
.class-card-img[data-cat="羽毛球"] { background: linear-gradient(135deg, #84fab0, #8fd3f4) !important; }
