/* ========================================
   文章分发系统 — 登录页专属样式
   水墨国风沉浸式登录体验
   ======================================== */

/* ===== Google Fonts 备用 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700;900&display=swap');

/* ===== 动画定义 ===== */
@keyframes floatUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes mistDrift {
    0% { transform: translateX(-100%) scaleY(0.8); opacity: 0; }
    30% { opacity: 0.6; }
    70% { opacity: 0.4; }
    100% { transform: translateX(100vw) scaleY(1.2); opacity: 0; }
}

@keyframes petalFall {
    0% {
        transform: translateY(-10vh) translateX(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% {
        transform: translateY(105vh) translateX(80px) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sealStamp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.5) rotate(-20deg);
    }
    60% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.9) rotate(2deg);
    }
    80% {
        transform: translate(-50%, -50%) scale(1.05) rotate(-1deg);
    }
    100% {
        opacity: 0.85;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
}

@keyframes inputFocusLine {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes inkSpread {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes poemFade {
    from { opacity: 0; letter-spacing: 8px; }
    to { opacity: 0.5; letter-spacing: 4px; }
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 8px 40px rgba(194, 58, 46, 0.08); }
    50% { box-shadow: 0 12px 60px rgba(194, 58, 46, 0.15); }
}

/* ===== 登录页全局 ===== */
.login-page {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.login-scene {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

/* ===== 水墨山水背景 ===== */
.ink-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* 用户端 — 暖色宣纸底 */
.user-login .ink-bg {
    background:
        radial-gradient(ellipse at 20% 80%, rgba(212, 168, 73, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(194, 58, 46, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(232, 240, 228, 0.3) 0%, transparent 70%),
        linear-gradient(175deg, #faf8f0 0%, #f5f2e8 30%, #eee9d8 60%, #e8e0cc 100%);
}

/* 管理端 — 冷色水墨底 */
.admin-login .ink-bg {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(74, 144, 217, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 30%, rgba(53, 122, 189, 0.04) 0%, transparent 50%),
        linear-gradient(175deg, #f0f2f5 0%, #e8ecf2 30%, #dde3ed 60%, #d0d8e5 100%);
}

/* 山 — CSS 绘制的水墨远山 */
.mountain {
    position: absolute;
    bottom: 0;
    width: 100%;
    opacity: 0.06;
}

.mountain-far {
    height: 35%;
    background:
        radial-gradient(ellipse 60% 100% at 15% 100%, #2c2c2c 0%, transparent 70%),
        radial-gradient(ellipse 50% 100% at 45% 100%, #3a3a3a 0%, transparent 65%),
        radial-gradient(ellipse 55% 100% at 75% 100%, #2c2c2c 0%, transparent 70%);
}

.mountain-mid {
    height: 25%;
    opacity: 0.08;
    background:
        radial-gradient(ellipse 40% 100% at 25% 100%, #2c2c2c 0%, transparent 60%),
        radial-gradient(ellipse 45% 100% at 65% 100%, #3a3a3a 0%, transparent 65%);
}

.mountain-near {
    height: 12%;
    opacity: 0.04;
    background: linear-gradient(0deg, #2c2c2c 0%, transparent 100%);
}

/* ===== 云雾层 ===== */
.mist-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.mist {
    position: absolute;
    width: 120%;
    height: 60px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 20%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0.4) 80%,
        transparent 100%
    );
    filter: blur(20px);
}

.mist-1 {
    top: 30%;
    animation: mistDrift 18s ease-in-out infinite;
}

.mist-2 {
    top: 55%;
    animation: mistDrift 24s ease-in-out 6s infinite;
    opacity: 0.5;
}

.mist-3 {
    top: 75%;
    animation: mistDrift 20s ease-in-out 12s infinite;
    opacity: 0.3;
}

/* ===== 飘落元素 ===== */
.petals {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.petal {
    position: absolute;
    font-size: 16px;
    opacity: 0;
    animation: petalFall linear infinite;
}

.petal-1 { left: 10%; animation-duration: 12s; animation-delay: 0s; font-size: 14px; }
.petal-2 { left: 30%; animation-duration: 16s; animation-delay: 3s; font-size: 12px; }
.petal-3 { left: 55%; animation-duration: 14s; animation-delay: 7s; font-size: 16px; }
.petal-4 { left: 75%; animation-duration: 18s; animation-delay: 5s; font-size: 11px; }
.petal-5 { left: 90%; animation-duration: 15s; animation-delay: 10s; font-size: 13px; }

/* ===== 登录卡片 ===== */
.login-card {
    position: relative;
    z-index: 10;
    width: 380px;
    max-width: 90vw;
    padding: 48px 40px 36px;
    border-radius: 4px;
    animation: cardReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.2s;
}

.user-login .login-card {
    background:
        linear-gradient(135deg, rgba(250, 248, 240, 0.92), rgba(245, 242, 232, 0.95));
    border: 1px solid rgba(212, 168, 73, 0.2);
    box-shadow:
        0 2px 0 rgba(194, 58, 46, 0.08),
        0 8px 40px rgba(44, 44, 44, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    animation: cardReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both, breathe 4s ease-in-out 1.5s infinite;
    animation-delay: 0.2s;
}

.admin-login .login-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(74, 144, 217, 0.15);
    box-shadow:
        0 2px 0 rgba(74, 144, 217, 0.06),
        0 8px 40px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ===== 印章 ===== */
.seal-stamp {
    position: absolute;
    top: -20px;
    left: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Noto Serif SC", "STSong", serif;
    font-weight: 900;
    font-size: 22px;
    border-radius: 4px;
    animation: sealStamp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: 0.8s;
}

.user-login .seal-stamp {
    background: #c23a2e;
    color: #faf8f0;
    border: 2px solid #a8301f;
    box-shadow:
        0 3px 12px rgba(194, 58, 46, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.admin-login .seal-stamp {
    background: #4a90d9;
    color: #fff;
    border: 2px solid #357abd;
    box-shadow:
        0 3px 12px rgba(74, 144, 217, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* ===== 标题 ===== */
.login-title {
    text-align: center;
    margin-top: 24px;
    margin-bottom: 6px;
    font-family: "Noto Serif SC", "STSong", "SimSun", "Source Han Serif SC", serif;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 6px;
}

.user-login .login-title {
    color: #2c2c2c;
}

.admin-login .login-title {
    color: #1a1a2e;
}

.login-subtitle {
    text-align: center;
    font-family: "Noto Serif SC", "STSong", serif;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 3px;
    margin-bottom: 36px;
}

.user-login .login-subtitle {
    color: #a08860;
}

.admin-login .login-subtitle {
    color: #8899aa;
}

/* ===== 输入框 ===== */
.login-form .input-group {
    position: relative;
    margin-bottom: 24px;
}

.login-form .input-icon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    z-index: 1;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.login-form .input-group:focus-within .input-icon {
    opacity: 1;
}

.login-form input {
    width: 100%;
    padding: 12px 12px 12px 36px;
    font-size: 16px;
    font-family: "Noto Serif SC", "PingFang SC", sans-serif;
    font-weight: 400;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    color: #2c2c2c;
    outline: none;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.login-form input::placeholder {
    color: #bbb;
    font-size: 14px;
    letter-spacing: 2px;
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-login .input-line {
    background: linear-gradient(90deg, #c23a2e, #d4a849);
}

.admin-login .input-line {
    background: linear-gradient(90deg, #4a90d9, #67b26f);
}

.login-form .input-group:focus-within .input-line {
    width: 100%;
}

/* ===== 登录按钮 ===== */
.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    border: none;
    border-radius: 4px;
    font-family: "Noto Serif SC", "STSong", serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 8px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.35s ease;
}

.user-login .login-btn {
    background: linear-gradient(135deg, #c23a2e 0%, #a8301f 100%);
    color: #faf8f0;
    box-shadow:
        0 4px 16px rgba(194, 58, 46, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.user-login .login-btn:hover {
    background: linear-gradient(135deg, #d94a3e 0%, #c23a2e 100%);
    box-shadow: 0 6px 24px rgba(194, 58, 46, 0.35);
    transform: translateY(-1px);
}

.admin-login .login-btn {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: #fff;
    box-shadow:
        0 4px 16px rgba(74, 144, 217, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.admin-login .login-btn:hover {
    background: linear-gradient(135deg, #5a9ee0 0%, #4088cc 100%);
    box-shadow: 0 6px 24px rgba(74, 144, 217, 0.35);
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

/* 墨水扩散效果 */
.btn-ink-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.user-login .btn-ink-effect {
    background: rgba(168, 48, 31, 0.4);
}

.admin-login .btn-ink-effect {
    background: rgba(53, 122, 189, 0.4);
}

.login-btn:active .btn-ink-effect {
    animation: inkSpread 0.6s ease-out;
}

/* ===== 底部装饰 ===== */
.login-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}

.footer-line {
    flex: 1;
    height: 1px;
}

.user-login .footer-line {
    background: linear-gradient(90deg, transparent, rgba(212, 168, 73, 0.3), transparent);
}

.admin-login .footer-line {
    background: linear-gradient(90deg, transparent, rgba(74, 144, 217, 0.2), transparent);
}

.footer-text {
    font-size: 11px;
    letter-spacing: 3px;
    white-space: nowrap;
}

.user-login .footer-text {
    color: #c4a86a;
}

.admin-login .footer-text {
    color: #99aabb;
}

/* ===== 底部诗句 ===== */
.poem-bar {
    position: absolute;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    text-align: center;
    font-family: "Noto Serif SC", "STSong", "SimSun", serif;
    font-size: 13px;
    z-index: 5;
    animation: poemFade 1.5s ease both;
    animation-delay: 1.2s;
    opacity: 0;
}

.user-login .poem-bar {
    color: #a08860;
}

.admin-login .poem-bar {
    color: #8899aa;
}

/* ===== Flash 消息适配 ===== */
.login-card .flash-msg {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
    animation: slideDown 0.35s ease both;
}

.login-card .flash-error {
    background: rgba(194, 58, 46, 0.08);
    color: #c23a2e;
    border-left: 3px solid #c23a2e;
}

.login-card .flash-success {
    background: rgba(46, 125, 50, 0.08);
    color: #2e7d32;
    border-left: 3px solid #4caf50;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .login-scene {
        justify-content: flex-start;
        align-items: center;
        flex-direction: column;
        overflow: visible;
        padding-top: max(14px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .login-card {
        width: 100%;
        max-width: 100vw;
        padding: 44px 24px 24px;
        margin: 18px 16px 0;
        border-radius: 4px;
    }

    .login-title {
        font-size: 24px;
        letter-spacing: 4px;
    }

    .login-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
    }

    .login-btn {
        letter-spacing: 6px;
        font-size: 15px;
    }

    .poem-bar {
        position: static;
        margin-top: 16px;
        font-size: 12px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mist-layer { display: none; }
    .petal { display: none; }
}

@media (max-height: 700px) {
    .login-scene {
        justify-content: flex-start;
        align-items: center;
        overflow: visible;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .login-card {
        padding: 36px 28px 24px;
        margin-top: 18px;
    }

    .login-subtitle {
        margin-bottom: 24px;
    }

    .login-form .input-group {
        margin-bottom: 18px;
    }

    .poem-bar {
        display: none;
    }
}
