/* assets/css/components.css */
/* 負責：獨立元件樣式 (按鈕、卡片、標籤、搜尋框、Tabs) */
/* 高端化升級：毛玻璃特效 (Glassmorphism)、流暢微互動、頂級圓角與陰影 */

/* --- 搜尋框 (Search Input) --- */
#search-input { 
  flex: 1; 
  padding: 14px 20px; 
  font-size: 16px; 
  background: var(--panel);
  border: 1px solid var(--border); 
  border-radius: 99px; 
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.03)); 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  width: 100%; 
  box-sizing: border-box;
  color: var(--ink);
}
#search-input:focus { 
  border-color: var(--brand); 
  box-shadow: 0 0 0 4px var(--brand-light, #ccfbf1); 
  outline: none;
  transform: translateY(-1px);
}
#search-input::placeholder { color: #cbd5e1; font-weight: 400; }

/* --- 工具列按鈕 (Tool Buttons) --- */
.tool-btn, .filter-toggle-btn, .map-toggle-btn { 
  padding: 12px 20px; 
  font-size: 14px; 
  border-radius: 99px; 
  font-weight: 600; 
  cursor: pointer; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  border: 1px solid var(--border); 
  background: var(--panel); 
  color: var(--ink-light, #334155); 
  white-space: nowrap; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.03));
}
.tool-btn:hover, .filter-toggle-btn:hover { 
  background: #f8fafc; 
  color: var(--ink);
  transform: translateY(-2px); 
  box-shadow: var(--shadow-md, 0 10px 30px rgba(0, 0, 0, 0.05));
}
.map-toggle-btn { color: var(--brand); border-color: rgba(15, 118, 110, 0.2); background: var(--brand-50, #f0fdfa); }
.map-toggle-btn:hover { background: var(--brand-light, #ccfbf1); }
.map-toggle-btn.active { 
  background: var(--brand); 
  color: #fff; 
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.3); 
  border-color: var(--brand);
}

/* --- 篩選 Tabs --- */
.tabs-container { 
  margin: 16px 0; 
  overflow-x: auto; 
  scrollbar-width: none; 
}
.tabs-container::-webkit-scrollbar { display: none; }

.tabs { 
  display: flex; 
  gap: 10px; 
  padding-bottom: 6px; 
}
.tabs label { 
  -webkit-user-select: none; 
  user-select: none; 
  cursor: pointer; 
  font-size: 14px; 
  color: var(--ink-light, #334155); 
  border: 1px solid transparent; 
  background: #f1f5f9; 
  padding: 8px 20px; 
  border-radius: 99px; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  white-space: nowrap; 
  font-weight: 600; 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
}
.tabs label:hover { background: #e2e8f0; color: var(--ink); }

.tabs-input { position: absolute; opacity: 0; }
.tabs-input:checked + label { 
  background: var(--ink); 
  color: #fff; 
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2); 
  transform: translateY(-1px); 
}

/* 收藏標籤特殊色 */
.tabs-input[value="fav"]:checked + label {
  background: #db2777; color: #fff; box-shadow: 0 6px 16px rgba(219, 39, 119, 0.3);
}

.category-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 16px 0 8px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.category-header::before {
  content: '';
  display: block;
  width: 4px;
  height: 12px;
  background: var(--brand);
  border-radius: 99px;
}

/* --- 篩選面板開關動畫 --- */
.filter-panel {
  max-height: 1200px; 
  opacity: 1;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 16px;
}
.filter-panel.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none; 
}

/* ==========================================================================
   Modern Vertical Card (新版沉浸式卡片樣式)
   ========================================================================== */

.card { 
    display: flex; 
    flex-direction: column; 
    padding: 0; 
    gap: 0;
    overflow: hidden;
    background: var(--panel-card); 
    border: 1px solid rgba(0,0,0,0.04); 
    border-radius: 24px;
    box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.03)); 
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); 
    position: relative; 
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
}
.card:hover { 
  transform: translateY(-6px); 
  box-shadow: var(--shadow-hover, 0 20px 40px rgba(0, 0, 0, 0.08)); 
  border-color: rgba(15, 118, 110, 0.15); 
}
.card.hidden, .card.expired-hidden { display: none !important; }

/* 上方圖片區塊 */
.card-cover {
  position: relative;
  width: 100%;
  height: 220px; 
  background: #f1f5f9;
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.7s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover .card-cover img {
  transform: scale(1.08); 
}

/* 浮動標籤 (日期/評分) */
.float-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  padding: 6px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  font-weight: 800;
  line-height: 1.1;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.4);
}

.date-badge .fb-month { font-size: 11px; color: #ef4444; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px;}
.date-badge .fb-day { font-size: 20px; color: #0f172a; }

.rating-badge { flex-direction: row; gap: 4px; color: #b45309; }
.spot-badge { font-size: 20px; padding: 6px 10px; }

/* 浮動收藏按鈕 */
.card-fav-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  color: #cbd5e1;
}
.card-fav-btn:hover { transform: scale(1.1); background: #fff; color: #94a3b8; }
.card-fav-btn.active { background: #fff; color: #ef4444; }
.card-fav-btn.active:hover { transform: scale(1.15); }

/* 下方內容區塊 */
.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.region-pill {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.dist-pill {
  color: var(--brand);
  font-weight: 700;
  background: var(--brand-50, #f0fdfa);
  padding: 4px 8px;
  border-radius: 6px;
}

/* 狀態標籤 */
.status-tag { padding: 4px 8px; border-radius: 6px; font-weight: 700; font-size: 11px; letter-spacing: 0.5px; }
.status-tag.running { background: transparent; color: #e11d48; border: 1px solid #fecdd3; }
.status-tag.soon { background: transparent; color: #0284c7; border: 1px solid #bae6fd; }
.status-tag.today { background: transparent; color: #16a34a; border: 1px solid #bbf7d0; }
.status-tag.closed { background: transparent; color: #9ca3af; border: 1px solid #e5e7eb; }
.status-tag.reg { background: #f5f3ff; color: #4f46e5; }
.status-tag.fee { background: #fff7ed; color: #ea580c; }

.card-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.4;
  margin: 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-info {
  font-size: 14px;
  color: var(--ink-light, #334155);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 500;
}

/* 修正營業時間與地址資訊的排版：允許自然換行 */
.info-row {
  display: flex;
  align-items: flex-start; /* 讓多行文字時圖示對齊頂部 */
  gap: 8px;
  opacity: 0.85;
  line-height: 1.5;
  word-break: break-word; /* 允許文字換行 */
}
.info-row.price { color: var(--ink); font-weight: 700; opacity: 1; align-items: center; }

.card-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  height: 30px; 
  overflow: hidden;
}
.tag { 
  font-size: 12px; 
  padding: 4px 10px; 
  border-radius: 6px; 
  background: #f8fafc; 
  color: var(--muted); 
  margin: 0;
  font-weight: 600; 
  transition: all 0.2s;
}

.tag[data-cat*="市集"], .tag[data-cat*="美食"] { background: #fff7ed; color: #c2410c; }
.tag[data-cat*="親子"] { background: #fdf2f8; color: #be185d; }
.tag[data-cat*="展覽"] { background: #eff6ff; color: #1d4ed8; }
.tag[data-cat*="戶外"] { background: #f0f9ff; color: #0369a1; }

/* 底部按鈕區修正：允許在小螢幕自動換行，並固定按鈕形狀 */
.card-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.04);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.main-actions { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; }
.sub-actions { display: flex; gap: 8px; flex-shrink: 0; }

.action-btn { 
  background: var(--panel); 
  color: var(--ink-light, #334155); 
  border: 1px solid var(--border); 
  border-radius: 99px; 
  padding: 8px 16px; 
  font-size: 13px; 
  font-weight: 700; 
  cursor: pointer; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  text-decoration: none; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  gap: 6px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  white-space: nowrap; /* 確保文字不會直排 */
  flex-shrink: 0; /* 確保按鈕不會被過度擠壓變形 */
}
.action-btn:hover { background: var(--ink); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); border-color: var(--ink); }
.btn-fb { color: #1877f2; border-color: rgba(24, 119, 242, 0.2); background: rgba(24, 119, 242, 0.05); }
.btn-ig { color: #db2777; border-color: rgba(219, 39, 119, 0.2); background: rgba(219, 39, 119, 0.05); }
.btn-form { color: var(--brand); border-color: rgba(15, 118, 110, 0.2); background: var(--brand-50, #f0fdfa); }

.icon-btn {
  background: #f8fafc;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  flex-shrink: 0;
}
.icon-btn:hover { background: #e2e8f0; color: var(--ink); transform: scale(1.1); }
.btn-line-icon { background: #06c755; color: #fff; font-weight: 800; font-size: 14px; }
.btn-line-icon:hover { background: #05a346; color: #fff; }

@keyframes slideUpFade { 
  from { opacity: 0; transform: translateY(40px); } 
  to { opacity: 1; transform: translateY(0); } 
}
.card:not(.skeleton-card) { 
  opacity: 0; 
  animation: slideUpFade 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards; 
}

.fab-random { 
    position: fixed; 
    bottom: 120px; 
    right: 20px; 
    background: linear-gradient(135deg, var(--brand), #06b6d4); 
    color: white; 
    border: none; 
    border-radius: 99px; 
    padding: 14px 24px; 
    font-size: 15px; 
    font-weight: 800; 
    box-shadow: 0 10px 25px rgba(15, 118, 110, 0.4); 
    z-index: 20002; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); 
    animation: float 4s ease-in-out infinite; 
}
.fab-random:hover { transform: translateY(-4px) scale(1.05); box-shadow: 0 15px 35px rgba(15, 118, 110, 0.5); }
.fab-random:active { transform: scale(0.95); }
@keyframes float { 
  0%, 100% { transform: translateY(0px); } 
  50% { transform: translateY(-8px); } 
}

.reset { position: fixed; right: 20px; bottom: 180px; z-index: 9998; }
#reset-filters-label { 
  background: var(--panel); 
  color: var(--ink); 
  border: 1px solid var(--border); 
  border-radius: 50%; 
  width: 44px; height: 44px; 
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; 
  font-weight: 700; 
  cursor: pointer; 
  box-shadow: var(--shadow-md, 0 10px 30px rgba(0,0,0,0.05)); 
  transition: all 0.3s;
}
#reset-filters-label:hover { transform: translateY(-3px) rotate(180deg); color: var(--brand); }

/* --- Dark Mode 元件調整 --- */
html[data-theme="dark"] #search-input { background: rgba(30, 41, 59, 0.5); color: #fff; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .tool-btn, 
html[data-theme="dark"] .filter-toggle-btn, 
html[data-theme="dark"] .map-toggle-btn { background: rgba(30, 41, 59, 0.5); color: #cbd5e1; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .tool-btn:hover { background: #334155; color: #fff; }
html[data-theme="dark"] .tabs label { background: rgba(30, 41, 59, 0.5); color: #cbd5e1; border-color: rgba(255,255,255,0.05); }
html[data-theme="dark"] .tabs label:hover { background: #334155; }
html[data-theme="dark"] .tabs-input:checked + label { background: var(--brand); color: #000; box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3); }

html[data-theme="dark"] .card { background: rgba(30, 41, 59, 0.4); border-color: rgba(255,255,255,0.05); }
html[data-theme="dark"] .card:hover { border-color: rgba(45, 212, 191, 0.3); box-shadow: 0 15px 35px rgba(0,0,0,0.8); }
html[data-theme="dark"] .card-cover { background: #334155; }
html[data-theme="dark"] .float-badge { background: rgba(15, 23, 42, 0.85); color: #fff; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .date-badge .fb-day { color: #f8fafc; }
html[data-theme="dark"] .rating-badge { color: #fcd34d; }
html[data-theme="dark"] .card-fav-btn { background: rgba(15, 23, 42, 0.85); border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .card-title { color: #f8fafc; }
html[data-theme="dark"] .info-row.price { color: #f8fafc; }
html[data-theme="dark"] .region-pill { color: #cbd5e1; }
html[data-theme="dark"] .tag { background: rgba(15, 23, 42, 0.6); color: #94a3b8; }
html[data-theme="dark"] .card-footer { border-top-color: rgba(255,255,255,0.05); }
html[data-theme="dark"] .action-btn { background: transparent; border-color: rgba(255,255,255,0.1); color: #cbd5e1; }
html[data-theme="dark"] .action-btn:hover { background: #f8fafc; color: #0f172a; }
html[data-theme="dark"] .icon-btn { background: rgba(30, 41, 59, 0.5); color: #94a3b8; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .icon-btn:hover { background: #cbd5e1; color: #0f172a; }
html[data-theme="dark"] #reset-filters-label { background: rgba(30, 41, 59, 0.8); color: #cbd5e1; border-color: rgba(255,255,255,0.1); }
html[data-theme="dark"] .pill { background: #164e63; color: #67e8f9; border-color: #083344; }