/* styles.css - 增強行動裝置體驗 + loading + 卡片樣式 */
:root { 
    --brand: #D32F2F; 
    --brand-light: #EF5350;
    --text: #333333; 
    --light-bg: #f9f9f9;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; color: var(--text); background-color: var(--light-bg); }

/* container */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* header */
.site-header { position: relative; background: var(--brand); color: #fff; text-align: center; padding: 0 0 12px 0; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.08); }
.site-header.collapsed .hero-wrap { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.hero-wrap { transition: max-height 0.3s ease; max-height: 220px; overflow: hidden; }
.hero { width: 100%; height: auto; display: block; }
.brand { font-size: 1.35rem; font-weight: 700; padding: 10px 0; }

/* hero toggle center */
.hero-toggle { position: absolute; bottom: 12px; left: 60%; transform: translateX(-50%); background: var(--brand); color: white; border: 1px solid white; padding: 6px 14px; border-radius: 20px; cursor: pointer; z-index: 10; font-size: 0.9rem; }

/* category buttons */
.category-buttons { display:flex; overflow-x:auto; gap:8px; padding: 12px 0; margin-bottom: 10px; }
.category-buttons button { flex: 0 0 auto; background: #fff; color: var(--text); border: 1px solid #e0e0e0; padding: 8px 12px; border-radius: 18px; display:flex; align-items:center; gap:8px; font-size:0.95rem; cursor:pointer; }
.category-buttons button.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.category-buttons img { width:18px; height:18px; }

/* filters */
.filters { display:flex; gap:10px; align-items:center; margin-bottom:16px; flex-wrap:wrap; }
.search-wrapper { position: relative; flex:1; min-width:160px; }
.search-wrapper .search-icon { position:absolute; left:10px; top:50%; transform:translateY(-50%); opacity:0.6; pointer-events:none; }
.search-wrapper input { width:100%; padding:10px 12px 10px 36px; border-radius:8px; border:1px solid #ddd; font-size:0.95rem; background:#fff; }
.filters select { padding:10px 12px; border-radius:8px; border:1px solid #ddd; background:#fff; }

/* loading message */
.loading-message { display:flex; align-items:center; justify-content:center; gap:8px; padding:12px; background:#fff; border:1px solid #eee; border-radius:8px; box-shadow:0 2px 6px rgba(0,0,0,0.04); margin-bottom:12px; font-weight:600; color:var(--brand); }
.loading-message::before { content:''; width:18px; height:18px; border-radius:50%; border:3px solid rgba(0,0,0,0.1); border-top-color:var(--brand); animation: spin 1s linear infinite; display:inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* shop list grid */
.shop-list { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap:18px; margin-top:8px; }

/* card */
.shop-card { position:relative; background:#fff; border:1px solid #eee; border-radius:10px; padding:16px; padding-top:30px; box-shadow:0 6px 18px rgba(0,0,0,0.06); min-height:130px; transition: transform 0.22s ease, box-shadow 0.22s ease; }
@media (hover: hover) {
  .shop-card:hover { transform: translateY(-6px); box-shadow:0 12px 30px rgba(0,0,0,0.08); }
}
.shop-card::before { content:''; position:absolute; top:-12px; left:-1px; right:-1px; height:28px; background:var(--brand); border-radius:8px 8px 0 0; z-index:0; }

/* ************************************************* */
/* 關鍵修改: 地點標籤獨立定位到紅條下緣 (PC版) */
/* ************************************************* */
.location-badge {
    /* 脫離正常文件流，相對於 .shop-card 定位 */
    position: absolute;
    top: -5px; /* 掛在紅條下緣 */
    left: 0; /* 貼齊左邊緣 */
    z-index: 3; 

    /* 樣式調整 */
    background: #fff; 
    color: var(--brand); 
    padding: 3px 10px;
    border-radius: 0 0 4px 4px; /* 下方圓角 */
    font-size: 0.85rem;
    font-weight: 600;
    
    /* 邊框調整 */
    border: 1px solid #ddd;
    border-left: none; 
    border-top: none; /* 移除上邊框 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08); /* 向下的陰影 */
}

/* item header/body */
.item-header { position:relative; z-index:1; padding-left:6px; margin-bottom:8px; }
.item-header h2 { margin:0; font-size:1.05rem; line-height:1.25; }
.item-body p { margin:8px 0; color:#333; font-size:0.95rem; }
.item-body .muted { color:#777; font-weight:500; }
.meta { color:#666; font-size:0.82rem; margin-top:6px; }

/* pager */
.pager { display:flex; justify-content:center; align-items:center; gap:12px; margin-top:24px; padding:12px 0; }
.btn { background:var(--brand); color:#fff; border:none; padding:8px 14px; border-radius:8px; cursor:pointer; font-size:0.95rem; }
.btn.small { padding:8px 10px; font-size:0.85rem; background:#fff; color:var(--brand); border:1px solid var(--brand); }

/* no-results */
.no-results { grid-column:1 / -1; padding:28px; text-align:center; background:#fff; border-radius:8px; border:1px solid #f0f0f0; color:#666; }

/* footer */
.site-footer { text-align:center; padding:18px; margin-top:28px; border-top:1px solid #eee; color:#666; font-size:0.9rem; background:transparent; }

/* responsive tweaks (手機版修正) */
@media (max-width: 600px) {
  .container { padding:12px; }
  .brand { font-size:1.05rem; }
  .hero-toggle { bottom:10px; padding:6px 12px; font-size:0.85rem; }
  .shop-card { padding:12px; padding-top:28px; min-height:110px; }
  
  /* 🚨 關鍵修正：手機版也要保持在紅條下方 */
  .location-badge { 
      left: 0; 
      max-width:110px; 
      font-size:0.85rem; 
      top: -5px; /* 這裡從 -36px 改為 -5px，與 PC 版一致 */
  }
  
  .search-wrapper input { padding-left:36px; }
}

/* accessibility: turn off hover effects on touch devices */
@media (hover: none) {
  .shop-card { transform: none !important; box-shadow:0 6px 12px rgba(0,0,0,0.04); }
}
/* 搜尋結果數量統計樣式 */
.result-count {
    padding: 10px 15px;
    margin: 12px 0;
    font-size: 0.95rem;
    color: #444;
    background-color: #fff;
    border-left: 5px solid var(--brand); /* 使用您定義的紅色 */
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.result-count strong {
    color: var(--brand);
    font-size: 1.1rem;
    margin: 0 4px;
}
