body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 固定頂部區域樣式 */
.sticky-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
}

.property-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 5%;
    padding-bottom: 80px;
}

/* 电脑端调整左右边距与首页一致 */
@media (min-width: 768px) {
    .main-container {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 30px;
        margin: 20px 5%;
        padding: 0 50px;
    }

    .desktop-filter-section {
        grid-column: 1;
        grid-row: 1;
    }

    .main-content {
        grid-column: 1;
        grid-row: 2;
    }

    .sidebar {
        grid-column: 2;
        grid-row: 1 / -1;
        width: 320px;
    }
}

/* 內容區域樣式 */
.content-wrapper {
    padding-top: 0px; /* 為固定區域留出空間 */
}

.property-header {
    margin-bottom: 30px;
}

/* 固定頂部搜尋和篩選欄 */
.sticky-header {
    /* 移除sticky，現在由sticky-wrapper處理 */
    background: #f5f5f5;
    padding: 15px 0;
    margin: 10px 0 15px 0;
    /* box-shadow: 0 2px 10px rgba(0,0,0,0.1); */
}

/* 電腦端隱藏手機版篩選區域 */
@media (min-width: 768px) {
    .sticky-header {
        display: none;
    }
}

.sticky-header .search-box {
    margin-bottom: 15px;
}

/* 篩選欄優化 - 點擊展開 */
.filter-content {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.filter-content.active {
    display: block;
    max-height: 500px;
    transition: max-height 0.3s ease-in;
    /* overflow-y: auto; */
}

.filter-tab {
    cursor: pointer;
    user-select: none;
}

.filter-tab.active {
    background: #86ebff;
    color: white;
    border-color: #86ebff;
}

.property-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-top: 0px;
    margin-bottom: 10px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.search-button {
    padding: 12px 24px;
    background: #86ebff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-button:hover {
    background: #7a1bd2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

.filter-section {
    background: white;
    padding: 0px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-tabs {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.filter-tab {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-tab.active {
    background: #86ebff;
    color: white;
    border-color: #86ebff;
}

.filter-content {
    display: none;
}

.filter-content.active {
    display: block;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    /* 動態高度調整 */
    min-height: 42px;
    max-height: 200px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

/* 選項數量較多時自動調整高度 */
.filter-select.many-options {
    max-height: 300px;
}

.filter-select.lots-options {
    max-height: 400px;
}

.filter-select.very-many-options {
    max-height: 500px;
}

.custom-inputs {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.custom-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.sub-filter-group {
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid #eee;
}

.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

.filter-button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.filter-apply {
    background: #86ebff;
    color: white;
}

.filter-reset {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.filter-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nested-select {
    margin-top: 5px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.property-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    margin: 10px;
    position: relative;
}

.favorite-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 10;
}

.favorite-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.favorite-button.active {
    color: #ff6b6b;
}

.favorite-button:not(.active) {
    color: #ccc;
}

.property-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.property-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.property-image-small {
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 8px;
}

.property-image-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-content {
    padding: 0px 16px 16px 16px;
}

.property-title-card {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.property-price {
    /* font-size: 20px; */
    font-weight: bold;
    color: black;
    margin-bottom: 8px;
}

.property-info {
    /* display: flex; */
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.property-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.feature-tag {
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    color: #495057;
}

.no-properties {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-properties-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 區域篩選左右分欄樣式 */
.region-selector-container {
    border: 1px solid #ddd;
    overflow: hidden;
    background: white;
}

.region-columns {
    display: flex;
    height: 300px;
}

.region-column {
    flex: 1;
    overflow-y: auto;
    border-right: 1px solid #eee;
}

.region-column:last-child {
    border-right: none;
}

.region-option {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.3s;
    font-size: 14px;
}

.region-option:hover {
    background: #f8f9fa;
}

.region-option.active {
    background: #86ebff;
    color: black;
    font-weight: bold;
}

.region-sub-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    color: #666;
}

.region-sub-option {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.3s;
    font-size: 13px;
}

.region-sub-option:hover {
    background: #f8f9fa;
}

.region-sub-option.active {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: bold;
}

.region-sub-option.has-children::after {
    content: "›";
    float: right;
    color: #999;
}

.region-sub-sub-options {
    margin-left: 16px;
    border-left: 2px solid #eee;
}

.region-sub-sub-option {
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.3s;
    font-size: 12px;
}

.region-sub-sub-option:hover {
    background: #f8f9fa;
}

.region-sub-sub-option.active {
    background: #e3f2fd;
    color: #1976d2;
}

@media (max-width: 768px) {
    .property-grid {
        grid-template-columns: 1fr;
    }

    .property-container {
        padding: 0px;
        padding-bottom: 80px;
    }

    /* 手機端調整 sticky header */
    .sticky-header {
        margin: 5px 0 10px 0; /* 減少手機端邊距 */
        padding: 0px 0; /* 減少手機端內邊距 */
    }

    /* 手機版保持左右分欄，但調整寬度和高度 */
    .region-columns {
        flex-direction: row;
        height: 250px;
    }

    .region-column {
        flex: 1;
        height: 100%;
    }

    /* 手機版調整字體大小 */
    .region-option {
        padding: 10px 12px;
        font-size: 13px;
    }

    .region-sub-option {
        padding: 8px 12px;
        font-size: 12px;
    }

    .region-sub-sub-option {
        padding: 6px 12px;
        font-size: 11px;
    }

    .region-sub-header {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* 多選功能樣式 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-label span {
    flex: 1;
}

/* 單選按鈕樣式 */
.radio-group {
    display: flex;
    gap: 16px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 超小屏幕進一步調整 */
@media (max-width: 480px) {
    .region-columns {
        height: 200px;
    }

    .region-option {
        padding: 8px 10px;
        font-size: 12px;
    }

    .region-sub-option {
        padding: 6px 10px;
        font-size: 11px;
    }

    .region-sub-sub-option {
        padding: 4px 10px;
        font-size: 10px;
    }

    .region-sub-header {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* 手機版多選調整 */
    .checkbox-group {
        max-height: 150px;
        padding: 6px;
    }

    .checkbox-label {
        font-size: 13px;
    }

    .radio-group {
        flex-direction: column;
        gap: 8px;
        padding: 6px;
    }

    .radio-label {
        font-size: 13px;
    }

    /* 手機端自訂價格輸入框調整 */
    .custom-inputs {
        gap: 6px;
        padding: 10px;
    }

    .custom-input {
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
    }
}

/* 已選擇篩選條件顯示樣式 */
.selected-filters {
    margin-bottom: 15px;
}

.selected-filters-header {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.selected-filters-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    border: 1px solid #bbdefb;
    transition: all 0.3s ease;
}

.filter-tag:hover {
    background: #bbdefb;
    border-color: #90caf9;
}

.filter-label {
    font-weight: 500;
    margin-right: 4px;
}

.filter-value {
    font-weight: 400;
}

.filter-remove {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    margin-left: 6px;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.filter-remove:hover {
    background: rgba(25, 118, 210, 0.1);
    color: #0d47a1;
}

.clear-all-filters {
    background: #f44336;
    color: white;
    border: 1px solid #f44336;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.clear-all-filters:hover {
    background: #d32f2f;
    border-color: #d32f2f;
    transform: translateY(-1px);
}

/* 手機端調整已選擇篩選條件 */
@media (max-width: 768px) {
    .selected-filters-tags {
        gap: 6px;
    }

    .filter-tag {
        padding: 5px 10px;
        font-size: 12px;
    }

    .filter-remove {
        font-size: 14px;
        width: 14px;
        height: 14px;
        margin-left: 4px;
    }

    .clear-all-filters {
        padding: 6px 12px;
        font-size: 12px;
        margin-left: 4px;
    }

    /* 手機端讓篩選按鈕sticky */
    .filter-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 5px 0;
        border-top: 1px solid #eee;
        margin-top: 20px;
        margin-bottom: -15px; /* 抵消padding */
    }
}

/* 桌面端專用篩選區域樣式 */
.desktop-filter-section {
    display: none;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .desktop-filter-section {
        display: block;
    }
}

.desktop-filter-container {
    max-width: 1400px;
    /* margin: 10px 5%; */
    padding: 10px 0 10px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
}

.desktop-filter-top {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 0 10px;
}

.desktop-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    flex: 1;
}

.desktop-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.desktop-search-input:focus {
    outline: none;
    border-color: #86ebff;
    box-shadow: 0 0 0 3px rgba(134, 235, 255, 0.1);
}

.desktop-search-button {
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.desktop-search-button:hover {
    background: #7a1bd2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

/* 主要篩選區域 */
.desktop-main-filters {
    /* display: flex; */
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
    padding: 0 10px;
}

.desktop-filter-group {
    display: flex;
    flex-direction: column;
    /* gap: 10px; */
    min-width: 200px;
    flex: 1;
}

.desktop-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.desktop-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.desktop-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.desktop-sub-options {
    border-top: 1px solid #e1e5e9;
    padding-top: 8px;
    margin-top: 8px;
}

.desktop-filter-option {
    border-radius: 4px;
    background: white;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.desktop-filter-option:hover {
    border-color: #86ebff;
    background: #f8f9fa;
}

.desktop-filter-option.active {
    background: white;
    border-color: #007bff;
    color: #007bff;
    font-weight: 600;
}

.desktop-area-type-option {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.desktop-area-type-option:hover {
    background: #e9ecef;
}

.desktop-area-type-option.active {
    background: #f8f9fa;
    color: #86ebff;
    border-color: #86ebff;
    font-weight: 600;
}

/* 自訂輸入框樣式 */
.desktop-custom-inputs {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.desktop-custom-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

/* 電腦版佈局樣式 - 現在使用 Grid 佈局 */
@media (min-width: 768px) {
    /* Grid 佈局已在上面定義，這裡保留其他樣式 */

    /* 側邊欄樣式 */
    .sidebar-widget {
        background: white;
        border-radius: 15px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    .widget-title {
        font-size: 18px;
        color: #333;
        margin-top: 0;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #f0f0f0;
        font-weight: bold;
    }

    /* 房產項目樣式 */
    .property-item-sidebar {
        cursor: pointer;
        display: flex;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .property-item-sidebar:last-child {
        border-bottom: none;
    }

    .property-image-small {
        width: 60px;
        height: 60px;
        overflow: hidden;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .property-image-small img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .property-info {
        display: block;
    }

    .property-title-sidebar {
        font-size: 14px;
        font-weight: 600;
        color: #333;
        margin-bottom: 4px;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    .property-price {
        font-size: 15px;
        color: red;
        font-weight: 600;
        margin-bottom: 2px;
    }

    .property-price-side {
        font-size: 13px;
        color: red;
        font-weight: 600;
        margin-bottom: 2px;
    }

    .property-location {
        font-size: 12px;
        color: #666;
    }

    .no-data-message {
        text-align: center;
        padding: 20px;
        color: #999;
        font-style: italic;
    }

    /* 聯絡信息樣式 */
    .contact-info {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .contact-item {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .contact-text {
        font-size: 14px;
        color: #333;
    }
}

/* 手機版隱藏側邊欄 */
@media (max-width: 767px) {
    .sidebar {
        display: none;
    }
}

/* 更多篩選區域 */
.desktop-more-filters {
    margin-top: 20px;
}

.desktop-more-filters-content {
    /* display: grid; */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.desktop-more-filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.desktop-more-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.desktop-more-filter-select {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.desktop-more-filter-select:focus {
    outline: none;
    border-color: #86ebff;
    box-shadow: 0 0 0 3px rgba(134, 235, 255, 0.1);
}

.desktop-more-filter-select:hover {
    border-color: #86ebff;
}

/* 複選框組樣式 */
.desktop-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.desktop-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    /* padding: 4px 8px; */
    border-radius: 4px;
    transition: all 0.3s ease;
}

.desktop-checkbox-label:hover {
    background: rgba(134, 235, 255, 0.1);
}

.desktop-checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.desktop-checkbox-label span {
    flex: 1;
}

/* 篩選動作按鈕 */
.desktop-filter-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 0 10px;
}

.desktop-reset-btn {
    padding: 10px 20px;
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.desktop-reset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.desktop-apply-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: 2px solid #007bff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.desktop-apply-btn:hover {
    background: #7a1bd2;
    border-color: #7a1bd2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}
