/* ============================================================
   全站共用樣式：重置、標題列、分類列、麵包屑、商品格線、頁尾
   RWD：768px 以下為平板／手機版型
   ============================================================ */

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

body {
    font-family: "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
    font-size: 15px;
    line-height: 1.5;
}

a { color: inherit; }

/* ---------- 頂部歡迎列 ---------- */
.topbar {
    background: #1868db;
    color: #fff;
    font-size: 13px;
    padding: 6px 20px;
    text-align: right;
}
.topbar a { color: #fff; text-decoration: none; margin-left: 16px; }
.topbar a:hover { text-decoration: underline; }

/* ---------- 主導航列：logo + 搜尋 ---------- */
.site-header {
    background: #1868db;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.site-logo {
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.search-form {
    flex: 1 1 240px;
    display: flex;
    max-width: 600px;
    min-width: 160px;
}
.search-form input {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 3px 0 0 3px;
    font-size: 14px;
    min-width: 0;
}
.search-form button {
    background: #f5f5f5;
    border: none;
    padding: 9px 16px;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
    color: #1868db;
    font-weight: bold;
    font-size: 14px;
}

/* ---------- 分類列 ---------- */
.category-bar {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 10px 20px;
    display: flex;
    gap: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.category-bar a {
    color: #555;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}
.category-bar a:hover, .category-bar a.active { color: #1868db; font-weight: bold; }

/* ---------- 麵包屑（全站統一：首頁 / 分類 or 首頁 / 二手交換區）---------- */
.breadcrumb {
    max-width: 1200px;
    margin: 14px auto 0;
    padding: 0 20px;
    font-size: 13px;
    color: #888;
}
.breadcrumb a { color: #1868db; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- 商品格線 ---------- */
.container { max-width: 1200px; margin: 16px auto; padding: 0 20px; }
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}
.product-card {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: #222;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    transition: box-shadow 0.15s;
}
.product-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.product-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 13px;
    overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding: 10px; }
.product-name {
    font-size: 14px;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    margin-bottom: 6px;
}
.product-price { color: #1868db; font-weight: bold; font-size: 16px; }
.badge {
    display: inline-block;
    background: #1868db;
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 5px;
}
.badge-hot {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 5px;
    margin-left: 6px;
}
.badge-gray {
    display: inline-block;
    background: #9ca3af;
    color: #fff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 5px;
    margin-left: 6px;
}

.empty-state { text-align: center; padding: 60px 20px; color: #999; font-size: 15px; }

/* ---------- 頁尾 ---------- */
.site-footer {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 28px 16px;
}

/* ============================================================
   RWD：手機／平板（寬度 768px 以下）
   ============================================================ */
@media (max-width: 768px) {
    body { font-size: 16px; }

    .topbar { padding: 8px 14px; font-size: 13px; }
    .topbar a { margin-left: 12px; }

    .site-header {
        padding: 12px 14px;
        gap: 10px;
    }
    .site-logo { font-size: 19px; }
    .search-form { flex: 1 1 100%; order: 3; max-width: none; }
    .search-form input { padding: 10px 12px; font-size: 15px; }
    .search-form button { padding: 10px 14px; font-size: 15px; }

    .category-bar { padding: 10px 14px; gap: 16px; }
    .category-bar a { font-size: 15px; }

    .breadcrumb { padding: 0 14px; font-size: 13px; }

    .container { padding: 0 14px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .product-name { font-size: 14px; }
    .product-price { font-size: 15px; }
}

@media (max-width: 420px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   會員驗證頁面（登入／註冊／忘記密碼／改密碼）
   ============================================================ */
.auth-page { background: #f5f5f5; min-height: 100vh; }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 40px 20px; }
.auth-logo {
    display: block; text-align: center; font-size: 26px; font-weight: bold;
    color: #1868db; text-decoration: none; margin-bottom: 24px;
}
.auth-card { background: #fff; border-radius: 10px; padding: 32px 28px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; text-align: center; }
.auth-sub { text-align: center; color: #888; font-size: 13px; margin-bottom: 24px; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-weight: bold; font-size: 13px; margin-bottom: 6px; color: #333; }
.auth-field input[type=text], .auth-field input[type=email], .auth-field input[type=password] {
    width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; box-sizing: border-box;
}
.auth-field input:focus { outline: none; border-color: #1868db; }
.auth-fieldset { border: 1px solid #e6eefc; border-radius: 8px; padding: 14px; margin: 18px 0; background: #f8faff; }
.auth-fieldset legend { padding: 0 6px; font-size: 13px; font-weight: bold; color: #1868db; }
.auth-btn {
    width: 100%; background: #1868db; color: #fff; border: none; padding: 13px;
    border-radius: 6px; font-size: 15px; font-weight: bold; cursor: pointer; margin-top: 8px;
}
.auth-btn:hover { background: #1454b3; }
.auth-error { color: #c0392b; font-size: 12px; margin-top: 5px; }
.auth-message { padding: 12px; border-radius: 6px; margin-bottom: 18px; font-size: 13px; text-align: center; }
.auth-message-success { background: #e6f4ea; color: #1e7e34; }
.auth-message-error { background: #fde8e8; color: #c0392b; }
.auth-links { text-align: center; margin-top: 18px; font-size: 13px; }
.auth-links a { color: #1868db; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-links-row { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; }
.auth-hint { color: #999; font-size: 12px; margin-top: 4px; }

@media (max-width: 480px) {
    .auth-wrap { padding: 24px 16px; }
    .auth-card { padding: 24px 18px; }
}
