/* ==========================================================================
   首页（登录页）独立样式
   命名空间：.auth-*   避免与 fastadmin frontend.css 冲突
   配色与 public/assets/img/logo.svg 同源：
     --logo-navy  #2d4a6e  深蓝（主色）
     --logo-rust  #c0532c  橙红（点缀）
     --logo-slate #b8c2cc  蓝灰（电路纹理）
   ========================================================================== */

/* ---------- 基础重置 ---------- */
html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body.auth-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 400;
    color: #1f2937;
    background: #eef2f7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: #2d4a6e;
    text-decoration: none;
    transition: color .2s ease;
}
a:hover {
    color: #c0532c;
}

img {
    max-width: 100%;
    display: block;
}

/* ---------- 装饰背景（logo 同源渐变） ---------- */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse at top left, rgba(45, 74, 110, .20), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(192, 83, 44, .18), transparent 55%),
        linear-gradient(135deg, #eef2f7 0%, #fbf2ee 50%, #eef2f7 100%);
}

.auth-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .55;
    animation: authFloat 14s ease-in-out infinite;
}
.auth-bg-blob-1 {
    width: 520px; height: 520px;
    background: #2d4a6e;
    top: -180px; left: -160px;
}
.auth-bg-blob-2 {
    width: 460px; height: 460px;
    background: #c0532c;
    bottom: -200px; right: -120px;
    animation-delay: -4s;
}
.auth-bg-blob-3 {
    width: 360px; height: 360px;
    background: #93a8c2;
    top: 40%; left: 55%;
    opacity: .35;
    animation-delay: -8s;
}

@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(40px, -30px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg-blob { animation: none; }
}

/* ---------- 主布局 ---------- */
.auth-main {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 32px;
    align-items: center;
    gap: 48px;
}

/* ---------- 左侧品牌区 ---------- */
.auth-brand {
    flex: 1 1 50%;
    display: none;
    color: #1f2937;
}

@media (min-width: 992px) {
    .auth-brand {
        display: flex;
        align-items: center;
    }
    .auth-card-wrap {
        flex: 0 0 460px;
    }
}

.auth-brand-inner {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.auth-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 56px;
}
.auth-brand-logo img {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    box-shadow:
        0 10px 28px -6px rgba(45, 74, 110, .35),
        0 0 0 1px rgba(45, 74, 110, .08);
    transition: transform .35s ease, box-shadow .35s ease;
}
.auth-brand-logo:hover img {
    transform: translateY(-2px) rotate(-2deg);
    box-shadow:
        0 16px 36px -8px rgba(45, 74, 110, .45),
        0 0 0 1px rgba(192, 83, 44, .18);
}
.auth-brand-logo:hover {
    color: #2d4a6e;
}

/* logo 下方的弧形分隔线（呼应 logo 中心太极圆环） */
.auth-brand-inner::before {
    content: "";
    display: block;
    width: 56px;
    height: 2px;
    margin: 22px 0 22px;
    background: linear-gradient(90deg, #2d4a6e 0%, #c0532c 100%);
    border-radius: 2px;
    opacity: .85;
}

.auth-brand-title {
    font-size: 44px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -1px;
    margin: 0 0 20px;
    color: #111827;
}
.auth-brand-title em {
    font-style: normal;
    background: linear-gradient(120deg, #c0532c 0%, #e07a4a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-brand-subtitle {
    font-size: 17px;
    line-height: 1.7;
    color: #4b5563;
    margin: 0 0 36px;
    max-width: 420px;
}

.auth-brand-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 14px;
}
.auth-brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: #374151;
}
.auth-brand-features li i {
    color: #c0532c;
    font-size: 16px;
}

/* ---------- 右侧卡片 ---------- */
.auth-card-wrap {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 1px 2px rgba(16, 24, 40, .04),
        0 24px 48px -16px rgba(16, 24, 40, .12),
        0 60px 80px -32px rgba(45, 74, 110, .18);
    padding: 28px 36px 24px;
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2d4a6e 0%, #c0532c 60%, #93a8c2 100%);
}

.auth-card-head {
    text-align: center;
    margin-bottom: 18px;
}
.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px;
    letter-spacing: -.5px;
}
.auth-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

/* ---------- Tab ---------- */
.auth-tabs {
    display: flex;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}
.auth-tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    border-radius: 7px;
    transition: all .2s ease;
    cursor: pointer;
}
.auth-tab.active {
    background: #ffffff;
    color: #2d4a6e;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px rgba(45, 74, 110, .10);
}
.auth-tab:not(.active):hover {
    color: #111827;
}

/* ---------- 表单 ---------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.auth-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-left: 2px;
}
.auth-required {
    color: #ef4444;
    font-weight: 600;
    margin-left: 2px;
    line-height: 1;
}
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.auth-input-icon {
    position: absolute;
    left: 16px;
    /* 用固定值 22px（input 高度 44px 的一半），不用百分比：
       因为 .auth-input-wrap 被加了 flex-wrap:wrap，wrap 高度会被 .msg-box 撑大，
       top:50% 会跑到 msg-box 那一行的中间（约 38px），偏离 input 中间 */
    top: 22px;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
    transition: color .2s ease;
}
.auth-input {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 44px;
    font-size: 14px;
    color: #111827;
    background: #f9fafb;
    border: 1.5px solid transparent;
    border-radius: 10px;
    outline: none;
    transition: all .2s ease;
}
.auth-input::placeholder {
    color: #9ca3af;
}
.auth-input:hover {
    background: #ffffff;
    border-color: #e5e7eb;
}
.auth-input:focus {
    background: #ffffff;
    border-color: #2d4a6e;
    box-shadow: 0 0 0 4px rgba(45, 74, 110, .12);
}
.auth-input:focus + .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon {
    color: #2d4a6e;
}

.auth-help {
    min-height: 18px;
    font-size: 12px;
    color: #ef4444;
    padding: 2px 0 0 4px;
    line-height: 1.5;
    /* 独立换行：每个字段的错误独占 .auth-help 一行，位于 input 下方 */
    display: block;
    white-space: normal;
    word-break: break-word;
}

/* ---------- 覆盖 fastadmin / nice-validator 错误提示 ----------
   问题：nice-validator 默认把错误提示放在 input 右侧（.n-right）
   且 .msg-wrap 设了 white-space:nowrap，导致"× 此处不能为空"被截断成"× 此"
   关键陷阱：nice-validator 用 insertAfter($el) 把 .msg-box 插入到 input
   的下一个兄弟位置，而 input 在 .auth-input-wrap / .auth-captcha-wrap
   （都是 display:flex）内，所以 .msg-box 也变成 flex item，跟 input
   并排显示在右侧，且 input 被挤压。

   解决：限定在 .auth-field 作用域下，给所有 flex 父容器加 flex-wrap:wrap，
   并让 .msg-box 用 flex-basis:100% 强制换行到下一行。
   注意：msg-box 被插到 input 之后（在 input 和 img 之间），
   必须用 order:999 强制排在最后，否则会把中间布局搞乱。
   影响范围：仅前台登录/注册页（admin 后台表单不受影响）。 */
.auth-field .auth-input-wrap,
.auth-field .auth-captcha-wrap {
    flex-wrap: wrap;
}
/* 验证码区：input + gap(8px) + img span 的总宽度必须 <= 100%，
   否则 gap 会让 img 被挤到下一行。把 flex-basis 从 50% 改为 calc(50% - 4px) 让出 gap 空间。 */
.auth-field .auth-captcha-wrap > input.form-control,
.auth-field .auth-captcha-wrap > .input-group-btn {
    flex: 1 1 calc(50% - 4px) !important;
}
.auth-field .msg-box {
    /* 强制排在 input/图片之后，避免插入到中间破坏并排布局 */
    order: 999 !important;
    /* 强制占满一整行，触发 flex-wrap 换行 */
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    margin-top: 6px !important;
    position: static !important;
    display: block !important;
}
.auth-field .msg-box .msg-wrap {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    display: block !important;
    margin: 0 !important;
    padding: 6px 10px !important;
    background: #fef2f2 !important;
    border: none !important;
    border-left: 3px solid #c0532c !important;
    border-radius: 4px !important;
    color: #b91c1c !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
    white-space: normal !important;
    word-break: break-word !important;
    max-width: 100% !important;
    box-shadow: none !important;
}
.auth-field .msg-box .n-arrow {
    display: none !important;
}
.auth-field .msg-box .n-error .n-icon {
    /* 保留小图标（×），但用 inline 排版，不占独立行 */
    display: inline-block !important;
    vertical-align: middle !important;
    margin-right: 4px !important;
}
.auth-field .msg-box .n-msg {
    display: inline !important;
    vertical-align: middle !important;
}

/* ---------- 验证码（注册页） ---------- */
.auth-captcha-wrap {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.auth-captcha-wrap > input.form-control {
    flex: 1 1 50%;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
    color: #111827;
    background: #f9fafb;
    border: 1.5px solid transparent;
    border-radius: 10px;
    outline: none;
    transition: all .2s ease;
}
.auth-captcha-wrap > input.form-control::placeholder {
    color: #9ca3af;
}
.auth-captcha-wrap > input.form-control:hover {
    background: #ffffff;
    border-color: #e5e7eb;
}
.auth-captcha-wrap > input.form-control:focus {
    background: #ffffff;
    border-color: #2d4a6e;
    box-shadow: 0 0 0 4px rgba(45, 74, 110, .12);
}
.auth-captcha-wrap > .input-group-btn {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
}
.auth-captcha-wrap > .input-group-btn > .btn-captcha,
.auth-captcha-wrap > .input-group-btn > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 44px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background: linear-gradient(120deg, #2d4a6e 0%, #3a5d8a 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: all .2s ease;
}
.auth-captcha-wrap > .input-group-btn > .btn-captcha:hover,
.auth-captcha-wrap > .input-group-btn > a:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px rgba(45, 74, 110, .55);
    color: #ffffff;
}
.auth-captcha-wrap > .input-group-btn > img {
    flex: 1 1 0;
    width: 100%;
    height: 44px;
    min-width: 0;
    border-radius: 10px;
    cursor: pointer;
    background: #ffffff;
    object-fit: contain;
}

/* ---------- 复选框 ---------- */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -4px;
}
.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}
.auth-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.auth-checkbox-mark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 5px;
    transition: all .2s ease;
}
.auth-checkbox-mark::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .2s ease;
}
.auth-checkbox input:checked + .auth-checkbox-mark {
    background: #2d4a6e;
    border-color: #2d4a6e;
}
.auth-checkbox input:checked + .auth-checkbox-mark::after {
    transform: rotate(45deg) scale(1);
}

/* ---------- 按钮 ---------- */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 24px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
    line-height: 1;
}
.auth-btn-primary {
    background: linear-gradient(120deg, #2d4a6e 0%, #3a5d8a 100%);
    color: #ffffff;
    box-shadow: 0 8px 20px -6px rgba(45, 74, 110, .55);
}
.auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -8px rgba(45, 74, 110, .65);
    color: #ffffff;
}
.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px -2px rgba(45, 74, 110, .5);
}
.auth-btn-block {
    width: 100%;
}
.auth-btn-arrow {
    transition: transform .2s ease;
}
.auth-btn-primary:hover .auth-btn-arrow {
    transform: translateX(4px);
}

.auth-btn-ghost {
    background: #ffffff;
    color: #4b5563;
    border: 1.5px solid #e5e7eb;
}
.auth-btn-ghost:hover {
    border-color: #d1d5db;
    color: #111827;
    background: #f9fafb;
}

/* ---------- 表单尾部链接 ---------- */
.auth-foot {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    margin: 4px 0 0;
}
.auth-foot a {
    color: #2d4a6e;
    font-weight: 500;
}

/* ---------- 已登录欢迎卡片 ---------- */
.auth-card-welcome {
    text-align: center;
    padding: 48px 40px;
}
.auth-avatar {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow:
        0 10px 24px -8px rgba(45, 74, 110, .35),
        0 0 0 4px rgba(255, 255, 255, 1),
        0 0 0 5px rgba(45, 74, 110, .18);
}
.auth-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.auth-welcome-title {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px;
}
.auth-welcome-sub {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 28px;
}
.auth-welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- 版权 ---------- */
.auth-copyright {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin: 8px 0 0;
    line-height: 1.6;
}
.auth-copyright a {
    color: #9ca3af;
}
.auth-copyright a:hover {
    color: #2d4a6e;
}

/* ---------- 响应式 ---------- */
@media (max-width: 991px) {
    .auth-main {
        padding: 24px 16px;
        gap: 0;
    }
}

@media (max-width: 575px) {
    .auth-main {
        padding: 16px 12px;
        align-items: stretch;
    }
    .auth-card {
        padding: 32px 22px 28px;
        border-radius: 16px;
    }
    .auth-card-welcome {
        padding: 40px 22px 32px;
    }
    .auth-title {
        font-size: 22px;
    }
    .auth-card::before {
        height: 3px;
    }
}