/* =========================================================
   商家详情页 (merchant-detail.css)
   ========================================================= */

/* 顶部封面 */
.md-header-img {
    width: 100%;
    height: 220px;
    background: var(--bg-soft);
    position: relative;
}
.md-header-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 头部返回按钮遮罩 */
.md-header-back {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    text-decoration: none;
    backdrop-filter: blur(4px);
    z-index: 10;
}

/* 商家基础信息卡片 */
.md-info-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    margin: -30px 16px 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: relative;
    z-index: 10;
}

.md-title-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.md-logo {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: var(--bg-page);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    flex-shrink: 0;

}
.md-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* 无 Logo 时的占位 */
.logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F5F5;
    color: #ccc;
    font-size: 24px;
}

.md-name-wrap {
    flex: 1;
    min-width: 0;
}
.md-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.md-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.md-tags .tag {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
}
.md-tags .tag.blue {
    background: #EAF1FB;
    color: #3A6DB5;
}

.md-meta-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px dashed var(--border-light);
    padding-top: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}
.md-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.md-meta-item i {
    color: var(--primary);
    width: 14px;
    text-align: center;
    margin-top: 2px;
}

/* 通用区块卡片 */
.md-section {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    margin: 0 16px 12px;
    padding: 16px;
    box-shadow: var(--shadow-card);
}
.md-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.md-section-title i {
    color: var(--primary);
}
.md-desc-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-all;
}

/* 底部操作栏 */
.md-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 640px;
    margin: 0 auto;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 200;
    gap: 12px;
}

.md-btn-fav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-secondary);
    width: 48px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.md-btn-fav i {
    font-size: 20px;
    margin-bottom: 2px;
    color: var(--text-main);
    transition: all 0.2s;
}
.md-btn-fav.active i {
    color: var(--primary);
}

.md-btn-call {
    flex: 1;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(254,83,83,0.3);
    border: none;
    cursor: pointer;
}
.copy-address-btn {
    margin-left: 8px;
    padding: 2px 8px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
    color: #666;
    font-size: 11px;
    line-height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}
.copy-address-btn i {
    font-size: 10px;
    margin-right: 2px;
}
.copy-address-btn:active {
    background: #f5f5f5;
}

/* =========================================================
   商家详情页 - 海报弹窗及生成样式
   ========================================================= */

/* 弹窗内容框：限制最大高度，解决超出屏幕问题 */
.poster-dialog {
    background: #fff;
    width: 90%;
    max-width: 360px;
    max-height: 85vh; /* 限制最高不超过屏幕的85% */
    border-radius: 12px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .poster-dialog {
    transform: scale(1);
}

.poster-header {
    background: #f5f5f5;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: #666;
    flex-shrink: 0;
}

/* 海报预览容器：允许内部滚动 */
#poster-container {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
}

#poster-loading {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    color: #999;
}

#poster-img-box {
    display: none;
    width: 100%;
    max-width: 300px;
}

.poster-footer {
    padding: 14px;
    text-align: center;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.poster-footer-btn {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
}

/* =========================================================
   隐藏到屏幕外的纯净海报结构 (完全参考原有排版)
   ========================================================= */
#shadow-poster {
    width: 375px;
    background-color: #fff;
    border: 8px solid #FE5353;
    box-sizing: border-box;
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    text-align: left;
    position: absolute;
    top: -9999px;
    left: -9999px;
}

/* 上半部白底内容区 */
.sp-content {
    padding: 24px 20px;
}

.sp-logo-area {
    margin-bottom: 16px;
}

.sp-logo-title {
    font-size: 32px;
    font-weight: 800;
    color: #FE5353;
    height: 36px;
    line-height: 36px;
    margin-top: -14px;
}

.sp-logo-sub {
    font-size: 12px;
    color: #FE5353;
    font-weight: 500;
    height: 16px;
    line-height: 16px;
    margin-top: 6px;
}

.sp-title-row {
    margin-bottom: 20px;
    margin-top: 10px;
    line-height: 26px;
}

.sp-title-text {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    display: inline-block;
    vertical-align: top;
}

.sp-tags-row {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sp-tag {
    display: inline-block;
    font-size: 12px;
    padding: 0 8px;
    margin-right: 6px;
    border-radius: 4px;
    height: 23px;
    line-height: 10px;
    vertical-align: top;
}
.sp-tag-orange { border: 1px solid #e67e22; color: #e67e22; }
.sp-tag-blue { border: 1px solid #3498db; color: #3498db; }
.sp-tag-green { border: 1px solid #27ae60; color: #27ae60; }

/* 新增：发布时间样式 */
.sp-time {
    font-size: 12px;
    color: #999;
    line-height: 23px;
}

.sp-desc {
    font-size: 13px;
    color: #333;
    line-height: 22px;
    margin-bottom: 12px;
    text-align: justify;
    margin-top: -5px;
}

/* 单图区域 */
.sp-images-wrap {
    font-size: 0;
    margin: 0 -3px;
}

/* 下半部红底区域 */
.sp-footer {
    background-color: #FE5353;
    padding: 16px 20px;
    height: 122px;
    box-sizing: border-box;
    overflow: hidden;
}

.sp-qr-box {
    float: left;
    width: 90px;
    height: 90px;
    background-color: #fff;
    padding: 6px;
    box-sizing: border-box;
}

.sp-qr-box img {
    width: 100%;
    height: 100%;
    display: block;
}

.sp-footer-info {
    color: #fff;
    margin-left: 105px;
    margin-top: -4px;
}

.sp-phone {
    font-size: 16px;
    font-weight: bold;
    height: 22px;
    line-height: 22px;
    margin-bottom: 4px;
}

.sp-tips {
    font-size: 11px;
    opacity: 0.9;
    height: 16px;
    line-height: 16px;
    margin-bottom: 6px;
}

.sp-name {
    font-size: 13px;
    font-weight: bold;
    height: 18px;
    line-height: 18px;
    margin-bottom: 2px;
}

.sp-url {
    font-size: 11px;
    opacity: 0.9;
    height: 16px;
    line-height: 16px;
}