/*
 * ===================================================================================
 * 文件说明: css/pages/login.css
 * 作用:     登录页面的专属样式
 * 特点:     使用 CSS 变量接收由 JavaScript 生成的随机柔和背景色
 * ===================================================================================
 */

/* =====================
   基础重置和全局样式
   ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: #f0f4f8;
}

/* =====================
   全局动态模糊渐变背景
   ===================== */
body::before {
    content: '';
    position: fixed;
    top: -50%; 
    left: -50%;
    width: 200%; 
    height: 200%;
    z-index: 0;
    
    background: radial-gradient(
        circle,
        var(--grad-color-1, #ede7f6),
        var(--grad-color-2, #e0f7fa),
        var(--grad-color-3, #fffde7)
    );
    
    filter: blur(80px);
    animation: rotateBackground 25s linear infinite;
}

@keyframes rotateBackground {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =====================
   背景图片层
   ===================== */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(1.05);
    z-index: 1;
    animation: slowZoom 30s ease-in-out infinite alternate;
    transition: opacity 1s ease;
}

@keyframes slowZoom {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* =====================
   装饰圆圈
   ===================== */
.bg-decoration {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    filter: blur(15px);
    z-index: 3;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* 确保圆圈不会遮挡登录面板 */
.login-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    min-width: 320px;
    z-index: 100 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-decoration:nth-child(1) { width: 28vw; height: 28vw; top: -10vw; left: -8vw; animation: float1 30s ease-in-out infinite; }
.bg-decoration:nth-child(2) { width: 18vw; height: 18vw; bottom: -6vw; right: -4vw; animation: float2 35s ease-in-out infinite; }
.bg-decoration:nth-child(3) { width: 13vw; height: 13vw; top: 40%; left: -5vw; animation: float3 25s ease-in-out infinite; }
.bg-decoration:nth-child(4) { width: 23vw; height: 23vw; top: 10%; right: -8vw; animation: float4 32s ease-in-out infinite; }
.bg-decoration:nth-child(5) { width: 11vw; height: 11vw; bottom: 30%; right: 5%; animation: float5 28s ease-in-out infinite; }

@keyframes float1 { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 33% { transform: translate(20px, -30px) rotate(45deg); } 66% { transform: translate(-15px, 20px) rotate(90deg); } }
@keyframes float2 { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 33% { transform: translate(-25px, 15px) rotate(-45deg); } 66% { transform: translate(20px, -20px) rotate(-90deg); } }
@keyframes float3 { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(15px, 25px) rotate(60deg); } }
@keyframes float4 { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 40% { transform: translate(-30px, 20px) rotate(-60deg); } 80% { transform: translate(25px, -15px) rotate(-120deg); } }
@keyframes float5 { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(-20px, -25px) rotate(90deg); } }

/* =====================
   粒子效果
   ===================== */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat linear forwards;
}

@keyframes particleFloat {
    from { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    to { transform: translateY(-100vh) translateX(var(--drift)); opacity: 0; }
}

/* =====================
   登录卡片与表单
   ===================== */

.login-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 28px 24px;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #88d3ce, #6cd6a0);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 24px -4px rgba(136, 211, 206, 0.4);
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.logo-subtitle {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

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

.input-wrapper {
    position: relative;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.form-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1e293b;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.form-input:focus {
    outline: none;
    border-color: #88d3ce;
    background: white;
    box-shadow: 0 0 0 4px rgba(136, 211, 206, 0.15);
}

.form-input::placeholder {
    color: #94a3b8;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.2s ease;
    border-radius: 8px;
    z-index: 10;
}

.password-toggle:hover {
    background: rgba(136, 211, 206, 0.1);
    color: #88d3ce;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.error-message {
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    min-height: 20px;
    font-weight: 500;
    display: none;
    transition: color 0.3s ease;
}

/* 成功消息样式（绿色） */
.error-message.success {
    color: #10b981;
}

/* 错误消息样式（红色） */
.error-message.error {
    color: #ef4444;
}

.login-button {
    width: 100%;
    padding: 16px;
    margin-top: 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #88d3ce 0%, #6cd6a0 100%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 20px -2px rgba(136, 211, 206, 0.4);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.login-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.login-button:hover::before {
    left: 100%;
}

.login-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px -2px rgba(136, 211, 206, 0.6);
    background: linear-gradient(135deg, #6bb6b0 0%, #5cb85c 100%);
}

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

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.footer-links {
    margin-top: 20px;
    text-align: center;
}

.footer-link {
    color: #64748b;
    font-size: 13px;
    text-decoration: none;
    position: relative;
    display: inline-block;
    transition: color 0.2s ease;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #88d3ce;
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: #88d3ce;
}

.footer-link:hover::after {
    width: 100%;
}

/* =====================
   免责声明
   ===================== */
.disclaimer {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    text-align: center;
    color: rgba(0, 0, 0, 0.8);
    font-size: clamp(10px, 2.5vw, 16px);
    line-height: 1.5;
    z-index: 101;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 500;
}

.disclaimer.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* =====================
   验证码样式
   ===================== */
#captcha-container {
    margin: 18px 0;
}

/* 验证码容器平滑进入动画 */
.captcha-slide-in {
    animation: captchaFadeIn 0.5s ease-out;
}

@keyframes captchaFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.captcha-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 12px;
    width: 100%;
}

.captcha-input {
    flex: 1;
    padding: 12px 14px 12px 40px;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    letter-spacing: 1px;
    min-width: 0;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.captcha-input:focus {
    outline: none;
    border-color: #88d3ce;
    background: white;
    box-shadow: 0 0 0 4px rgba(136, 211, 206, 0.15);
}

.captcha-input::placeholder {
    color: #94a3b8;
    letter-spacing: normal;
}

.captcha-image {
    width: 160px;
    height: auto;
    min-height: 48px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    object-fit: contain;
}

.captcha-image:hover {
    border-color: #88d3ce;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(136, 211, 206, 0.3);
}

.captcha-image:active {
    transform: scale(0.95);
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* =====================
   响应式设计
   ===================== */
@media (min-width: 1200px) {
    .login-container { 
        max-width: 450px;
        transform: translate(-50%, -50%) scale(1.1);
    }
    .login-card { padding: 32px 28px; }
}

@media (max-width: 768px) {
    .login-container { max-width: 340px; }
    .login-card { padding: 24px 20px; }
}

@media (max-width: 480px) {
    .login-container { max-width: 320px; }
    .login-card { padding: 22px 18px; }
    .logo-icon { width: 56px; height: 56px; font-size: 26px; }
    .logo-title { font-size: 18px; }
    
    .form-input {
        font-size: 16px;
        padding: 14px 16px 14px 44px;
    }
    
    .input-icon {
        width: 20px;
        height: 20px;
        left: 16px;
    }
    
    .login-button {
        padding: 18px;
        font-size: 16px;
        margin-top: 20px;
    }
    
    .password-toggle {
        width: 44px;
        height: 44px;
        right: 8px;
        touch-action: manipulation;
    }
    
    .captcha-wrapper {
        gap: 8px;
    }
    
    .captcha-image {
        width: 120px;
        min-height: 44px;
    }
    
    .captcha-input {
        font-size: 14px;
        letter-spacing: 0.5px;
        padding: 10px 12px 10px 35px;
    }
}

