/* ============================================================
   通用分享弹窗样式 - 仿B站风格（无渠道，二维码放大并靠右）
   - 封面边框，作者底部边框
   - 左侧自适应，右侧固定靠右
   ============================================================ */

/* ---------- 遮罩层 ---------- */
.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.share-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ---------- 面板 ---------- */
.share-panel {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    padding: 24px 28px 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s ease;
    opacity: 0;
    overflow-y: auto;
    box-sizing: border-box;
}
.share-overlay.active .share-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ---------- 头部 ---------- */
.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.share-header .title {
    font-size: 18px;
    font-weight: 600;
    color: #1e1e2a;
}
.close-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    padding: 0;
}
.close-btn:hover {
    color: #333;
}

/* ---------- 主体布局（左侧自适应，右侧靠右） ---------- */
.share-main {
    display: flex;
    align-items: center;          /* 垂直居中 */
    gap: 20px;
}
.share-left {
    flex: 1;                      /* 占据剩余空间 */
    min-width: 0;                 /* 防止溢出 */
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.share-right {
    flex: 0 0 auto;               /* 宽度由内容决定 */
    margin-left: auto;            /* 靠右对齐 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ---------- 封面 + 元信息 ---------- */
.share-book-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    /* 🆕 虚框卡片样式 */
    border: 1.5px dashed #d0d0d0;
    border-radius: 10px;
    padding: 12px 16px;
    background: #fafbfc;
    transition: border-color 0.2s ease;
}

/* ---- 封面容器（默认图标） + 边框 ---- */
.cover-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 40px;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 8px 12px;
    width: 56px;
    height: 56px;
    transition: width 0.25s ease, height 0.25s ease, border-radius 0.25s ease;
    overflow: hidden;
    box-sizing: border-box;
    border: 1.5px solid #e0e0e0;
}

/* ---- 封面容器 - 图片模式（非课程 27:38） ---- */
.cover-mini.has-image {
    padding: 0;
    width: 64px;
    height: 90px;
    border-radius: 6px;
    background: #f0f2f5;
    flex-shrink: 0;
    border-color: #d0d0d0;
}

/* ---- 封面容器 - 图片模式 + 课程（16:9） ---- */
.cover-mini.has-image.course-cover {
    width: 120px;
    height: 67.5px;
    border-radius: 6px;
}

/* ---- 封面图片 ---- */
.cover-mini .cover-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    border-radius: inherit;
}

/* ---- 元信息 ---- */
.meta .name {
    font-size: 16px;
    font-weight: 500;
    color: #1e1e2a;
    line-height: 1.4;
}
.meta .author {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
    padding-bottom: 2px;
    border-bottom: 1.5px dashed #d0d0d0;
    display: inline-block;
}

/* ---------- 复制链接 ---------- */
.share-copy-link {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.link-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
    outline: none;
    min-width: 0;
    box-sizing: border-box;
    height: 38px;
}
.copy-btn {
    background: #00a1d6;
    color: #fff;
    border: none;
    padding: 0 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
    height: 38px;
    line-height: 38px;
}
.copy-btn:hover {
    background: #0088b5;
}
.copy-btn.copied {
    background: #52c41a;
}

/* ---------- 二维码（放大至140px，靠右） ---------- */
#qrcode-container {
    width: 140px !important;
    height: 140px !important;
    position: relative;
    display: block;
    background: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: hidden;
}

#qrcode-container canvas,
#qrcode-container img {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 6px;
    display: block !important;
}

.qr-tips {
    margin-top: 10px;
    font-size: 13px;
    color: #888;
    text-align: center;
}

/* ============================================================
   响应式适配
   ============================================================ */

/* ----- 小屏手机 (≤480px) ----- */
@media (max-width: 480px) {
    .share-panel {
        padding: 16px 16px 20px;
        max-width: 100%;
    }
    .share-book-meta {
        padding: 8px 12px;
        gap: 10px;
    }
    .share-main {
        flex-direction: column;      /* 改为上下排列 */
        align-items: stretch;
        gap: 16px;
    }
    .share-left {
        flex: none;
        width: 100%;
    }
    .share-right {
        flex: none;
        width: 100%;
        margin-left: 0;              /* 取消靠右 */
        flex-direction: row;
        gap: 20px;
        justify-content: center;
        align-items: center;
    }
    .share-right .qr-tips {
        margin-top: 0;
    }

    /* 封面缩小 */
    .cover-mini.has-image {
        width: 56px;
        height: 79px;
    }
    .cover-mini.has-image.course-cover {
        width: 96px;
        height: 54px;
    }

    /* 二维码缩小为 100px */
    #qrcode-container {
        width: 100px !important;
        height: 100px !important;
        padding: 6px;
    }
    .share-right {
        min-width: 0;
    }
}

/* ----- 超小屏 (≤380px) ----- */
@media (max-width: 380px) {
    .share-book-meta {
        gap: 10px;
        padding: 6px 10px;
    }
    .cover-mini.has-image {
        width: 48px;
        height: 68px;
    }
    .cover-mini.has-image.course-cover {
        width: 80px;
        height: 45px;
    }
    .meta .name {
        font-size: 14px;
    }
    .meta .author {
        font-size: 12px;
    }
    #qrcode-container {
        width: 80px !important;
        height: 80px !important;
        padding: 4px;
    }
    .link-input {
        font-size: 12px;
        height: 34px;
    }
    .copy-btn {
        font-size: 12px;
        height: 34px;
        line-height: 34px;
        padding: 0 12px;
    }
}