/* --------------------------------------------------------------------------
   6.5 Poster - 分享海报
   -------------------------------------------------------------------------- */

/* ==================== 分享海报样式 ==================== */

/* 海报按钮 */
.uap-poster-btn:hover {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.uap-poster-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* 海报模态框 */
.uap-poster-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.uap-poster-modal {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    animation: uapModalIn 0.25s ease-out;
}

.uap-poster-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.uap-poster-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.uap-poster-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.15s;
    padding: 0;
}

.uap-poster-modal-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.uap-poster-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.uap-poster-modal-close:focus {
    outline: none;
    background: #e5e7eb;
}

.uap-poster-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 模板选择 */
.uap-poster-templates {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.uap-poster-template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.uap-poster-template-btn:hover {
    border-color: #d1d5db;
}

.uap-poster-template-btn.active {
    border-color: var(--uap-primary);
    background: var(--uap-primary-bg);
}

.uap-poster-template-btn:focus {
    outline: none;
}

.uap-template-preview {
    width: 48px;
    height: 64px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.uap-template-default {
    background: #fff;
}

.uap-template-dark {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.uap-template-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.uap-template-name {
    font-size: 12px;
    color: #6b7280;
}

.uap-poster-template-btn.active .uap-template-name {
    color: var(--uap-action-bg, #4f46e5);
    font-weight: 500;
}

/* 海报预览区 */
.uap-poster-preview-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 300px;
}

.uap-poster-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #6b7280;
    font-size: 14px;
}

.uap-poster-preview {
    max-width: 100%;
    display: flex;
    justify-content: center;
}

.uap-poster-preview img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* 模态框底部 */
.uap-poster-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.uap-poster-tip {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
}

.uap-poster-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--uap-action-bg, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.uap-poster-download-btn:hover {
    background: var(--uap-action-hover, #4338ca);
}

.uap-poster-download-btn:focus {
    outline: none;
}

.uap-poster-download-btn svg {
    stroke: currentColor;
}

/* ==================== 海报 Canvas 模板样式 ==================== */

.uap-poster-canvas {
    width: 375px;
    padding: 24px;
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
    box-sizing: border-box;
}

/* 简约白模板 */
.uap-poster-canvas[data-template="default"] {
    background: #fff;
}

.uap-poster-canvas[data-template="default"] .uap-poster-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.uap-poster-canvas[data-template="default"] .uap-poster-logo {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.uap-poster-canvas[data-template="default"] .uap-poster-site-name {
    display: none;
}

.uap-poster-canvas[data-template="default"] .uap-poster-thumbnail {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    background: #f3f4f6;
}

.uap-poster-canvas[data-template="default"] .uap-poster-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uap-poster-canvas[data-template="default"] .uap-poster-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.4;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uap-poster-canvas[data-template="default"] .uap-poster-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.uap-poster-canvas[data-template="default"] .uap-poster-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.uap-poster-canvas[data-template="default"] .uap-poster-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.uap-poster-canvas[data-template="default"] .uap-poster-author-name {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.uap-poster-canvas[data-template="default"] .uap-poster-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.uap-poster-canvas[data-template="default"] .uap-poster-qrcode {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.uap-poster-canvas[data-template="default"] .uap-poster-qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}

.uap-poster-canvas[data-template="default"] .uap-poster-footer-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.uap-poster-canvas[data-template="default"] .uap-poster-scan-text {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.uap-poster-canvas[data-template="default"] .uap-poster-footer-site {
    font-size: 12px;
    color: #9ca3af;
}

/* 暗黑风模板 */
.uap-poster-canvas[data-template="dark"] {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.uap-poster-canvas[data-template="dark"] .uap-poster-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-logo {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.uap-poster-canvas[data-template="dark"] .uap-poster-site-name {
    display: none;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-thumbnail {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.uap-poster-canvas[data-template="dark"] .uap-poster-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-excerpt {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin: 0 0 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.uap-poster-canvas[data-template="dark"] .uap-poster-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-author-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.uap-poster-canvas[data-template="dark"] .uap-poster-qrcode {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    padding: 4px;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-footer-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-scan-text {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
}

.uap-poster-canvas[data-template="dark"] .uap-poster-footer-site {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* 渐变彩模板 */
.uap-poster-canvas[data-template="gradient"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-logo {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-site-name {
    display: none;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-thumbnail {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-excerpt {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin: 0 0 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-author-name {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-qrcode {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-footer-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-scan-text {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
}

.uap-poster-canvas[data-template="gradient"] .uap-poster-footer-site {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* 海报移动端适配 */
@media (max-width: 640px) {
    .uap-poster-modal {
        max-width: calc(100% - 32px);
        max-height: 85vh;
    }

    .uap-poster-modal-header {
        padding: 14px 16px;
    }

    .uap-poster-modal-body {
        padding: 16px;
    }

    .uap-poster-modal-footer {
        padding: 14px 16px;
    }

    .uap-poster-download-btn {
        width: 100%;
    }

    .uap-poster-canvas {
        width: 320px;
        padding: 20px;
    }

    .uap-poster-canvas .uap-poster-logo {
        height: 36px;
    }
}

/* ==================== 海报移动端保存样式 ==================== */
.uap-poster-mobile-save {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.uap-poster-mobile-save-tip {
    color: #fff;
    font-size: 14px;
    margin-bottom: 16px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
}

.uap-poster-mobile-save img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.uap-poster-mobile-close {
    margin-top: 20px;
    padding: 12px 40px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.uap-poster-mobile-close:hover,
.uap-poster-mobile-close:focus {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

/* 海报错误提示 */
.uap-poster-error {
    padding: 40px 20px;
    text-align: center;
    color: #ef4444;
    font-size: 14px;
}
