/* ============================================================
   NGDown 奶狗附件密码下载 — 样式表（日/夜间自适应美化版）
   夜间切换信号（任一命中即生效）：
     html.dark / html.dark-theme / html[data-theme="dark"]
     body.dark / body.dark-theme / body[data-theme="dark"]
     .ng-modal.ng-dark（JS 实时同步，开着弹窗切主题也会跟随）
   ============================================================ */

/* ---------- 下载卡片 ---------- */
.ngd-box {
    margin-top: 14px;
    margin-bottom: 14px;
    /* 日间配色 */
    --ngd-card-bg: #ffffff;
    --ngd-card-border: #ebeef2;
    --ngd-card-border-hover: #d6def7;
    --ngd-title-c: #1a1a1a;
    --ngd-name-c: #222222;
    --ngd-sub-c: #9aa1ab;
    --ngd-soft: #f3f5f8;
    --ngd-dashed: #d5d9e0;
    --ngd-desc-c: #71767f;
}
.ngd-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ngd-title-c);
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
}
.ngd-title::before {
    content: "";
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, #4e6ef2, #7c5cff);
    border-radius: 2px;
    display: inline-block;
    flex: 0 0 auto;
}
.ngd-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    background-color: var(--ngd-card-bg);
    border: 1px solid var(--ngd-card-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    color: var(--ngd-name-c);
    transition: background-color .25s, border-color .25s, color .25s, box-shadow .2s;
}
.ngd-card:hover {
    box-shadow: 0 4px 14px rgba(78, 110, 242, .12);
    border-color: var(--ngd-card-border-hover);
}
.ngd-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}
.ngd-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--ngd-soft);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ngd-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}
.ngd-name-wrap {
    min-width: 0;
    flex: 1 1 auto;
}
.ngd-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ngd-name-c);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px;
}
.ngd-sub {
    font-size: 12px;
    color: var(--ngd-sub-c);
    margin-top: 3px;
    line-height: 1.4;
}
.ngd-action {
    flex: 0 0 auto;
}
.ngd-btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 9px;
    background: linear-gradient(135deg, #4e6ef2, #6b89ff);
    color: #fff !important;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all .2s;
    white-space: nowrap;
    line-height: 1.4;
    box-shadow: 0 3px 10px rgba(78, 110, 242, .25);
}
.ngd-btn:hover {
    background: linear-gradient(135deg, #3f5bd9, #5a78f0);
    box-shadow: 0 5px 14px rgba(78, 110, 242, .35);
    transform: translateY(-1px);
}
@media (max-width: 600px) {
    .ngd-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
    }
    .ngd-left {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        text-align: left;
    }
    .ngd-icon { width: 40px; height: 40px; }
    .ngd-name {
        white-space: normal;
        word-break: break-all;
        max-width: 100%;
        font-size: 14px;
    }
    .ngd-sub { font-size: 11.5px; }
    .ngd-action { width: 100%; margin-left: 0; }
    .ngd-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 10px;
        font-size: 14px;
    }
}
.but {
    display: inline-block;
    padding: 8px 16px;
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: #4e6ef2;
}
.show-permission-message {
    cursor: not-allowed;
}
.file-download-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--ngd-dashed);
}
.file-download-desc {
    display: flex;
    justify-content: space-between;
    color: var(--ngd-desc-c);
}
.desc-left,
.desc-right {
    font-size: 14px;
}
.ngfile-download-icon img {
    width: 45px;
    height: 45px;
    border-radius: 4px;
}
.download-code {
    border: 1px dashed #4e6ef2;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.download-code:hover {
    background-image: linear-gradient(45deg, #48c6ef 0%, #6f86d6 100%);
    color: #fff;
}
.small-links-container {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.small-link {
    font-size: 12px;
}
.small-link a {
    display: inline-block;
    padding: 5px 10px;
    color: #fff;
    background-color: #4e6ef2;
    border-radius: 5px;
    text-decoration: none;
    transition: all .2s;
}
.small-link a:hover {
    background-color: #3f5bd9;
    transform: translateY(-1px);
}
.small-link span {
    margin-left: 5px;
    color: var(--ngd-desc-c);
    font-size: 12px;
}

/* ---------- 下载卡片：夜间配色 ---------- */
html.dark .ngd-box,
html.dark-theme .ngd-box,
html[data-theme="dark"] .ngd-box,
body.dark .ngd-box,
body.dark-theme .ngd-box,
body[data-theme="dark"] .ngd-box {
    --ngd-card-bg: #20222a;
    --ngd-card-border: #32353e;
    --ngd-card-border-hover: #3d4150;
    --ngd-title-c: #e8eaf0;
    --ngd-name-c: #e8eaf0;
    --ngd-sub-c: #9aa0ab;
    --ngd-soft: #2a2d36;
    --ngd-dashed: #343845;
    --ngd-desc-c: #9aa0ab;
}

/* ---------- 下载弹窗 ---------- */
.ng-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    /* 日间配色 */
    --ngm-overlay: rgba(15, 20, 40, .55);
    --ngm-bg: #ffffff;
    --ngm-fg: #222222;
    --ngm-title: #1a1a1a;
    --ngm-muted: #6b7280;
    --ngm-soft: #f3f5f8;
    --ngm-soft-hover: #e8eaef;
    --ngm-border: #ebeef2;
    --ngm-qr-bg: #fafbfc;
    --ngm-chip-bg: #eef2ff;
    --ngm-chip-bg-hover: #e0eaff;
    --ngm-chip-border: #c7d0ff;
    --ngm-chip-fg: #4e6ef2;
    --ngm-tab-fg: #6b7280;
    --ngm-tab-hover: #2d3748;
    --ngm-tab-active-bg: #ffffff;
    --ngm-tab-active-fg: #4e6ef2;
    --ngm-divider: #ebeef2;
    --ngm-divider-text: #9ca3af;
    --ngm-input-bg: #fafbfc;
    --ngm-input-bg-focus: #ffffff;
    --ngm-input-border: #dcdfe6;
    --ngm-input-fg: #222222;
    background-color: var(--ngm-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color .25s;
}
.ng-modal-card {
    position: relative;
    width: 100%;
    max-width: 340px;
    background: var(--ngm-bg);
    color: var(--ngm-fg);
    border: 1px solid var(--ngm-border);
    border-radius: 18px;
    padding: 20px 22px 18px;
    box-shadow: 0 20px 60px rgba(15, 20, 40, .25);
    text-align: center;
    animation: ngFadeUp .35s cubic-bezier(.4, 0, .2, 1);
    transition: background-color .25s, border-color .25s, color .25s;
    overflow: hidden;
}
/* 顶部渐变装饰条 */
.ng-modal-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4e6ef2, #7c5cff, #4e6ef2);
    background-size: 200% 100%;
    animation: ngShimmer 3s linear infinite;
    border-radius: 18px 18px 0 0;
}
@keyframes ngShimmer {
    from { background-position: 0 0; }
    to   { background-position: 200% 0; }
}
@keyframes ngFadeUp {
    from { transform: translateY(20px) scale(.97); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.ng-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    line-height: 26px;
    border: none;
    background: var(--ngm-soft);
    cursor: pointer;
    font-size: 16px;
    color: var(--ngm-muted);
    border-radius: 50%;
    transition: all .25s;
    z-index: 2;
}
.ng-modal-close:hover {
    background: var(--ngm-soft-hover);
    color: var(--ngm-fg);
    transform: rotate(90deg);
}
.ng-modal-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 14px;
}
.ng-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #4e6ef2, #7c5cff);
    color: #ffffff;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(78, 110, 242, .35);
}
.ng-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ngm-title);
    margin: 0;
    letter-spacing: .3px;
}
.ng-tabs {
    display: flex;
    gap: 4px;
    background: var(--ngm-soft);
    padding: 4px;
    border-radius: 11px;
    margin-bottom: 12px;
    transition: background-color .25s;
}
.ng-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border: none;
    background: transparent;
    color: var(--ngm-tab-fg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    transition: all .25s;
}
.ng-tab i { font-size: 14px; line-height: 1; }
.ng-tab:hover { color: var(--ngm-tab-hover); }
.ng-tab.ng-tab-active,
.ng-tab.active {
    background: var(--ngm-tab-active-bg);
    color: var(--ngm-tab-active-fg);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(78, 110, 242, .18);
}
.ng-tab.active { border-radius: 8px; }

/* tab-content 默认隐藏在 class 里，但实际显示靠行内 style.display 兜底，主题 CSS 无法覆盖 */
.ng-tab-content {
    margin-top: 0;
}
.ng-qr-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 148px;
    height: 148px;
    margin: 2px auto 10px;
    padding: 8px;
    background: var(--ngm-qr-bg);
    border: 1px solid var(--ngm-border);
    border-radius: 12px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .04);
    transition: background-color .25s, border-color .25s;
}
.ng-qr-card img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 6px;
    object-fit: contain;
}
.ng-tip {
    font-size: 12px;
    color: var(--ngm-muted);
    margin: 0 0 8px;
    line-height: 1.4;
}
.ng-code-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--ngm-chip-bg);
    color: var(--ngm-chip-fg);
    font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Microsoft YaHei', monospace;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: 1px dashed var(--ngm-chip-border);
    transition: all .2s;
    user-select: all;
}
.ng-code-chip i { font-size: 13px; }
.ng-code-chip:hover {
    background: var(--ngm-chip-bg-hover);
    border-color: var(--ngm-chip-fg);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(78, 110, 242, .15);
}
.ng-divider {
    position: relative;
    text-align: center;
    height: 1px;
    background: var(--ngm-divider);
    margin: 14px 0 10px;
    transition: background-color .25s;
}
.ng-divider span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--ngm-bg);
    padding: 0 10px;
    font-size: 11.5px;
    color: var(--ngm-divider-text);
    letter-spacing: .5px;
    transition: background-color .25s;
}
.ng-pwd-row {
    margin-top: 0;
}
.ng-pwd-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 13px;
    border: 1px solid var(--ngm-input-border);
    border-radius: 10px;
    font-size: 13.5px;
    outline: none;
    background: var(--ngm-input-bg);
    color: var(--ngm-input-fg);
    transition: all .2s;
}
.ng-pwd-input::placeholder { color: var(--ngm-muted); }
.ng-pwd-input:focus {
    border-color: #4e6ef2;
    background: var(--ngm-input-bg-focus);
    box-shadow: 0 0 0 3px rgba(78, 110, 242, .12);
}
.ng-submit-btn {
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, #4e6ef2, #6b89ff);
    color: #ffffff;
    padding: 11px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all .25s;
    box-shadow: 0 4px 12px rgba(78, 110, 242, .3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.ng-submit-btn i { font-size: 15px; }
.ng-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(78, 110, 242, .4);
}
.ng-submit-btn:active { transform: translateY(0); }
.ng-msg {
    margin-top: 8px;
    font-size: 12.5px;
    min-height: 16px;
}
.ng-msg-err { color: #e54d42; }
.ng-msg-ok  { color: #2ba24c; }

/* ---------- 弹窗：夜间配色 ---------- */
html.dark .ng-modal,
html.dark-theme .ng-modal,
html[data-theme="dark"] .ng-modal,
body.dark .ng-modal,
body.dark-theme .ng-modal,
body[data-theme="dark"] .ng-modal,
.ng-modal.ng-dark {
    --ngm-overlay: rgba(0, 0, 0, .65);
    --ngm-bg: #20222a;
    --ngm-fg: #e8eaf0;
    --ngm-title: #e8eaf0;
    --ngm-muted: #9aa0ab;
    --ngm-soft: #171921;
    --ngm-soft-hover: #3a3d45;
    --ngm-border: #32353e;
    --ngm-qr-bg: #171921;
    --ngm-chip-bg: #232f52;
    --ngm-chip-bg-hover: #2a3a68;
    --ngm-chip-border: #3b4d8a;
    --ngm-chip-fg: #8fa7ff;
    --ngm-tab-fg: #9aa0ab;
    --ngm-tab-hover: #d5d9e2;
    --ngm-tab-active-bg: #2a2d36;
    --ngm-tab-active-fg: #8fa7ff;
    --ngm-divider: #32353e;
    --ngm-divider-text: #7c828d;
    --ngm-input-bg: #171921;
    --ngm-input-bg-focus: #1c1f27;
    --ngm-input-border: #32353e;
    --ngm-input-fg: #e8eaf0;
}

/* 弹窗强制覆盖：行内 style.display="block" 的 tab-content 显示，其他隐藏
   说明：用 [style*="display:block"] 匹配（冒号后没空格），兼容 PHP 输出的 HTML */
.ng-modal .ng-tab-content[style*="display:block"] { display: block !important; }
.ng-modal .ng-tab-content[style*="display:block"] .ng-qr-card,
.ng-modal .ng-tab-content[style*="display:block"] .ng-tip,
.ng-modal .ng-tab-content[style*="display:block"] .ng-code-chip { display: revert !important; }
.ng-modal .ng-tab-content:not([style*="display:block"]) { display: none !important; }
