/**
 * 资源下载小工具样式
 * 独立样式，不依赖其他组件
 */

/* ============================================================
 * 小工具主体
 * ============================================================ */

.pcgh-dl-widget {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    font-family: inherit;
}

/* ============================================================
 * 头部区域
 * ============================================================ */

.pcgh-dl-widget__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.04) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pcgh-dl-widget__head-left {
    flex: 1;
    min-width: 0;
}

.pcgh-dl-widget__title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pcgh-dl-widget__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pcgh-dl-widget__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #a4adb8;
}

.pcgh-dl-widget__meta-item i,
.pcgh-dl-widget__meta-item svg {
    width: 13px;
    height: 13px;
    opacity: 0.7;
    flex-shrink: 0;
}

/* 评分 */
.pcgh-dl-widget__head-right {
    flex-shrink: 0;
    margin-left: 12px;
}

.pcgh-dl-widget__score {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

/* ============================================================
 * 底部操作区
 * ============================================================ */

.pcgh-dl-widget__actions {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
}

.pcgh-dl-widget__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.pcgh-dl-widget__btn i,
.pcgh-dl-widget__btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* 下载按钮 */
.pcgh-dl-widget__btn--download {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
}

.pcgh-dl-widget__btn--download:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* 收藏按钮 */
.pcgh-dl-widget__btn--fav {
    background: rgba(255, 255, 255, 0.06);
    color: #a4adb8;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pcgh-dl-widget__btn--fav:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e6e8eb;
}

/* 已收藏状态 - 红色 */
.pcgh-dl-widget__btn--fav.is-active {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.pcgh-dl-widget__btn--fav.is-active:hover {
    background: rgba(239, 68, 68, 0.2);
}

.pcgh-dl-widget__btn--fav.is-active i,
.pcgh-dl-widget__btn--fav.is-active svg {
    fill: #ef4444;
    stroke: #ef4444;
}

/* 禁用按钮 */
.pcgh-dl-widget__btn--disabled,
.pcgh-dl-widget__btn--disabled:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #6b7785;
    cursor: not-allowed;
}

/* ============================================================
 * 浅色模式适配
 * ============================================================ */

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__head {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.02) 100%);
    border-color: #e5e7eb;
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__title {
    color: #1f2937;
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__meta-item {
    color: #6b7280;
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__actions {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__btn--fav {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__btn--fav:hover {
    background: #e5e7eb;
    color: #374151;
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__btn--fav.is-active {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__btn--disabled,
[data-pcgh-theme-resolved="light"] .pcgh-dl-widget__btn--disabled:hover {
    background: #f3f4f6;
    color: #9ca3af;
}

/* ============================================================
 * 内容区小工具容器
 * ============================================================ */

.pcgh-content-widgets {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pcgh-content-widget {
    width: 100%;
}

.pcgh-content-widget .pcgh-dl-widget {
    max-width: 100%;
}

/* ============================================================
 * 右侧栏小工具吸顶跟随
 * ============================================================ */

@media (min-width: 1024px) {
    /* 游戏详情页右侧栏 */
    .pcgh-game-sidebar .pcgh-content-widget,
    #pcgh-game-sidebar .pcgh-content-widget {
        position: sticky;
        top: 80px;
        z-index: 100;
        margin-bottom: 16px;
    }

    /* 社区帖子详情页右侧栏 */
    .pcgh-community-single-sidebar .pcgh-content-widget,
    #pcgh-community-single-sidebar .pcgh-content-widget {
        position: sticky;
        top: 80px;
        z-index: 100;
        margin-bottom: 16px;
    }
}

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

@media (max-width: 480px) {
    .pcgh-dl-widget__head {
        padding: 12px 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .pcgh-dl-widget__head-right {
        margin-left: 0;
        margin-top: 10px;
    }

    .pcgh-dl-widget__title {
        font-size: 14px;
    }

    .pcgh-dl-widget__meta {
        gap: 8px;
    }

    .pcgh-dl-widget__meta-item {
        font-size: 11px;
    }

    .pcgh-dl-widget__actions {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
    }

    .pcgh-dl-widget__btn {
        padding: 9px 12px;
        font-size: 13px;
    }
}
