/**
 * 下载框样式
 * 用于文章中的下载资源展示组件
 * 包括普通下载和免费下载两种样式
 */

/* ========================================
   通用下载框基础样式
   ======================================== */

/* 下载框主容器 */
.custom-download-box {
    margin: 20px 0;
    padding: 20px;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 默认下载框样式（渐变背景） */
.custom-download-box:not(.free-download-box):not(.login-required) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.custom-download-box:not(.free-download-box):not(.login-required):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* 普通下载登录提示样式 */
.custom-download-box.login-required {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.custom-download-box.login-required:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

/* ========================================
   下载框头部样式
   ======================================== */

/* 下载框头部容器 */
.download-header {
    margin-bottom: 15px;
    position: relative;
}

/* 下载标题 */
.download-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.download-title:before {
    content: "📥";
    font-size: 16px;
    opacity: 0.9;
}

/* 下载元信息 */
.download-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.download-meta span {
    display: inline-block;
    font-size: 12px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.download-meta span:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* 图标样式 */
.download-meta span:before {
    margin-right: 4px;
    opacity: 0.8;
}

.download-meta span[class*="size"]:before {
    content: "💾";
}

.download-meta span[class*="format"]:before {
    content: "📄";
}

/* ========================================
   下载框内容样式
   ======================================== */

/* 资源描述 */
.download-description {
    margin-bottom: 15px;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

/* 提取密码 */
.download-password {
    margin-bottom: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.download-password:before {
    content: "🔑";
    font-size: 14px;
    opacity: 0.9;
}

.download-password code {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 3px;
    font-family: "SFMono-Regular", "Monaco", "Consolas", monospace;
    font-weight: bold;
    font-size: 13px;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    user-select: all;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-password code:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ========================================
   下载按钮样式
   ======================================== */

/* 下载操作区域 */
.download-action {
    text-align: center;
}

/* 下载按钮 */
.download-btn {
    display: inline-block;
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.download-btn:before {
    content: "⬇️";
    margin-right: 6px;
    font-size: 12px;
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.download-btn:active {
    transform: translateY(0);
}

/* 按钮动画效果 */
.download-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
    z-index: -1;
}

.download-btn:hover::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   免费下载框样式
   ======================================== */

/* 免费下载框容器 */
.free-download-box {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.free-download-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}

/* 免费下载标题 */
.free-download-box .download-title:before {
    content: "🎁";
}

/* 免费下载按钮 */
.free-download-box .download-btn {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.free-download-box .download-btn:before {
    content: "🆓";
    margin-right: 6px;
}

.free-download-box .download-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
}

/* 免费标识 */
.free-download-box::before {
    content: "FREE";
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
}

/* ========================================
   登录提示样式
   ======================================== */

/* 免费下载登录提示容器 */
.free-download-login-required {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

/* 登录提示文本 */
.login-notice {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-notice:before {
    content: "🔒";
    font-size: 14px;
}

/* 通用登录提示框（备用样式） */
.login-required-notice {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #8b4513;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(252, 182, 159, 0.3);
}

.login-required-notice h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-required-notice h4:before {
    content: "🔒";
    font-size: 14px;
}

.login-required-notice p {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.5;
}

.login-required-notice .login-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #8b4513;
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-required-notice .login-btn:hover {
    background: #a0522d;
    transform: translateY(-2px);
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 10px rgba(139, 69, 19, 0.3);
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板设备 */
@media (max-width: 768px) {
    .custom-download-box {
        margin: 15px 0;
        padding: 15px;
    }
    
    .download-title {
        font-size: 16px;
    }
    
    .download-meta {
        gap: 6px;
    }
    
    .download-meta span {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .download-description {
        font-size: 13px;
        padding: 8px 10px;
    }
    
    .download-btn {
        padding: 10px 25px;
        font-size: 13px;
    }
}

/* 手机设备 */
@media (max-width: 480px) {
    .custom-download-box {
        margin: 10px 0;
        padding: 12px;
    }
    
    .download-title {
        font-size: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .download-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .download-password {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .download-btn {
        width: 100%;
        padding: 12px 20px;
        border-radius: 20px;
    }
    
    .login-required-notice {
        padding: 15px;
    }
    
    .login-required-notice .login-btn {
        width: 100%;
        padding: 12px 20px;
    }
}

/* ========================================
   打印样式
   ======================================== */

@media print {
    .custom-download-box {
        background: white !important;
        color: black !important;
        border: 2px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .download-title,
    .download-description,
    .download-password {
        color: black !important;
    }
    
    .download-btn {
        background: white !important;
        color: black !important;
        border: 1px solid #000 !important;
    }
    
    .download-btn:before,
    .download-title:before,
    .download-password:before {
        content: none !important;
    }
}

/* ========================================
   可访问性优化
   ======================================== */

/* 聚焦状态 */
.download-btn:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.login-required-notice .login-btn:focus {
    outline: 3px solid #8b4513;
    outline-offset: 2px;
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .custom-download-box {
        border: 2px solid white;
    }
    
    .download-btn {
        border: 2px solid white;
        background: black;
    }
    
    .download-meta span {
        background: black;
        border: 1px solid white;
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .custom-download-box,
    .download-btn,
    .download-meta span,
    .download-password code,
    .login-required-notice .login-btn {
        transition: none;
    }
    
    .custom-download-box:hover,
    .download-btn:hover,
    .login-required-notice .login-btn:hover {
        transform: none;
    }
    
    .download-btn::after {
        display: none;
    }
}

/* ========================================
   暗色主题支持
   ======================================== */

@media (prefers-color-scheme: dark) {
    .login-required-notice {
        background: linear-gradient(135deg, #3a3a3a 0%, #2d2d2d 100%);
        color: #e0e0e0;
    }
    
    .login-required-notice .login-btn {
        background: #4a9eff;
        color: white;
    }
    
    .login-required-notice .login-btn:hover {
        background: #66b3ff;
    }
}
