/* ===================================================
 * 玖源社功能整合插件 - 下载Widget卡片样式
 * 合并了原 xiaz style.css 中 Widget 卡片部分
 * 保留 jx-* CSS 类名
 * =================================================== */

/* ---- 小工具整体透明：双策略覆盖 ---- */
.zib-widget:has(.jx-container),
.widget:has(.jx-container),
.sidebar .widget:has(.jx-container),
.widget-area .widget:has(.jx-container),
.widget_jx_cards,
.widget_jx_cards .widget-box,
[class*="jx"] .widget-box {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
}

.widget_jx_cards .buttab,
.zib-widget:has(.jx-container) .buttab {
    display: flex; flex-wrap: wrap; gap: 10px !important;
}

.widget_jx_cards .buttab a,
.zib-widget:has(.jx-container) .buttab a {
    margin-right: 0 !important;
}

/* ---- 标题栏 h3.jx-widget-title ---- */
h3.jx-widget-title {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 0 16px !important;
    margin: 0 !important;
    color: #333 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    text-shadow: none !important;
    position: relative;
}

.dark-theme h3.jx-widget-title,
.dark-mode h3.jx-widget-title,
[data-theme="dark"] h3.jx-widget-title { color: #fff !important; }

h3.jx-widget-title::before {
    content: ''; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 5px; height: calc(100% - 4px);
    background: #ff6b9d; border-radius: 3px;
}

.zib-widget:has(.jx-container) > h3,
.widget:has(.jx-container) > h3,
.widget_jx_cards > h3 {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 0 16px !important;
    margin: 0 0 10px 0 !important;
    color: #333 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    position: relative;
}

.dark-theme .zib-widget:has(.jx-container) > h3,
.dark-mode .zib-widget:has(.jx-container) > h3,
[data-theme="dark"] .zib-widget:has(.jx-container) > h3,
.dark-theme .widget_jx_cards > h3,
.dark-mode .widget_jx_cards > h3,
[data-theme="dark"] .widget_jx_cards > h3 { color: #fff !important; }

.zib-widget:has(.jx-container) > h3::before,
.widget_jx_cards > h3::before {
    content: ''; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 5px; height: calc(100% - 4px);
    background: #ff6b9d; border-radius: 3px;
}

/* ---- 小工具标题栏 ---- */
.jx-widget-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 0;
}
.jx-widget-title-wrap { display: flex; align-items: baseline; gap: 10px; }
.jx-widget-subtitle { font-size: 13px; color: #999; font-weight: 400; }

.jx-widget-more-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: var(--theme-color, #4080ff);
    text-decoration: none !important; cursor: pointer;
    transition: all .2s ease; white-space: nowrap; line-height: 1; font-weight: 500;
}
.jx-widget-more-btn:hover { color: var(--theme-color-hover, #2563eb); }
.jx-widget-more-btn i { font-size: 11px; }

/* ---- 容器 ---- */
.jx-container {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: var(--jx-gap, 16px); margin-bottom: 18px;
}

/* ---- 单个卡片 ---- */
.jx-card {
    display: flex; align-items: center;
    background: var(--main-bg-color, rgba(255,255,255,.55));
    border-radius: var(--main-radius, 8px);
    padding: 16px 18px;
    border: 1px solid var(--main-border-color, rgba(50,50,50,.08));
    transition: all 0.25s ease; gap: 14px;
}

.jx-card:hover {
    background: var(--main-bg-color, rgba(255,255,255,.6));
    border-color: rgba(64, 128, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* ---- 图标区域 ---- */
.jx-card-icon-wrap { flex-shrink: 0; width: 56px; height: 56px; }
.jx-card-icon { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }
.jx-card-avatar {
    width: 100%; height: 100%; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; color: #fff;
}

/* ---- 内容区域 ---- */
.jx-card-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.jx-card-name {
    font-size: 15px; font-weight: 600; color: #222; line-height: 1.3;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: inline-block; max-width: 100%; transition: color 0.2s;
}
.jx-card-name:hover { color: var(--theme-color, #4080ff); }

.jx-card-rating { display: flex; align-items: center; gap: 1px; line-height: 1; }

.jx-card-meta { font-size: 12px; color: #666; display: flex; align-items: center; gap: 6px; }
.jx-meta-divider { color: #ccc; margin: 0 -2px; }

/* ---- 下载按钮 ---- */
.jx-card-action { flex-shrink: 0; }
.jx-download-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 60px; height: 30px; padding: 0 14px; font-size: 13px;
    color: var(--theme-color, #4080ff); border: 1px solid var(--theme-color, #4080ff);
    border-radius: 4px; background: transparent; line-height: 1; cursor: pointer;
    white-space: nowrap; transition: all 0.2s ease; font-family: inherit;
}
.jx-download-btn:hover { background: var(--theme-color, #4080ff); color: #fff; }
.jx-disabled { opacity: 0.45; cursor: not-allowed !important; pointer-events: none; }

/* ================================
 * 响应式适配
 * ================================ */
@media (max-width: 1200px) { .jx-container { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
    .jx-container { grid-template-columns: repeat(2, 1fr); --jx-gap: 12px; }
    .jx-card { padding: 14px 15px; gap: 12px; }
    .jx-card-icon-wrap { width: 48px; height: 48px; }
    .jx-card-avatar { font-size: 19px; border-radius: 10px; }
    .jx-card-name { font-size: 14px; }
}
@media (max-width: 600px) {
    .jx-container { grid-template-columns: 1fr; --jx-gap: 10px; }
    .jx-card { padding: 12px 14px; gap: 12px; }
    .jx-card-icon-wrap { width: 50px; height: 50px; }
    .jx-card-avatar { font-size: 20px; border-radius: 10px; }
    .jx-card-name { font-size: 14px; }
    .jx-download-btn { min-width: 52px; height: 28px; padding: 0 11px; font-size: 12px; }
}
@media (min-width: 1400px) {
    .jx-card { padding: 14px 15px; }
    .jx-card-icon-wrap { width: 52px; height: 52px; }
    .jx-card-name { font-size: 14px; }
    .jx-card-meta { font-size: 11px; }
}

/* ================================
 * 暗色模式
 * ================================ */
.dark-theme .jx-card {
    background: rgba(255,255,255,.04);
    border-color: var(--main-border-color, rgba(114,114,114,.1));
}
.dark-theme .jx-card:hover {
    background: rgba(255,255,255,.06);
    box-shadow: 0 4px 20px rgba(64,128,255,.12);
}
.dark-theme .jx-card-name { color: #f8fafc; }
.dark-theme .jx-card-name:hover { color: var(--theme-color, #60a5fa); }
.dark-theme .jx-card-meta { color: #888a8f; }
.dark-theme .jx-meta-divider { color: #43454a; }
.dark-theme .jx-widget-title { color: #fff; }
.dark-theme .jx-widget-subtitle { color: #888a8f; }
