/* Technicians Page Styles - Ported from technicians.php.UI完整版 */

:root {
    --tech-gold: var(--color-primary);
    --tech-gold-dark: var(--color-primary-dark);
    --tech-bg: var(--bg-body);
    --tech-card-radius: 20px;
    /* 圓潤風格 */
    --text-main: #333;
    --text-muted: #666;
}

body {
    background-color: var(--tech-bg);
}

/* 讓找職人頁在固定導覽列下方保留足夠頂部空間 */
.main-layout {
    margin-top: 40px;
}

/* =========================================
   3. 佈局容器 (Sidebar + Content) - 響應式
   ========================================= */
.main-layout {
    width: 100%;
    display: flex;
    gap: 20px;
    position: relative;
    flex-wrap: wrap;
}

@media (min-width: 992px) {
    .main-layout {
        gap: 40px;
        flex-wrap: nowrap;
    }
}

/* 側邊欄樣式 */
.sidebar-wrapper {
    width: 100%;
    flex-shrink: 0;
    order: 1;
    margin-bottom: 20px;
}

@media (min-width: 992px) {
    .sidebar-wrapper {
        width: 260px;
        min-width: 260px;
        max-width: 260px;
        order: 1;
        margin-bottom: 0;
    }
}

/* 手機版：隱藏側邊欄，改用抽屜式 */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        display: none;
    }
}

/* 主內容區 */
main.flex-grow-1 {
    flex: 1;
    min-width: 0;
    order: 2;
    width: 100%;
}

@media (min-width: 992px) {
    main.flex-grow-1 {
        order: 2;
    }
}

/* 手機版：主內容區全寬 */
@media (max-width: 991.98px) {
    .main-layout {
        flex-direction: column;
    }

    main.flex-grow-1 {
        width: 100%;
    }
}

/* 桌面版：隱藏手機版篩選抽屜 */
@media (min-width: 992px) {

    .filter-overlay,
    .filter-drawer {
        display: none !important;
    }
}

/* 手機版：篩選抽屜式設計 */
@media (max-width: 991.98px) {

    /* 篩選抽屜遮罩 */
    .filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9999;
        opacity: 0;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .filter-overlay.active {
        display: block;
        opacity: 1;
    }

    /* 篩選抽屜面板 */
    .filter-drawer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        background: #fff;
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 10000;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
        -webkit-overflow-scrolling: touch;
    }

    .filter-drawer.active {
        transform: translateY(0);
    }

    /* 抽屜打開時，禁用背景滾動 */
    body.filter-drawer-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    .filter-drawer-header {
        position: sticky;
        top: 0;
        background: #fff;
        padding: 16px 20px;
        border-bottom: 1px solid #eee;
        display: flex;
        align-items: center;
        justify-content: space-between;
        z-index: 10;
    }

    .filter-drawer-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: #333;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .filter-drawer-close {
        width: 36px;
        height: 36px;
        border: none;
        background: #f5f5f5;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .filter-drawer-close:hover {
        background: var(--tech-gold);
        color: #fff;
    }

    .filter-drawer-body {
        padding: 20px;
        padding-bottom: 100px;
        /* 為底部按鈕留出空間 */
    }

    .filter-drawer .sidebar-box {
        box-shadow: none;
        border: none;
        padding: 0;
        background: transparent;
    }

    .filter-drawer .filter-group {
        margin-bottom: 24px;
    }

    .filter-drawer .filter-title {
        font-size: 0.9rem;
        margin-bottom: 12px;
        color: #333;
        font-weight: 600;
    }

    .filter-drawer .filter-label {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
        padding: 8px 0;
        cursor: pointer;
        font-size: 0.95rem;
        color: #555;
    }

    .filter-drawer .filter-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: var(--tech-gold);
        cursor: pointer;
    }

    .filter-drawer .form-control {
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .filter-drawer .form-control:focus {
        border-color: var(--tech-gold);
        box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.1);
        outline: none;
    }

    .filter-drawer-footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 16px 20px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        border-top: 1px solid #eee;
        display: flex;
        gap: 12px;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    }

    .filter-drawer-footer .btn {
        flex: 1;
        padding: 12px;
        font-weight: 600;
        border-radius: 8px;
        font-size: 0.95rem;
    }

    .filter-drawer-footer .btn-outline-secondary {
        border: 1.5px solid #e0e0e0;
        color: #666;
    }

    .filter-drawer-footer .btn-outline-secondary:active {
        background: #f5f5f5;
    }

    .filter-drawer-footer .btn-dark {
        background: var(--tech-gold);
        border: none;
        color: #fff;
    }

    .filter-drawer-footer .btn-dark:active {
        background: var(--tech-gold-dark);
    }
}

.sidebar-box {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 992px) {
    .sidebar-box {
        position: sticky;
        top: 140px;
        padding: 24px;
        max-height: calc(100vh - 160px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* 桌面版側邊欄滾動條樣式 */
    .sidebar-box::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar-box::-webkit-scrollbar-track {
        background: #f5f5f5;
        border-radius: 4px;
    }

    .sidebar-box::-webkit-scrollbar-thumb {
        background: var(--tech-gold);
        border-radius: 4px;
    }

    .sidebar-box::-webkit-scrollbar-thumb:hover {
        background: var(--tech-gold-dark);
    }
}

/* 篩選區塊主標題樣式 */
.sidebar-box>.filter-title:first-child {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-box>.filter-title:first-child i {
    color: var(--tech-gold);
}

.filter-group {
    margin-bottom: 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.filter-group:last-of-type {
    margin-bottom: 20px;
}

/* 確保表單元素寬度正確 */
.filter-group .form-control,
.filter-group input[type="text"],
.filter-group input[type="text"].form-control {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

/* 確保標籤正確顯示 */
.filter-group label.filter-label {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
    color: #666;
    font-size: 0.9rem;
    text-transform: none;
    width: 100%;
    box-sizing: border-box;
}

.filter-title.small {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 10px;
    width: 100%;
}

.filter-title.text-muted {
    color: #666 !important;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    margin-left: 0;
    margin-right: 0;
    cursor: pointer;
    color: #555;
    font-size: 0.9rem;
    padding: 6px 0;
    transition: color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.filter-label:hover {
    color: var(--tech-gold);
}

.filter-label input[type="checkbox"] {
    accent-color: var(--tech-gold);
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.filter-label input[type="checkbox"]+span,
.filter-label:has(input[type="checkbox"]) {
    flex: 1;
}

/* 二級篩選樣式 */
.location-filter-item {
    margin-bottom: 4px;
}

.location-city-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.location-city-name {
    flex: 1;
}

.location-chevron {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease, color 0.2s ease;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
}

.location-chevron:hover {
    color: var(--tech-gold);
}

.location-districts {
    margin-top: 4px;
    margin-left: 0;
    padding-left: 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.location-district-label {
    font-size: 0.85rem;
    color: #777;
    padding-left: 24px !important;
}

.location-district-label:hover {
    color: var(--tech-gold);
}

/* 表單輸入框樣式 */
.sidebar-box .form-control {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.sidebar-box .form-control:focus {
    border-color: var(--tech-gold);
    box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.1);
    outline: none;
}

.sidebar-box .form-control-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* 按鈕樣式 */
.sidebar-box .btn {
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    display: block;
}

.sidebar-box .btn-dark {
    background: var(--tech-gold);
    border: none;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
}

.sidebar-box .btn-dark:hover {
    background: var(--tech-gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(170, 145, 119, 0.3);
}

.sidebar-box .btn-outline-secondary {
    border: 1.5px solid #e0e0e0;
    color: #666;
    padding: 12px 20px;
    border-radius: 8px;
    background: #fff;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.sidebar-box .btn-outline-secondary:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
    color: #333;
    text-decoration: none;
}

/* 確保表單結構正確 */
.sidebar-box form {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar-box form>* {
    box-sizing: border-box;
}

/* 隱藏欄位樣式 */
.sidebar-box form input[type="hidden"] {
    display: none;
}

/* 確保按鈕間距正確 */
.sidebar-box form .btn {
    margin-top: 0;
}

.sidebar-box form .btn+.btn,
.sidebar-box form .btn+a,
.sidebar-box form a+.btn {
    margin-top: 12px;
}

/* 清除篩選按鈕樣式 */
.sidebar-box a.btn {
    text-align: center;
    text-decoration: none;
}

/* 確保所有元素都有正確的寬度 */
.sidebar-box * {
    max-width: 100%;
}

/* =========================================
   4. Top 10 橫向滾動 - 響應式支援
   ========================================= */
.top10-section {
    margin-bottom: 50px;
    position: relative;
}

.top10-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}

.top10-controls {
    display: flex;
    gap: 8px;
}

.top10-scroll-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(170, 145, 119, 0.2);
    background: white;
    color: var(--tech-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.top10-scroll-btn:hover {
    border-color: var(--tech-gold);
    background: var(--tech-gold);
    color: white;
    transform: scale(1.05);
}

.top10-scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.top10-wrapper {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 5px 25px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--tech-gold) rgba(170, 145, 119, 0.1);
}

.top10-wrapper::-webkit-scrollbar {
    height: 6px;
}

.top10-wrapper::-webkit-scrollbar-track {
    background: rgba(170, 145, 119, 0.1);
    border-radius: 4px;
}

.top10-wrapper::-webkit-scrollbar-thumb {
    background: var(--tech-gold);
    border-radius: 4px;
}

.top10-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--tech-gold-dark);
}

/* 手機版隱藏滾動條但保留功能 */
@media (max-width: 767.98px) {
    .top10-wrapper {
        scrollbar-width: none;
    }

    .top10-wrapper::-webkit-scrollbar {
        display: none;
    }

    .top10-controls {
        display: none;
        /* 手機版使用觸控滑動 */
    }
}

.top10-card {
    min-width: 200px;
    width: 200px;
    flex-shrink: 0;
    position: relative;
    /* 確保按鈕定位正確 */
    overflow: hidden;
    /* 隱藏超出範圍的按鈕 */
    display: flex;
    flex-direction: column;
    height: 100%;
    /* 確保所有 Top 10 卡片高度一致 */
    min-height: 380px;
    /* 確保 Top 10 卡片有固定的最小高度 */
}

@media (min-width: 768px) {
    .top10-card {
        min-width: 220px;
        width: 220px;
    }
}

@media (min-width: 992px) {
    .top10-card {
        min-width: 240px;
        width: 240px;
    }
}

/* Top 10 卡片標籤樣式 */
.top10-card .tech-tags {
    margin-bottom: 10px;
    gap: 6px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-height: 24px;
    max-height: 50px;
    overflow: hidden;
}

.top10-card .tech-tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    background: #f5f5f5;
    color: #666;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Top 10 卡片內容區域 */
.top10-card .tech-info {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.top10-card .tech-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.2rem * 1.3 * 2);
}

/* Top 10 卡片按鈕樣式 */
.top10-card .tech-hover-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: 12px;
    display: flex;
    gap: 8px;
    backdrop-filter: blur(5px);
    border-top: 1px solid #eee;
    z-index: 5;

    /* Desktop: 預設隱藏 */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Desktop Hover */
@media (min-width: 992px) {
    .top10-card:hover .tech-hover-actions {
        transform: translateY(0);
    }
}

/* Mobile: 常駐顯示 */
@media (max-width: 991px) {
    .top10-card .tech-tags {
        margin-bottom: 8px;
        display: flex;
        /* 手機版也顯示標籤 */
    }

    .top10-card .tech-tag {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .top10-card .tech-hover-actions {
        position: static;
        transform: none;
        padding: 10px;
        display: flex;
        background: #fff;
        border-top: 1px solid #eee;
    }

    .top10-card .tech-btn {
        padding: 10px 0;
        font-size: 0.85rem;
        min-height: 44px;
    }
}

/* Top 10 卡片點擊優化 */
.top10-card {
    cursor: pointer;
}

.top10-card:active {
    transform: scale(0.98);
}

@media (min-width: 992px) {
    .top10-card:hover {
        transform: translateY(-5px);
    }

    .top10-card:active {
        transform: translateY(-3px) scale(0.98);
    }
}

/* =========================================
   5. 卡片設計 (核心重點 - 復刻截圖) - 響應式
   ========================================= */

/* 職人卡片網格 - 響應式佈局優化 */
.tech-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(2, 1fr);
    /* 手機：2欄 */
    grid-auto-rows: 1fr;
    /* 確保所有行高度一致 */
}

/* 平板：3欄 */
@media (min-width: 768px) {
    .tech-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

/* 中等螢幕 (1200-1399px)：保持 3 欄，避免擁擠 */
@media (min-width: 1200px) and (max-width: 1399px) {
    .tech-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }
}

/* 大螢幕 (≥1400px)：4欄 */
@media (min-width: 1400px) {
    .tech-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

.tech-card {
    background: #fff;
    border-radius: var(--tech-card-radius);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    /* 淡淡的邊框 */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    /* 截圖中的陰影很淡 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    height: 100%;
    /* 確保卡片填滿網格單元格 */
    min-height: 0;
    /* 允許 flex 子元素收縮 */
    /* 確保所有卡片有相同的最小高度 */
    min-height: 450px;
}

@media (max-width: 767.98px) {
    .tech-card {
        min-height: 400px;
        /* 手機版稍小 */
    }
}

@media (min-width: 992px) {
    .tech-card {
        min-height: 480px;
        /* 桌面版稍大 */
    }
}

.tech-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(170, 145, 119, 0.15);
    border-color: var(--tech-gold);
}

/* 圖片區域 */
.tech-img-box {
    position: relative;
    padding-top: 110%;
    /* 截圖是長方形，稍微高一點 */
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
    /* 防止圖片區域被壓縮 */
    width: 100%;
    height: 0;
    /* 配合 padding-top 實現固定比例 */
}

.tech-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s ease;
}

.tech-card:hover .tech-img {
    transform: scale(1.05);
}

/* 認證 Badge (截圖右上角) */
.verified-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #fff;
    color: var(--color-primary-dark);
    /* 棕色文字 */
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 贊助標籤（低調但可見） */
.sponsored-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(170, 145, 119, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
}

/* 贊助職人卡片特殊樣式 */
.tech-card.sponsored-card {
    border: 1.5px solid rgba(170, 145, 119, 0.3);
    position: relative;
}

.tech-card.sponsored-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tech-gold) 0%, rgba(170, 145, 119, 0.3) 100%);
    z-index: 1;
}

.tech-card.sponsored-card:hover {
    border-color: var(--tech-gold);
    box-shadow: 0 15px 30px rgba(170, 145, 119, 0.2);
}

/* 內容區域 (截圖下方) */
.tech-info {
    padding: 24px 20px;
    flex: 1 1 auto;
    /* 允許內容區域伸縮 */
    background: #fff;
    text-align: center;
    /* 截圖是置中排版 */
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    /* 允許 flex 子元素收縮 */
    justify-content: flex-start;
    /* 從頂部開始對齊 */
    /* 確保內容區域有固定的最小高度 */
    min-height: 200px;
}

@media (max-width: 767.98px) {
    .tech-info {
        min-height: 180px;
        /* 手機版稍小 */
        padding: 20px 15px;
    }
}

/* 職稱 (藝術美甲) */
.tech-role {
    color: var(--tech-gold);
    /* 金棕色 */
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
    flex-shrink: 0;
    /* 防止被壓縮 */
    line-height: 1.4;
}

/* 姓名 (Anna Chen) - 襯線體 */
.tech-name {
    font-family: 'Noto Serif TC', serif;
    /* 使用襯線體增加質感 */
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
    flex-shrink: 0;
    /* 防止被壓縮 */
    line-height: 1.3;
    /* 限制行數，防止過長名稱 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.5rem * 1.3 * 2);
    /* 兩行的高度 */
}

/* 標籤 (手繪暈染 / 指甲矯正) */
.tech-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    flex-shrink: 0;
    /* 防止被壓縮 */
    min-height: 28px;
    /* 確保標籤區域有最小高度 */
    max-height: 60px;
    /* 限制最大高度，防止過多標籤 */
    overflow: hidden;
}

.tech-tag {
    background: #f5f5f5;
    /* 淺灰底 */
    color: #666;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 底部數據列 (分隔線 + 星星 + 資歷) */
.tech-stats-row {
    width: 100%;
    border-top: 1px solid #eee;
    /* 分隔線 */
    padding-top: 15px;
    margin-top: auto;
    /* 推到底部 */
    display: flex;
    justify-content: center;
    gap: 20px;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    flex-shrink: 0;
    /* 防止被壓縮 */
    height: 50px;
    /* 固定高度，確保所有卡片一致 */
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.stat-item i.fa-star {
    color: #FFC107;
}

/* 黃星 */
.stat-item i.fa-briefcase {
    color: #ccc;
}

/* 灰公事包 */

/* --- 互動按鈕 (Desktop: 懸停浮出 / Mobile: 底部顯示) --- */
.tech-hover-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: 15px;
    display: flex;
    gap: 10px;
    backdrop-filter: blur(5px);
    border-top: 1px solid #eee;
    z-index: 5;

    /* Desktop: 預設隱藏 */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 確保按鈕區域不會被點擊穿透 */
.tech-hover-actions * {
    pointer-events: auto;
}

.tech-btn {
    flex: 1;
    border: none;
    padding: 10px 0;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    /* 移除觸控高亮 */
}

.btn-view {
    background: #f0f0f0;
    color: #333;
}

.btn-view:hover {
    background: #e0e0e0;
}

.btn-view:active {
    background: #d0d0d0;
    transform: scale(0.98);
}

.btn-book {
    background: var(--tech-gold);
    color: #fff;
}

.btn-book:hover {
    background: var(--tech-gold-dark);
}

.btn-book:active {
    background: var(--tech-gold-dark);
    transform: scale(0.98);
}

/* 觸控裝置優化 */
@media (hover: none) and (pointer: coarse) {
    .tech-btn {
        min-height: 44px;
        /* 符合觸控標準 */
        font-size: 0.9rem;
    }

    .tech-btn:active {
        opacity: 0.8;
        transform: scale(0.95);
    }
}

/* Desktop Hover */
@media (min-width: 992px) {
    .tech-card:hover .tech-hover-actions {
        transform: translateY(0);
    }
}

/* Mobile Styles - 優化互動 */
@media (max-width: 991px) {
    .tech-card {
        border-radius: 12px;
        /* 手機版圓角稍微小一點 */
    }

    .tech-info {
        padding: 15px 10px;
    }

    .tech-name {
        font-size: 1.2rem;
        max-height: calc(1.2rem * 1.3 * 2);
        /* 兩行的高度 */
    }

    .tech-tags {
        display: flex;
        /* 手機版也顯示標籤 */
        min-height: 24px;
        max-height: 50px;
        overflow: hidden;
    }

    /* 手機版按鈕常駐顯示，優化觸控體驗 */
    .tech-hover-actions {
        position: static;
        transform: none;
        padding: 12px 10px;
        display: flex;
        background: #fff;
        border-top: 1px solid #eee;
        margin-top: auto;
        gap: 8px;
    }

    .tech-btn {
        padding: 12px 0;
        font-size: 0.9rem;
        font-weight: 600;
        min-height: 44px;
        /* 符合觸控標準 */
        border-radius: 6px;
    }

    /* 手機版點擊卡片時提供視覺反饋 */
    .tech-card:active {
        transform: scale(0.98);
    }

    /* 手機版防止按鈕區域觸發卡片點擊 */
    .tech-card {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* 平板樣式 */
@media (min-width: 768px) and (max-width: 991px) {
    .tech-info {
        padding: 20px 15px;
    }

    .tech-name {
        font-size: 1.3rem;
    }
}

/* =========================================
   6. 排序選擇器美化
   ========================================= */
.sort-select-wrapper {
    position: relative;
    display: inline-block;
}

.tech-sort-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: white;
    border: 1.5px solid rgba(170, 145, 119, 0.2);
    border-radius: 8px;
    padding: 8px 36px 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    background-image: none;
}

.tech-sort-select:hover {
    border-color: var(--tech-gold);
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.1);
}

.tech-sort-select:focus {
    outline: none;
    border-color: var(--tech-gold);
    box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.1);
}

.sort-select-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--tech-gold);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.tech-sort-select:focus+.sort-select-icon,
.tech-sort-select:active+.sort-select-icon {
    transform: translateY(-50%) rotate(180deg);
}

/* =========================================
   7. 廣告版位樣式
   ========================================= */
.ad-banner {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.ad-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ad-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ad-banner-horizontal {
    height: 120px;
}

.ad-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 10;
}

.sponsored-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(170, 145, 119, 0.85);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.8;
    z-index: 10;
}

@media (max-width: 767.98px) {
    .ad-banner-horizontal {
        height: 100px;
    }

    .ad-label,
    .sponsored-label {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
}

/* =========================================
   8. 手機版搜尋列、篩選
   ========================================= */
.mobile-search-bar {
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

/* 手機版：搜尋列固定在頂部 */
@media (max-width: 991.98px) {
    .mobile-search-bar {
        position: sticky;
        top: 0;
        z-index: 1000;
        margin-bottom: 16px;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transition: box-shadow 0.3s ease;
    }

    /* 滾動時增強陰影效果 */
    .mobile-search-bar.scrolled {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }
}

.mobile-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.mobile-search-icon {
    position: absolute;
    left: 12px;
    color: #999;
    font-size: 0.9rem;
    z-index: 1;
}

.mobile-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.9rem;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--tech-gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.1);
}

.mobile-filter-btn {
    width: 44px;
    height: 44px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mobile-filter-btn:hover {
    background: var(--tech-gold);
    color: #fff;
    border-color: var(--tech-gold);
}

.mobile-filter-btn i {
    font-size: 1.1rem;
}

/* =========================================
   9. 手機版贊助技術師區塊
   ========================================= */
.mobile-sponsored-section {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(170, 145, 119, 0.15);
}

.sponsored-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sponsored-badge-small {
    background: var(--tech-gold);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sponsored-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.sponsored-tech-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.sponsored-tech-carousel::-webkit-scrollbar {
    height: 4px;
}

.sponsored-tech-carousel::-webkit-scrollbar-thumb {
    background: var(--tech-gold);
    border-radius: 2px;
}

.sponsored-tech-card {
    min-width: 160px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    scroll-snap-align: start;
}

.sponsored-tech-card:active {
    transform: scale(0.98);
}

.sponsored-tech-img {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.sponsored-tech-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sponsored-overlay-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(170, 145, 119, 0.9);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.sponsored-tech-info {
    padding: 10px;
}

.sponsored-tech-role {
    font-size: 0.75rem;
    color: var(--tech-gold);
    font-weight: 600;
    margin-bottom: 4px;
}

.sponsored-tech-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sponsored-tech-stats {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: #666;
}

.sponsored-tech-stats i {
    font-size: 0.7rem;
    margin-right: 2px;
}

/* =========================================
   10. 排序標籤列（標籤式設計）
   ========================================= */
.sort-tabs-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sort-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sort-tabs::-webkit-scrollbar {
    display: none;
}

.sort-tab {
    flex: 1;
    min-width: fit-content;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.sort-tab:hover {
    background: rgba(170, 145, 119, 0.1);
    color: var(--tech-gold);
}

.sort-tab.active {
    background: var(--tech-gold);
    color: #fff;
    font-weight: 600;
}

.sort-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
}

@media (min-width: 768px) {
    .sort-tabs-wrapper {
        display: none;
        /* 桌面版隱藏標籤，使用下拉選單 */
    }
}

/* 桌面版隱藏手機版元素 */
@media (min-width: 768px) {

    .mobile-search-bar,
    .mobile-sponsored-section {
        display: none;
    }
}

/* 手機版隱藏桌面版排序下拉選單 */
@media (max-width: 767.98px) {
    .sort-select-wrapper {
        display: none;
    }
}

/* 確保Hero Card也是圓角的 */
.hero-card {
    border-radius: var(--tech-card-radius);
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
    margin-bottom: 30px;
}

.hero-overlay {
    background: rgba(0, 0, 0, 0.4);
    padding: 60px 40px;
    text-align: center;
    color: #fff;
}

/* 手機版Hero Card調整 */
@media (max-width: 767.98px) {
    .hero-card {
        border-radius: 0;
        margin-bottom: 20px;
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }

    .hero-overlay {
        padding: 40px 20px;
    }
}

/* 分類標籤 Pills */
.cat-pill {
    display: inline-block;
    padding: 6px 16px;
    margin-right: 8px;
    margin-bottom: 8px;
    background: #f0f0f0;
    border-radius: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.cat-pill:hover {
    background: #e0e0e0;
}

.cat-pill.active {
    background: var(--tech-gold);
    color: white;
}