/* ==========================================================================
   portal.css — 公网侧三个页面（暖心树洞 / 软件授权 / 登录）的共用外壳
   --------------------------------------------------------------------------
   约束：
   1) 全部类名 pg- 前缀；禁止 body / html / :root / * 这类全局选择器
      （这些页面历史上就是靠全局选择器互相污染的）
   2) 不引用外部字体与图片（工业内网出不去外网）
   3) 外壳 position:fixed + inset:0，正文自己滚动，不依赖 body 的 overflow
   4) 纵向尺寸不用 100vh
   ========================================================================== */

.pg-root {
    --pg-bg-0: #0B0F1A;
    --pg-bg-1: #101522;
    --pg-line: rgba(152, 164, 187, .16);
    --pg-card: #171D2C;
    --pg-card-2: #1D2436;
    --pg-cyan: #17E1E6;
    --pg-cyan-soft: #7CF2F6;
    --pg-amt: #FFCC66;
    --pg-danger: #FF7A7A;
    --pg-t1: #EEF3FA;
    --pg-t2: #98A4BB;
    --pg-t3: #7A8599;
    --pg-font: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    font-family: var(--pg-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--pg-t1);
    background:
        radial-gradient(80% 62% at 8% 4%, rgba(23, 225, 230, .075), transparent 58%),
        radial-gradient(70% 58% at 92% 100%, rgba(255, 204, 102, .045), transparent 60%),
        linear-gradient(180deg, #141A28 0%, #101522 46%, #0B0F1A 100%);
}

/* 局部 box-sizing：这些页面不保证 Bootstrap 先于本文件生效，
   而 width:100% + padding/border 在 content-box 下会撑出父容器。
   限定在 .pg-root 内，不会影响站内其他区域。 */
.pg-root,
.pg-root *,
.pg-root *::before,
.pg-root *::after {
    box-sizing: border-box;
}

/* 网格层：与入口页同一套语言，密度略高（这些页内容更多） */
.pg-root::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(152, 164, 187, .06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(152, 164, 187, .06) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask: radial-gradient(70% 60% at 50% 30%, #000 0%, transparent 100%);
    mask: radial-gradient(70% 60% at 50% 30%, #000 0%, transparent 100%);
}

/* ---------- 页头 ---------- */
.pg-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--pg-line);
    background: rgba(9, 12, 20, .78);
}

.pg-back {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 36px;
    padding: 0 .75rem;
    border-radius: 9px;
    border: 1px solid transparent;
    color: var(--pg-t2);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.pg-back:hover {
    color: var(--pg-t1);
    background: rgba(23, 225, 230, .10);
    border-color: rgba(23, 225, 230, .30);
}

.pg-back:focus-visible {
    outline: 2px solid var(--pg-cyan);
    outline-offset: 2px;
}

.pg-head-main {
    min-width: 0;
    flex: 1 1 auto;
}

.pg-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.3;
}

.pg-sub {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--pg-t3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 正文滚动区 ---------- */
.pg-body {
    position: relative;
    z-index: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.pg-wrap {
    width: min(46rem, 100%);
    margin: 0 auto;
    padding: 1.75rem 1.25rem 2.5rem;
}

/* ---------- 卡片 ---------- */
.pg-card {
    border-radius: 14px;
    background: var(--pg-card);
    border: 1px solid var(--pg-line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 10px 24px -14px rgba(0, 0, 0, .75);
}

.pg-card-pad {
    padding: 1.5rem;
}

/* ---------- 表单 ---------- */
.pg-field + .pg-field {
    margin-top: 1.25rem;
}

.pg-label {
    display: block;
    margin-bottom: .5rem;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--pg-t2);
}

.pg-hint {
    margin: .5rem 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--pg-t3);
}

/* BootstrapBlazor 的表单控件默认是浅色，这里统一改成深色。
   用后代选择器限定在 .pg-root 内，不影响站内其他表单 */
.pg-root .form-control,
.pg-root .form-select {
    /* width/padding/line-height 显式声明：不能依赖 Bootstrap 的 .form-control 提供，
       否则在没有 Bootstrap 的上下文（如静态预览）里输入框会缩成默认宽度 */
    width: 100%;
    padding: .5rem .75rem;
    line-height: 1.5;
    background-color: #131926;
    border: 1px solid rgba(152, 164, 187, .22);
    border-radius: 10px;
    color: var(--pg-t1);
    font-size: 14px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.pg-root .form-control::placeholder,
.pg-root .form-select::placeholder {
    color: #6B7689;
}

.pg-root .form-control:focus,
.pg-root .form-select:focus {
    background-color: #131926;
    border-color: rgba(23, 225, 230, .55);
    box-shadow: 0 0 0 3px rgba(23, 225, 230, .14);
    color: var(--pg-t1);
}

.pg-root .form-control:disabled,
.pg-root .form-select:disabled {
    background-color: #10141F;
    color: var(--pg-t3);
}

/* 下拉展开层 */
.pg-root .dropdown-menu {
    background-color: #161C2A;
    border: 1px solid var(--pg-line);
    border-radius: 10px;
    box-shadow: 0 16px 32px -18px rgba(0, 0, 0, .9);
}

.pg-root .dropdown-item {
    color: var(--pg-t2);
    font-size: 13px;
}

.pg-root .dropdown-item:hover,
.pg-root .dropdown-item:focus {
    background-color: rgba(23, 225, 230, .12);
    color: var(--pg-t1);
}

.pg-root .dropdown-item.active {
    background-color: rgba(23, 225, 230, .18);
    color: var(--pg-cyan-soft);
}

/* ---------- 按钮 ---------- */
.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: 0 1.25rem;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 90ms ease;
}

.pg-btn:focus-visible {
    outline: 3px solid var(--pg-cyan);
    outline-offset: 2px;
}

.pg-btn:active {
    transform: scale(.985);
}

.pg-btn-primary {
    background: linear-gradient(180deg, rgba(23, 225, 230, .22), rgba(23, 225, 230, .12));
    border-color: rgba(23, 225, 230, .45);
    color: var(--pg-cyan-soft);
}

.pg-btn-primary:hover {
    background: linear-gradient(180deg, rgba(23, 225, 230, .30), rgba(23, 225, 230, .18));
    border-color: rgba(23, 225, 230, .70);
    color: #DFFDFF;
}

.pg-btn-block {
    width: 100%;
}

/* BootstrapBlazor 的 Button 渲染成 <button class="btn btn-primary">，
   这里覆盖成深色系，避免和页面其他深色块割裂 */
.pg-root .btn-primary {
    --bs-btn-bg: rgba(23, 225, 230, .16);
    --bs-btn-border-color: rgba(23, 225, 230, .45);
    --bs-btn-color: var(--pg-cyan-soft);
    --bs-btn-hover-bg: rgba(23, 225, 230, .26);
    --bs-btn-hover-border-color: rgba(23, 225, 230, .68);
    --bs-btn-hover-color: #DFFDFF;
    --bs-btn-active-bg: rgba(23, 225, 230, .30);
    --bs-btn-active-border-color: rgba(23, 225, 230, .75);
    --bs-btn-disabled-bg: rgba(152, 164, 187, .12);
    --bs-btn-disabled-border-color: rgba(152, 164, 187, .24);
    --bs-btn-disabled-color: var(--pg-t3);
}

/* ---------- 空状态 ---------- */
.pg-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--pg-t3);
    font-size: 13px;
    line-height: 1.7;
}

.pg-empty i {
    display: block;
    margin-bottom: .625rem;
    font-size: 26px;
    opacity: .5;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .pg-wrap {
        padding: 1.25rem 1rem 2rem;
    }

    .pg-card-pad {
        padding: 1.125rem;
    }

    .pg-head {
        padding: .625rem .875rem;
    }

    .pg-title {
        font-size: 15px;
    }

    .pg-sub {
        font-size: 11.5px;
    }
}

/* ---------- 无障碍 ---------- */
@media (prefers-reduced-motion: reduce) {
    .pg-root * {
        animation-duration: .01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01s !important;
    }
}

@media (prefers-contrast: more) {
    .pg-root .form-control,
    .pg-root .form-select {
        border-color: #8C98B0;
    }

    .pg-sub,
    .pg-hint {
        color: #C8D3E6;
    }
}
