/**
 * 羽創國際智能預約系統 — 前台設計系統
 *
 * Design Tokens、共用元件、工具類別
 *
 * @version 1.0.0
 */

/* ===========================
   TOKENS
=========================== */
:root {
  --c-primary:        #003d40;
  --c-primary-hover:  #004d52;
  --c-primary-light:  #e6f4f5;
  --c-accent:         #00B894;
  --c-accent-hover:   #009d7f;
  --c-surface:        #F7FAFB;
  --c-white:          #FFFFFF;
  --c-text:           #1C3031;
  --c-muted:          #6B9097;
  --c-border:         #DDE8EA;
  --c-success:        #22C55E;
  --c-success-bg:     #dcfce7;
  --c-warning:        #F59E0B;
  --c-warning-bg:     #fef3c7;
  --c-error:          #EF4444;
  --c-error-bg:       #fee2e2;

  --f-display: 'Outfit', sans-serif;
  --f-body:    'DM Sans', sans-serif;

  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;

  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,61,64,.08);
  --shadow-md: 0 4px 16px rgba(0,61,64,.10);
  --shadow-lg: 0 8px 32px rgba(0,61,64,.14);

  /* Bottom nav height — used for page bottom padding */
  --nav-h: 60px;
}

/* ===========================
   RESET / BASE
=========================== */
*, *::before, *::after { box-sizing: border-box; }

body.ds-body {
  font-family: var(--f-body);
  background: var(--c-surface);
  color: var(--c-text);
  margin: 0;
  padding: 0;
  padding-bottom: var(--nav-h); /* room for bottom nav */
}

/* ===========================
   PAGE HEADER (dark teal block)
=========================== */
.ds-page-header {
  background: var(--c-primary);
  padding: 14px var(--sp-4) var(--sp-4);
  position: relative;
  overflow: hidden;
}
.ds-page-header::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(0,184,148,.15);
  pointer-events: none;
}
.ds-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--sp-2);
  opacity: .90;
  position: relative;
  z-index: 1;
}
.ds-brand-row img {
  width: 22px; height: 22px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.ds-brand-row span {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}
.ds-page-title {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  position: relative;
  z-index: 1;
}
.ds-page-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

/* ===========================
   CARDS
=========================== */
.ds-card {
  background: var(--c-white);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4);
}
.ds-card-title {
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--sp-2);
}

/* ===========================
   BUTTONS
=========================== */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--r-full);
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background .18s, opacity .18s;
  text-decoration: none;
  line-height: 1.2;
}
.ds-btn:disabled { opacity: .5; cursor: not-allowed; }
.ds-btn-primary  { background: var(--c-primary); color: #fff; }
.ds-btn-primary:hover  { background: var(--c-primary-hover); }
.ds-btn-accent   { background: var(--c-accent); color: #fff; }
.ds-btn-accent:hover   { background: var(--c-accent-hover); }
.ds-btn-outline  { background: transparent; color: var(--c-primary); border: 2px solid var(--c-primary); }
.ds-btn-ghost    { background: var(--c-primary-light); color: var(--c-primary); }
.ds-btn-danger   { background: var(--c-error); color: #fff; }
.ds-btn-sm       { padding: 7px 14px; font-size: 13px; }
.ds-btn-block    { width: 100%; }

/* ===========================
   BADGES
=========================== */
.ds-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ds-badge-success { background: var(--c-success-bg); color: #15803d; }
.ds-badge-warning { background: var(--c-warning-bg); color: #92400e; }
.ds-badge-error   { background: var(--c-error-bg);   color: #b91c1c; }
.ds-badge-primary { background: var(--c-primary-light); color: var(--c-primary); }
.ds-badge-accent  { background: #d1faf3; color: #065f46; }

/* ===========================
   FORM INPUTS
=========================== */
.ds-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--c-text);
  background: var(--c-white);
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.ds-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0,61,64,.1);
}
.ds-input::placeholder { color: var(--c-muted); }

/* ===========================
   BOTTOM NAVIGATION
=========================== */
.ds-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: stretch;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0,61,64,.08);
}
.ds-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  text-decoration: none;
  padding: 6px 4px;
  position: relative;
  border: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.ds-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--c-primary);
  border-radius: 0 0 var(--r-full) var(--r-full);
}
.ds-nav-icon {
  font-size: 22px;
  line-height: 1;
  position: relative;
}
.ds-nav-badge {
  position: absolute;
  top: -4px; right: -8px;
  background: var(--c-error);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
}
.ds-nav-label {
  font-family: var(--f-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--c-muted);
}
.ds-nav-item.active .ds-nav-label { color: var(--c-primary); }

/* Desktop: hide bottom nav, show top nav links */
@media (min-width: 768px) {
  .ds-bottom-nav { display: none; }
  body.ds-body { padding-bottom: 0; }
}

/* ===========================
   CITY CHIPS (venue selection)
=========================== */
.ds-chip-row {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.ds-chip-row::-webkit-scrollbar { display: none; }
.ds-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background .18s, color .18s;
  background: rgba(255,255,255,.18);
  color: rgba(255,255,255,.8);
}
.ds-chip.active {
  background: var(--c-white);
  color: var(--c-primary);
}

/* ===========================
   SEARCH BOX (inside dark header)
=========================== */
.ds-search-wrap {
  position: relative;
  margin-bottom: var(--sp-3);
}
.ds-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted);
  font-size: 14px;
  pointer-events: none;
}
.ds-search-input {
  width: 100%;
  padding: 10px 12px 10px 34px;
  border-radius: var(--r-md);
  border: none;
  font-family: var(--f-body);
  font-size: 14px;
  color: var(--c-text);
  outline: none;
  background: var(--c-white);
}

/* ===========================
   VENUE CARD
=========================== */
.ds-venue-card {
  background: var(--c-white);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--c-border);
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
  margin-bottom: var(--sp-3);
}
.ds-venue-card:hover,
.ds-venue-card.selected {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-md);
}
.ds-venue-name {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
}
.ds-venue-card.selected .ds-venue-name { color: var(--c-primary); }
.ds-venue-addr {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 3px;
}
.ds-venue-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

/* ===========================
   SLOT TABS (court tabs)
=========================== */
.ds-tab-row {
  display: flex;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.ds-tab-row::-webkit-scrollbar { display: none; }
.ds-tab-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: color .18s, border-color .18s;
  white-space: nowrap;
}
.ds-tab-btn.active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}

/* ===========================
   SLOT LIST ITEM
=========================== */
.ds-slot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--c-border);
}
.ds-slot-time {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
}
.ds-slot-duration { font-size: 11px; color: var(--c-muted); margin-top: 1px; }
.ds-slot-right { display: flex; align-items: center; gap: 10px; }
.ds-slot-price {
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
}
.ds-slot-btn {
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-family: var(--f-body);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
/* 可預約 → 綠色 */
.ds-slot-btn-avail    { background: #dcfce7; color: #15803d; border: 1.5px solid #86efac; }
.ds-slot-btn-avail:hover { background: #16a34a; color: #fff; border-color: #16a34a; }
/* 已選取 → 深墨綠 Primary */
.ds-slot-btn-selected { background: var(--c-primary); color: #fff; border: 1.5px solid var(--c-primary); }
/* 已被預約 → 明顯灰色 + 斜線紋 */
.ds-slot-btn-booked   { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; border: 1.5px solid #d1d5db;
                         text-decoration: line-through; }
/* 自己的訂單 → Amber 橘色 */
.ds-slot-btn-own      { background: #fef3c7; color: #92400e; border: 1.5px solid #fcd34d; cursor: default; }

/* ===========================
   BOOKING SUMMARY BAR
=========================== */
.ds-summary-bar {
  position: fixed;
  bottom: var(--nav-h);
  left: 0; right: 0;
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 900;
  box-shadow: 0 -4px 16px rgba(0,61,64,.08);
}
@media (min-width: 768px) {
  .ds-summary-bar { position: sticky; bottom: 0; }
}

/* ===========================
   ORDER CARD
=========================== */
.ds-order-card {
  background: var(--c-white);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-3);
  border-left: 3px solid transparent;
}
.ds-order-card-urgent { border-left-color: var(--c-warning); }
.ds-order-card-paid   { border-left-color: var(--c-success); }
.ds-order-top { display: flex; align-items: flex-start; gap: var(--sp-3); }
.ds-order-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--c-primary-light);
  color: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ds-order-dot-paid { background: var(--c-success-bg); color: #15803d; }
.ds-order-body { flex: 1; min-width: 0; }
.ds-order-venue-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
}
.ds-order-venue { font-weight: 700; font-size: 14px; color: var(--c-text); }
.ds-order-detail { font-size: 12px; color: var(--c-muted); margin-top: 3px; }
.ds-order-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}
.ds-order-btn-pay {
  flex: 1;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 10px;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.ds-order-btn-cancel {
  flex-shrink: 0;
  background: transparent;
  color: var(--c-muted);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 10px 18px;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ===========================
   POINTS HERO
=========================== */
.ds-points-hero {
  background: linear-gradient(135deg, var(--c-primary), #005c62);
  padding: 14px var(--sp-4) var(--sp-4);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.ds-points-hero::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(0,184,148,.18);
  pointer-events: none;
}
.ds-points-main {
  font-family: var(--f-display);
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.ds-points-unit { font-size: 20px; color: rgba(255,255,255,.7); }
.ds-points-sub  { font-size: 13px; color: rgba(255,255,255,.6); margin-top: 6px; position: relative; z-index: 1; }

/* ===========================
   COUPON CARD
=========================== */
.ds-coupon-card {
  background: linear-gradient(135deg, var(--c-primary), #005c62);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--sp-3);
}
.ds-coupon-card::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(0,184,148,.25);
}
.ds-coupon-name     { font-family: var(--f-display); font-size: 15px; font-weight: 700; }
.ds-coupon-discount { font-family: var(--f-display); font-size: 30px; font-weight: 800; color: var(--c-accent); }
.ds-coupon-exp      { font-size: 11px; color: rgba(255,255,255,.65); margin-top: 3px; }

/* ===========================
   QUICK BOOK CARD (home)
=========================== */
.ds-quick-card {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 1;
}
.ds-quick-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.ds-quick-venue {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.ds-quick-sub {
  font-size: 12px;
  color: rgba(255,255,255,.65);
  margin-bottom: var(--sp-3);
}
.ds-quick-btn {
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  padding: 8px 18px;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===========================
   CATEGORY GRID (home)
=========================== */
.ds-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
@media (min-width: 480px) { .ds-cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .ds-cat-grid { grid-template-columns: repeat(4, 1fr); } }
.ds-cat-card {
  background: var(--c-white);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color .18s, box-shadow .18s;
  text-align: center;
}
.ds-cat-card:hover, .ds-cat-card.selected { border-color: var(--c-primary); box-shadow: var(--shadow-md); }
.ds-cat-img { width: 60px; height: 60px; object-fit: cover; border-radius: var(--r-sm); }
.ds-cat-name { font-family: var(--f-display); font-size: 13px; font-weight: 700; color: var(--c-text); }

/* ===========================
   MY PAGE MENU LIST
=========================== */
.ds-menu-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: var(--sp-2);
  padding: 0 2px;
}
.ds-menu-list {
  background: var(--c-white);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}
.ds-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.ds-menu-item:last-child { border-bottom: none; }
.ds-menu-item:hover { background: var(--c-surface); }
.ds-menu-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ds-menu-icon-yellow  { background: #fffbeb; }
.ds-menu-icon-primary { background: var(--c-primary-light); }
.ds-menu-icon-green   { background: #f0fdf9; }
.ds-menu-icon-orange  { background: #fff7ed; }
.ds-menu-icon-red     { background: var(--c-error-bg); }
.ds-menu-text         { flex: 1; }
.ds-menu-title        { font-weight: 700; font-size: 14px; color: var(--c-text); }
.ds-menu-desc         { font-size: 12px; color: var(--c-muted); margin-top: 1px; }
.ds-menu-arrow        { color: var(--c-muted); font-size: 18px; }
.ds-menu-title-danger { color: #b91c1c !important; }

/* ===========================
   AVATAR
=========================== */
.ds-avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--c-accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

/* ===========================
   SECTION HEADER
=========================== */
.ds-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.ds-section-title {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
}
.ds-section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-accent);
  text-decoration: none;
}

/* ===========================
   UTILITY
=========================== */
.ds-p-page { padding: var(--sp-4); }
.ds-mt-2   { margin-top: var(--sp-2); }
.ds-mt-3   { margin-top: var(--sp-3); }
.ds-mt-4   { margin-top: var(--sp-4); }
.ds-mb-3   { margin-bottom: var(--sp-3); }
.ds-mb-4   { margin-bottom: var(--sp-4); }
.ds-text-muted { color: var(--c-muted); }
.ds-text-sm    { font-size: 13px; }

/* ===========================
   DESKTOP TOP NAV (overrides)
=========================== */
@media (min-width: 768px) {
  body.ds-body { padding-top: 60px; }  /* room for fixed top bar */

  /* 桌機版頂部固定 navbar 已有 Logo，各頁面內 ds-brand-row 不再重複顯示，
     避免雙重 Logo 視覺重疊（原始檔請見 member/index.php 的 .ds-desktop-navbar）。 */
  .ds-brand-row { display: none !important; }

  /* 桌機版 ds-page-header / ds-points-hero 上 padding 縮小，
     原本上方留白是為了 brand-row，brand-row 隱藏後改為較窄的 banner。 */
  .ds-page-header,
  .ds-points-hero { padding-top: 24px; padding-bottom: 24px; }
}
