/* Services Page Specific Styles */

/* 價格範圍滑桿 */
.price-range {
    margin-top: 16px;
}

.price-slider {
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.price-values {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* 服務卡片 */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.service-card {
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.service-image {
    position: relative;
    overflow: hidden;
}

.service-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: var(--transition);
}

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

.service-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary-gradient);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.service-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: var(--transition);
}

.service-card:hover .service-actions {
    opacity: 1;
}

.action-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: white;
    color: var(--primary-color);
    transform: scale(1.1);
}

.service-content {
    padding: 20px;
}

.service-category {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.service-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.service-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.service-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.service-meta i {
    color: var(--primary-color);
    width: 16px;
}

.service-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating-stars {
    color: #ffd700;
}

.service-provider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.provider-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.provider-info {
    flex: 1;
}

.provider-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}

.provider-title {
    font-size: 12px;
    color: var(--text-secondary);
}

.service-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.service-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.price-unit {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
}

.book-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.book-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 視圖切換 */
.view-toggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.view-btn.active,
.view-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================
   消費者服務列表頁面（電商雙欄佈局）
   /pages/services.php
   ============================================ */

:root {
    --service-primary: var(--color-primary, #AA9177);
    --service-bg: var(--bg-body, #f8f7f5);
}

/* ─── 整體容器 ─── */
.services-ecom-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 16px 60px;
}

/* ─── 頁面標題 ─── */
.services-ecom-header {
    margin-bottom: 20px;
}

.services-ecom-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main, #1a1a1a);
    margin-bottom: 4px;
}

.services-ecom-subtitle {
    font-size: 13px;
    color: var(--text-secondary, #888);
}

/* ─── 手機頂部操作列 ─── */
.services-mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #eee);
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid var(--border-color, #eee);
    border-radius: 20px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main, #1a1a1a);
    cursor: pointer;
    white-space: nowrap;
}

.filter-count-badge {
    display: inline-block;
    background: var(--service-primary);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: 700;
}

.mobile-sort-wrap {
    flex: 1;
}

.mobile-sort-wrap .form-select {
    font-size: 13px;
    border-radius: 8px;
}

/* ─── 左欄：篩選面板 ─── */
.filter-panel {
    background: white;
    border: 1px solid var(--border-color, #eee);
    border-radius: 16px;
    padding: 20px;
    position: sticky;
    top: 90px;
}

.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #eee);
}

/* ─── 篩選區塊 ─── */
.filter-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color, #eee);
}

.filter-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main, #1a1a1a);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── 搜尋框 ─── */
.filter-search-wrap {
    position: relative;
}

.filter-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #aaa);
    font-size: 13px;
}

.filter-search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1.5px solid var(--border-color, #eee);
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.filter-search-input:focus {
    border-color: var(--service-primary);
}

/* ─── 篩選選項（單選列表） ─── */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary, #666);
    transition: all 0.15s;
    user-select: none;
}

.filter-option:hover {
    background: var(--service-bg, #f8f7f5);
    color: var(--text-main, #1a1a1a);
}

.filter-option.active {
    background: rgba(170, 145, 119, 0.1);
    color: var(--service-primary);
    font-weight: 600;
}

.filter-option-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--border-color, #ddd);
    flex-shrink: 0;
    transition: all 0.15s;
}

.filter-option.active .filter-option-dot {
    border-color: var(--service-primary);
    background: var(--service-primary);
    box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.2);
}

.filter-option-count {
    font-size: 11px;
    color: var(--text-secondary, #aaa);
    margin-left: auto;
}

/* ─── 找職人 CTA ─── */
.filter-section-cta {
    border-bottom: none !important;
}

.filter-cta-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--service-primary);
    color: white;
    border: none;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
}

.filter-cta-btn:hover {
    opacity: 0.88;
    color: white;
}

/* ─── 右欄：結果區域 ─── */
.services-results-wrap {
    padding-left: 20px;
}

/* ─── 結果列 ─── */
.results-bar {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #eee);
}

.results-count {
    font-size: 14px;
    color: var(--text-secondary, #888);
    font-weight: 500;
}

.results-count strong {
    color: var(--text-main, #1a1a1a);
    font-weight: 700;
}

.results-sort {
    font-size: 13px;
    border-radius: 8px;
    min-width: 120px;
    padding: 6px 10px;
}

/* ─── 已套用篩選 badges ─── */
.active-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(170, 145, 119, 0.1);
    border: 1px solid rgba(170, 145, 119, 0.3);
    border-radius: 20px;
    font-size: 12px;
    color: var(--service-primary);
    font-weight: 500;
}

.filter-badge-remove {
    background: none;
    border: none;
    padding: 0;
    color: var(--service-primary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
}

.filter-badge-remove:hover {
    opacity: 1;
}

/* ─── Service card v2 (ranking design) ─── */
.svc-col-wrap {
    padding-top: 20px;
}

.svc-rank-card {
    background: #FFFFFF;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: visible;
    height: 100%;
    color: inherit;
}

.svc-rank-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.12);
    text-decoration: none;
    color: inherit;
}

.svc-rank-num {
    position: absolute;
    top: -22px;
    left: -10px;
    font-size: 68px;
    font-family: "Arial Black", Impact, sans-serif;
    font-weight: 900;
    font-style: italic;
    line-height: 1;
    z-index: 20;
    color: #FFFFFF;
    -webkit-text-stroke: 2px #D1D5DB;
    text-shadow: 3px 4px 8px rgba(0,0,0,0.15), 0 2px 2px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    pointer-events: none;
    user-select: none;
}

.svc-rank-card:hover .svc-rank-num {
    transform: scale(1.05) rotate(-2deg);
}

.svc-rank-card[data-rank="1"] .svc-rank-num { -webkit-text-stroke: 2px #F59E0B; }
.svc-rank-card[data-rank="2"] .svc-rank-num { -webkit-text-stroke: 2px #94A3B8; }
.svc-rank-card[data-rank="3"] .svc-rank-num { -webkit-text-stroke: 2px #B45309; }

.svc-image-box {
    position: relative;
    width: 100%;
    padding-top: 66%;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.svc-image-box img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.svc-rank-card:hover .svc-image-box img {
    transform: scale(1.04);
}

.svc-badge-cat {
    position: absolute;
    top: 12px;
    left: 44px;
    background: rgba(255,255,255,0.95);
    color: #9A8069;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    z-index: 10;
}

.svc-badge-rec {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #9A8069;
    color: #FFF;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    z-index: 10;
}

.svc-info-box {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.svc-card-title {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.svc-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6B7280;
    font-weight: 500;
}

.svc-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.svc-star-icon { color: #F59E0B; }
.svc-rating-num { color: #F59E0B; font-weight: 700; }

.svc-provider-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6B7280;
    font-weight: 600;
}

.svc-provider-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.svc-provider-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.svc-bottom-action {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 4px;
}

.svc-price-col {
    display: flex;
    flex-direction: column;
}

.svc-old-price {
    font-size: 11px;
    color: #9CA3AF;
    text-decoration: line-through;
    margin-bottom: 2px;
}

.svc-new-price {
    font-size: 22px;
    font-weight: 800;
    color: #DC2626;
    line-height: 1;
}

.svc-new-price span {
    font-size: 14px;
    font-weight: 600;
    margin-right: 2px;
}

.svc-inquire {
    font-size: 13px;
    color: #9CA3AF;
}

.svc-btn-book {
    background-color: #9A8069;
    color: #FFF;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.svc-rank-card:hover .svc-btn-book {
    background-color: #7A6249;
}

/* ─── 載入動畫 ─── */
.loading-container {
    text-align: center;
    padding: 80px 20px;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color, #eee);
    border-top-color: var(--service-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Skeleton ─── */
.skeleton-card {
    background: white;
    border: 1px solid var(--border-color, #eee);
    border-radius: 12px;
    overflow: hidden;
}

.skeleton-img {
    height: 180px;
    background: linear-gradient(90deg, #f5f5f5 25%, #ebebeb 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-body { padding: 14px 16px; }

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f5f5f5 25%, #ebebeb 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    margin-bottom: 8px;
}
.skeleton-line.title { height: 16px; width: 75%; }
.skeleton-line.short { width: 50%; }
.skeleton-line.price { height: 18px; width: 40%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── 空狀態 ─── */
.ecom-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color, #eee);
}

.ecom-empty-state i {
    font-size: 40px;
    color: var(--text-secondary, #aaa);
    margin-bottom: 12px;
}

/* ─── 載入更多 ─── */
#loadMoreBtn {
    display: block;
    margin: 24px auto 0;
    padding: 10px 40px;
    border-radius: 25px;
    border: 1.5px solid var(--service-primary);
    background: transparent;
    color: var(--service-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
#loadMoreBtn:hover { background: var(--service-primary); color: white; }
#loadMoreBtn:disabled { opacity: 0.5; cursor: not-allowed; }

.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

/* ─── 分類大/小分類（accordion） ─── */
.filter-category-group {
    display: flex;
    flex-direction: column;
}

.filter-option-parent {
    font-weight: 400;
}

.filter-option-arrow {
    font-size: 10px;
    color: var(--text-secondary, #aaa);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.filter-option-parent.active .filter-option-arrow {
    transform: rotate(90deg);
    color: var(--service-primary);
}

.filter-subcategories {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding-left: 10px;
    margin-top: 2px;
    border-left: 2px solid var(--border-color, #eee);
    margin-left: 20px;
}

.filter-subcategories.open {
    display: flex;
}

.filter-option-sub {
    font-size: 13px;
    padding: 6px 10px;
    color: var(--text-secondary, #777);
}

.filter-option-sub .filter-option-dot {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.filter-option-sub.active .filter-option-dot {
    border-color: var(--service-primary);
    background: var(--service-primary);
    box-shadow: 0 0 0 2px rgba(170, 145, 119, 0.2);
}

/* ─── 價格/評分 chip 篩選 ─── */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1.5px solid var(--border-color, #ddd);
    border-radius: 20px;
    background: white;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.filter-chip:hover {
    border-color: var(--service-primary);
    color: var(--service-primary);
    background: rgba(170, 145, 119, 0.06);
}

.filter-chip.active {
    background: var(--service-primary);
    border-color: var(--service-primary);
    color: white;
}

.filter-chip i {
    font-size: 10px;
}

/* ─── 手機版篩選抽屜 ─── */
@media (max-width: 991.98px) {
    .services-results-wrap {
        padding-left: 0;
    }

    .filter-panel {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        overflow-y: auto;
        border-radius: 0;
        z-index: 1050;
        transition: left 0.3s ease;
        padding-top: 20px;
    }

    .filter-panel.open {
        left: 0;
    }

    .filter-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 1040;
    }

    .filter-overlay.open {
        display: block;
    }
}

/* ─── 響應式卡片 ─── */
@media (max-width: 575.98px) {
    .services-ecom-wrap {
        padding-top: 90px;
        padding-left: 12px;
        padding-right: 12px;
    }


}

/* ─── 篩選面板頂部色邊框與陰影（服務頁） ─── */
#filterPanel {
    border-color: rgba(170,145,119,0.2);
    border-top: 4px solid #AA9177;
    box-shadow: 0 4px 20px rgba(170,145,119,0.08);
}
