* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, "Microsoft YaHei", Arial, sans-serif;
}
body {
    height: 100vh;
    overflow: hidden;
}
.container {
    display: flex;
    height: 100vh;
}
.sidebar {
    width: 380px;
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    z-index: 2;
}
.search-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.search-box input {
    width: 100%;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}
.search-box input:focus {
    border-color: #377ee8;
}
.btn-group {
    display: flex;
    gap: 8px;
}
.btn {
    flex: 1;
    height: 40px;
    border-radius: 6px;
    border: none;
    background: #377ee8;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.btn:hover {
    background: #2865c4;
}
.btn-outline {
    background: #fff;
    color: #377ee8;
    border: 1px solid #377ee8;
}
.btn-outline:hover {
    background: #e9f0fe;
}
.info {
    margin-top: 15px;
    color: #999;
    font-size: 13px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
#merchantList {
    flex: 1;
    overflow-y: auto;
    margin-top: 5px;
    min-height: 200px;
}
.image-search-area {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}
.image-search-area .search-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.image-search-area .search-row input[type="file"] {
    flex: 1;
    min-width: 120px;
}
.image-search-area .search-result {
    margin-top: 8px;
    font-size: 13px;
    color: #333;
    display: none;
}
.image-search-area .search-result .success {
    background: #e8f5e9;
    padding: 10px;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}
.image-search-area .search-result .fail {
    background: #fff3cd;
    padding: 10px;
    border-radius: 6px;
    border-left: 4px solid #f39c12;
}
.image-search-area .search-result .loading {
    color: #888;
}
.card {
    background: #fff;
    margin-top: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}
.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateX(2px);
}
.card.active {
    border-left-color: #377ee8;
    background: #f0f7ff;
}
.title {
    font-size: 17px;
    font-weight: bold;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.tag {
    color: #fff;
    background: #377ee8;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: normal;
}
.area {
    color: #357de5;
    margin-top: 5px;
    font-size: 13px;
}
.desc {
    margin-top: 6px;
    line-height: 1.5;
    font-size: 13px;
    color: #555;
}
.address {
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}
.distance {
    margin-top: 8px;
    color: #2676df;
    font-size: 14px;
    font-weight: bold;
}
/* 商品缩略图 */
.product-thumbs-wrapper {
    position: relative;
    margin-top: 8px;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.product-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 2px 0;
    flex: 1;
    scrollbar-width: none;
}
.product-thumbs::-webkit-scrollbar {
    display: none;
}
.product-thumb-item {
    flex: 0 0 calc((100% - 3 * 6px) / 4) !important;
    height: 70px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ddd;
    cursor: pointer;
    position: relative;
    min-width: 0;
}
.product-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-thumb-item .product-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    text-align: center;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}
.scroll-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}
.scroll-arrow.left {
    left: 2px;
}
.scroll-arrow.right {
    right: 2px;
}
.scroll-arrow.hidden {
    display: none;
}
.page-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}
.page-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s;
    cursor: pointer;
}
.page-dot.active {
    background: #377ee8;
}
.map-wrapper {
    flex: 1;
    position: relative;
    background: #e5e3df;
}
#map {
    width: 100%;
    height: 100%;
}
/* 导航按钮 */
.nav-btn {
    margin-top: 8px;
    padding: 4px 12px;
    background: #f39c12;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.nav-btn:hover {
    background: #d68910;
}
.nav-app-btn:hover {
    background: #f0f0f0 !important;
}
.nav-app-btn:active {
    background: #e0e0e0 !important;
}

/* ===== 卡片操作栏 - 导航 + 分享商家（统一高度，底部对齐） ===== */
.card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}
.card-actions .distance {
    margin-top: 0;
    flex: 1;
}
.card-actions .action-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;  /* 关键：让两个按钮在交叉轴上居中，底部对齐 */
}
.card-actions .action-btns .btn-sm {
    height: 28px;
    line-height: 28px;
    padding: 0 10px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    box-sizing: border-box;
    flex: 1;
    display: inline-block;
    background: none;
    color: #fff;
    /* 确保高度固定，底部对齐 */
    vertical-align: middle;
}
.card-actions .action-btns .btn-nav {
    background: #f39c12;
    color: #fff;
}
.card-actions .action-btns .btn-nav:hover {
    background: #d68910;
}
.card-actions .action-btns .btn-share-merchant {
    background: #27ae60;
    color: #fff;
}
.card-actions .action-btns .btn-share-merchant:hover {
    background: #1e8449;
}
.card-actions .action-btns .btn-sm:active {
    opacity: 0.7;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: 70vh;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    .map-wrapper {
        height: 30vh;
    }
    .card {
        padding: 12px;
    }
    .title {
        font-size: 15px;
    }
    .desc {
        display: none !important;
    }
    .product-thumb-item {
        flex: 0 0 calc((100% - 3 * 6px) / 4) !important;
        height: 60px !important;
    }
    .page-dots {
        display: none !important;
    }
    .card .distance {
        margin-top: 4px;
        margin-bottom: 4px;
    }
    .card .nav-btn {
        width: 100%;
        margin-top: 4px;
        padding: 6px 0;
        font-size: 14px;
        text-align: center;
    }
    .card > div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .card > div[style*="justify-content: space-between"] {
        justify-content: flex-start !important;
    }
    .search-box {
        padding-top: 10px;
    }
    /* 手机端按钮高度 */
    .card-actions .action-btns .btn-sm {
        height: 26px;
        line-height: 26px;
        font-size: 11px;
        padding: 0 8px;
    }
}
@media (max-width: 480px) {
    .sidebar {
        padding: 8px;
    }
    .btn {
        font-size: 12px;
        height: 36px;
    }
    .search-box input {
        height: 36px;
        font-size: 13px;
    }
    .card {
        padding: 10px;
        margin-top: 8px;
    }
    .product-thumb-item {
        flex: 0 0 calc((100% - 3 * 6px) / 4) !important;
        height: 60px !important;
    }
    .image-search-area .search-row input[type="file"] {
        min-width: 80px;
    }
}
.sidebar::-webkit-scrollbar,
#merchantList::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb,
#merchantList::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    justify-content: center;
    align-items: center;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}
.modal-content .close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #888;
}
.modal-content .close:hover {
    color: #333;
}
.modal-content img, .modal-content video {
    max-width: 100%;
    display: block;
    margin: 10px 0;
}
.modal-content .detail-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}
.modal-content .detail-gallery img, .modal-content .detail-gallery video {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    flex-shrink: 0;
}
.modal-content .detail-gallery .video-wrapper {
    position: relative;
    display: inline-block;
}
.modal-content .detail-gallery .video-wrapper .play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: #fff;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    pointer-events: none;
}
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}
.image-viewer.active {
    display: flex;
}
.image-viewer img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}
.merchant-label {
    background: rgba(55,126,232,0.9);
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid #fff;
}