/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #333;
    background: #f0f0f0;
    overflow: hidden;
    height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== 主容器 ===== */
.map-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ===== 左側卡片面板 ===== */
.card {
    width: 400px;
    min-width: 400px;
    height: 100vh;
    overflow-y: auto;
    background: #fff;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.08);
    z-index: 10;
    position: relative;
}

.card::-webkit-scrollbar {
    width: 4px;
}

.card::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* 返回列 */
.card-back {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #5e5e5e;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #f0f0f0;
}

.card-back-title {
    font-size: 14px;
    color: #5e5e5e;
    margin-left: 12px;
    font-weight: 500;
}

/* 商家標題 */
.card-header {
    padding: 20px 20px 16px;
}

.business-name {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.business-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.rating-score {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.stars {
    color: #fbbc04;
    font-size: 14px;
    letter-spacing: 1px;
}

.rating-count {
    font-size: 13px;
    color: #70757a;
}

.business-category {
    font-size: 14px;
    color: #70757a;
    margin-bottom: 4px;
}

.business-status {
    font-size: 14px;
}

.status-open {
    color: #188038;
    font-weight: 500;
}

.status-hours {
    color: #70757a;
}

/* ===== 快速操作按鈕 ===== */
.action-buttons {
    display: flex;
    justify-content: space-around;
    padding: 12px 8px 16px;
    border-bottom: 8px solid #f0f0f0;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #1a73e8;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #f0f4ff;
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e8f0fe;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
}

.action-icon-line {
    background: #e8fee8;
    color: #06c755;
}

.action-icon-line svg {
    fill: #06c755;
}

/* ===== 圖片輪播 ===== */
.image-container {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 0 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid #e8e8e8;
}

.image-container::-webkit-scrollbar {
    height: 2px;
}

.image-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.image-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: opacity 0.2s;
}

.image-item:hover {
    opacity: 0.85;
}

.image-item img {
    width: 180px;
    height: 135px;
    object-fit: cover;
    display: block;
}

/* ===== 標籤頁 ===== */
.tabs {
    display: flex;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
}

.tab {
    flex: 1;
    padding: 14px 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #5e5e5e;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    color: #1a73e8;
    background: #f8f9fa;
}

.tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
}

/* ===== 分頁內容 ===== */
.tab-content {
    display: none;
    padding: 0;
}

.tab-content.active {
    display: block;
}

/* ===== 總覽 - 聯絡資訊 ===== */
.info-section {
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 10px 0;
}

.info-row svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.info-text {
    font-size: 14px;
    color: #1a1a1a;
    line-height: 1.5;
}

.info-link {
    color: #1a73e8;
}

.info-link:hover {
    text-decoration: underline;
}

.copy-btn {
    background: none;
    border: none;
    color: #1a73e8;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    margin-top: 2px;
}

.copy-btn:hover {
    text-decoration: underline;
}

/* 營業時間 */
.hours-detail {
    width: 100%;
}

.hours-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chevron {
    transition: transform 0.3s;
}

.chevron.open {
    transform: rotate(180deg);
}

.hours-list {
    display: none;
    padding: 8px 0 4px;
}

.hours-list.show {
    display: block;
}

.hours-list p {
    font-size: 13px;
    color: #5e5e5e;
    padding: 3px 0;
}

.hours-list .today {
    color: #d93025;
    font-weight: 500;
}

/* ===== 服務項目/特色 ===== */
.services-section,
.features-section,
.loan-section {
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    background: #f0f4ff;
    color: #1a73e8;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.tag-feature {
    background: #e6f4ea;
    color: #188038;
}

/* 借款資訊 */
.loan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.loan-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.loan-label {
    display: block;
    font-size: 12px;
    color: #70757a;
    margin-bottom: 4px;
}

.loan-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1a73e8;
}

/* ===== 評論區 ===== */
.review-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.review-big-score {
    font-size: 3rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
}

.stars-large {
    color: #fbbc04;
    font-size: 18px;
    letter-spacing: 2px;
}

.review-total {
    font-size: 13px;
    color: #70757a;
    margin-top: 2px;
}

.rating-bars {
    padding: 12px 20px 16px;
    border-bottom: 1px solid #e8e8e8;
}

.rating-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.rating-bar-row span {
    font-size: 13px;
    color: #70757a;
    width: 12px;
    text-align: right;
}

.bar {
    flex: 1;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #fbbc04;
    border-radius: 4px;
}

.reviews-list {
    padding: 0 20px;
}

.review-item {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

.review-item:last-child {
    border-bottom: none;
}

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

.review-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e8f0fe;
    color: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.review-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.review-date {
    font-size: 12px;
    color: #70757a;
}

.review-rating {
    color: #fbbc04;
    font-size: 13px;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.review-text {
    font-size: 14px;
    color: #3c4043;
    line-height: 1.6;
}

/* ===== 簡介區 ===== */
.info-about {
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.about-text {
    font-size: 14px;
    color: #3c4043;
    line-height: 1.8;
    margin-bottom: 12px;
}

.about-text:last-child {
    margin-bottom: 0;
}

.info-details {
    padding: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 14px;
    color: #70757a;
}

.detail-value {
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 500;
    text-align: right;
}

/* ===== 借款聲明 ===== */
.loan-disclaimer {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 11px;
    color: #9aa0a6;
    line-height: 1.7;
}

.loan-disclaimer p {
    margin: 0;
}

/* ===== 底部版權 ===== */
.card-footer {
    padding: 16px 20px;
    text-align: center;
    font-size: 12px;
    color: #9aa0a6;
    border-top: 1px solid #e8e8e8;
}

/* ===== 右側地圖 ===== */
.map-area {
    flex: 1;
    height: 100vh;
    position: relative;
}

.map-area iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ===== 全屏圖片 ===== */
.fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.fullscreen.show {
    display: flex;
}

.fullscreen img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-close {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    z-index: 100000;
    line-height: 1;
}

/* ===== LINE 浮動按鈕 ===== */
.fab-line {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #06c755;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab-line:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 100000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== RWD 響應式 ===== */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .map-container {
        flex-direction: column;
        height: auto;
    }

    .card {
        width: 100%;
        min-width: 100%;
        height: auto;
        overflow-y: visible;
        box-shadow: none;
    }

    .card-back {
        position: sticky;
        top: 0;
    }

    .tabs {
        /* no sticky on mobile */
    }

    .map-area {
        width: 100%;
        height: 50vh;
        flex: none;
        order: -1;
        overflow: hidden;
    }

    .map-area iframe {
        width: 100%;
        height: 150%;
        margin-top: -5%;
        border: 0;
    }

    .image-item img {
        width: 70vw;
        height: 200px;
    }

    .action-icon {
        width: 44px;
        height: 44px;
    }

    .action-btn {
        font-size: 11px;
    }

    .loan-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .card-header {
        padding: 16px;
    }

    .business-name {
        font-size: 1.25rem;
    }

    .image-item img {
        width: 75vw;
        height: 180px;
    }

    .info-section,
    .services-section,
    .features-section,
    .loan-section {
        padding: 14px 16px;
    }
}
