﻿.search-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 頂部簡易搜尋 */
.top-search-bar {
    margin-bottom: 24px;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

    .top-search-bar .input-wrapper {
        display: flex;
        gap: 10px;
    }

.top-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.top-btn {
    background-color: #0f766e;
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: 8px;
    cursor: pointer;
}

/* --- 佈局：左側邊欄 + 右側內容 --- */
.search-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}

/* 左側篩選 */
.filter-sidebar {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    height: fit-content;
}

.filter-group {
    margin-bottom: 24px;
}

.filter-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: #1e293b;
}

.form-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.filter-tag {
    display: inline-block;
    padding: 4px 10px;
    margin: 0 4px 6px 0;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #475569;
    text-decoration: none;
}

    .filter-tag.active {
        background: #0f766e;
        color: #fff;
    }

/* 右側卡片 */
.result-header {
    margin-bottom: 16px;
    font-size: 1.1rem;
    color: #475569;
}

.clinic-card {
    display: flex;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    gap: 20px;
}

    .clinic-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px -5px rgba(0,0,0,0.08);
    }

.c-img img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f5f9;
}

.c-content {
    flex: 1;
}

.c-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.c-name a {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
}

.badge-online {
    background: #dcfce7;
    color: #166534;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.c-rating {
    color: #f59e0b; /* Amber */
    font-weight: 700;
    margin-bottom: 8px;
}

.review-count {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.9rem;
}

.c-address {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.c-tag {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 6px;
}

.c-action {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 120px;
}

.btn-book {
    display: block;
    text-align: center;
    background: #0f766e;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

    .btn-book:hover {
        background: #115e59;
    }

    .btn-book.disabled {
        background: #cbd5e1;
        cursor: default;
    }

/* RWD */
@media (max-width: 768px) {
    .search-layout {
        grid-template-columns: 1fr; /* 變單欄 */
    }

    .clinic-card {
        flex-direction: column; /* 卡片變直向 */
    }

    .c-img img {
        width: 100%;
        height: 160px;
    }

    .c-action {
        width: 100%;
        margin-top: 10px;
    }
}

/* 左側篩選 Sidebar 優化 */
.filter-sidebar {
    background: #fff;
    padding: 0; /* 內距移給 scroll-area */
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    /* ✅ 關鍵：Sticky 定位與高度限制 */
    position: sticky;
    top: 20px; /* 距離視窗頂部 */
    max-height: calc(100vh - 40px); /* 限制高度，留上下邊距 */
    overflow: hidden; /* 防止外框出現捲軸 */
    display: flex;
    flex-direction: column;
}

/* 內部捲動區塊 */
.filter-scroll-area {
    padding: 20px;
    overflow-y: auto; /* ✅ 內容過長時，只有這裡會捲動 */
    /* 美化捲軸 (Chrome/Safari) */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

    .filter-scroll-area::-webkit-scrollbar {
        width: 6px;
    }

    .filter-scroll-area::-webkit-scrollbar-thumb {
        background-color: #cbd5e1;
        border-radius: 3px;
    }

/* Tag 按鈕化 (為了配合 JS submit) */
.filter-tag {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 4px 8px 0;
    background: #f1f5f9;
    border: 1px solid #e2e8f0; /* 加邊框更有按鈕感 */
    border-radius: 20px; /* 變圓一點 */
    font-size: 0.85rem;
    color: #475569;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

    .filter-tag:hover {
        background-color: #e2e8f0;
    }

    .filter-tag.active {
        background: #0f766e;
        color: #fff;
        border-color: #0f766e;
    }

/* --- 分頁控制列 (Pagination) --- */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.page-btn {
    padding: 8px 20px;
    border: 1px solid #cbd5e1;
    background-color: #fff;
    border-radius: 8px;
    color: #334155;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .page-btn:hover:not(:disabled) {
        background-color: #f1f5f9;
        border-color: #94a3b8;
    }

    .page-btn:disabled {
        background-color: #f8fafc;
        color: #cbd5e1;
        border-color: #e2e8f0;
        cursor: not-allowed;
    }

.page-select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

/* RWD: 手機版調整 */
@media (max-width: 768px) {
    /* 手機版 Sidebar 不做 Sticky 與限高，改為一般流式佈局或收折 */
    .filter-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .pagination-bar {
        gap: 10px;
    }

    .page-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}