/* 登录页面样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    border-radius: 24px;
    padding: 45px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: slideUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    margin-bottom: 20px;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.login-header h1 {
    background: linear-gradient(135deg, #1f2937 0%, #4f46e5 50%, #7c3aed 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-header p {
    color: #6b7280;
    font-size: 14px;
    font-weight: 400;
}

.login-form {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    background: linear-gradient(135deg, #374151 0%, #4f46e5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    width: 100%;
    padding: 14px 50px 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.password-input-wrapper input:focus {
    border-color: #4f46e5;
    box-shadow: 
        0 0 0 4px rgba(79, 70, 229, 0.15),
        0 4px 12px rgba(79, 70, 229, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transform: translateY(-1px);
}

.password-input-wrapper input::placeholder {
    color: #9ca3af;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toggle-password:hover {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.1);
}

.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #dc2626;
    font-size: 14px;
    margin-top: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(239, 68, 68, 0.08) 100%);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 12px;
    animation: shake 0.6s ease-in-out, errorGlow 2s ease-in-out;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

@keyframes errorGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15); }
    50% { box-shadow: 0 4px 20px rgba(220, 38, 38, 0.25); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0) scale(1); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px) scale(1.02); }
    20%, 40%, 60%, 80% { transform: translateX(3px) scale(0.98); }
}

.login-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
    background-size: 200% 200%;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    margin-top: 15px;
    box-shadow: 
        0 8px 25px rgba(79, 70, 229, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: buttonGlow 2s ease-in-out infinite alternate;
}

@keyframes buttonGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.login-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 15px 35px rgba(79, 70, 229, 0.4),
        0 5px 15px rgba(124, 58, 237, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    background-position: 100% 50%;
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.button-text {
    display: inline-block;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 记住密码复选框样式 */
.remember-password-wrapper {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.remember-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #6b7280;
    transition: color 0.3s ease;
}

.remember-checkbox:hover {
    color: #4f46e5;
}

.remember-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 8px;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remember-checkbox:hover .checkmark {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.remember-checkbox input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.remember-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    top: 2px;
    left: 5px;
}

.checkbox-text {
    font-weight: 500;
    letter-spacing: 0.2px;
}

.login-footer {
    text-align: center;
}

.login-footer p {
    color: #9ca3af;
    font-size: 12px;
}

/* 背景装饰 */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 70%, transparent 100%);
    backdrop-filter: blur(2px);
    animation: float 8s ease-in-out infinite;
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.circle-1 {
    width: 120px;
    height: 120px;
    top: 8%;
    left: 8%;
    animation-delay: 0s;
}

.circle-2 {
    width: 180px;
    height: 180px;
    top: 55%;
    right: 8%;
    animation-delay: 2.5s;
}

.circle-3 {
    width: 100px;
    height: 100px;
    bottom: 15%;
    left: 15%;
    animation-delay: 5s;
}

.circle-4 {
    width: 60px;
    height: 60px;
    top: 25%;
    right: 25%;
    animation-delay: 1.5s;
}

.circle-5 {
    width: 140px;
    height: 140px;
    bottom: 40%;
    right: 30%;
    animation-delay: 3.5s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg) scale(1);
        opacity: 0.6;
    }
    33% {
        transform: translateY(-15px) rotate(120deg) scale(1.1);
        opacity: 0.8;
    }
    66% {
        transform: translateY(-25px) rotate(240deg) scale(0.9);
        opacity: 1;
    }
}

/* 输入框通用样式 */
input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

input[type="text"]:focus {
    border-color: #4f46e5;
    box-shadow: 
        0 0 0 4px rgba(79, 70, 229, 0.15),
        0 4px 12px rgba(79, 70, 229, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transform: translateY(-1px);
}

input[type="text"]::placeholder {
    color: #9ca3af;
}

/* 默认竖屏模式下表单字段垂直排列 */
.form-row {
    display: block;
}

.form-row .input-group {
    margin-bottom: 20px;
}

/* 响应式设计 */
/* 平板设备 */
@media (max-width: 1024px) and (min-width: 769px) {
    .login-container {
        max-width: 450px;
        padding: 25px;
    }
    
    .login-box {
        padding: 40px 35px;
    }
}

/* 大屏手机和小平板 */
@media (max-width: 768px) and (min-width: 481px) {
    .login-container {
        padding: 20px;
        max-width: 85%;
    }
    
    .login-box {
        padding: 35px 25px;
    }
    
    .login-header h1 {
        font-size: 24px;
        line-height: 1.3;
    }
    
    .password-input-wrapper input,
    input[type="text"] {
        font-size: 16px;
        padding: 14px 45px 14px 16px;
    }
    
    .login-button {
        padding: 16px;
        font-size: 16px;
    }
    
    .decoration-circle {
        opacity: 0.4;
    }
}

/* 中等屏幕手机 */
@media (max-width: 480px) and (min-width: 361px) {
    .login-container {
        padding: 15px;
        max-width: 90%;
    }
    
    .login-box {
        padding: 30px 22px;
    }
    
    .login-header h1 {
        font-size: 22px;
        line-height: 1.3;
    }
    
    .password-input-wrapper input,
    input[type="text"] {
        font-size: 16px;
        padding: 12px 40px 12px 14px;
    }
    
    .decoration-circle {
        opacity: 0.3;
    }
}

/* 小屏手机 */
@media (max-width: 360px) {
    .login-container {
        padding: 10px;
        max-width: 95%;
    }
    
    .login-box {
        padding: 25px 18px;
    }
    
    .login-header h1 {
        font-size: 20px;
        line-height: 1.2;
    }
    
    .login-header p {
        font-size: 13px;
    }
    
    .password-input-wrapper input,
    input[type="text"] {
        font-size: 15px;
        padding: 11px 38px 11px 13px;
    }
    
    .login-button {
        padding: 14px;
        font-size: 15px;
    }
    
    .decoration-circle {
        display: none;
    }
}

/* 通用横屏模式优化 - 适用于所有横屏设备 */
@media (orientation: landscape) and (max-height: 500px) {
    body {
        overflow-y: auto;
        min-height: auto;
        height: 100vh;
        align-items: flex-start;
        padding: 2px 0;
        justify-content: center;
    }
    
    .login-container {
        padding: 2px 10px;
        max-width: 90vw;
        margin: 2px auto;
        width: 100%;
        min-width: 320px;
    }
    
    .login-box {
        padding: 8px 15px;
        margin: 0;
        border-radius: 12px;
        max-width: 100%;
    }
    
    .login-header {
        margin-bottom: 8px;
        text-align: center;
    }
    
    .login-header h1 {
        font-size: 14px;
        margin-bottom: 3px;
        line-height: 1.1;
    }
    
    .login-header p {
        font-size: 10px;
        margin-bottom: 0;
    }
    
    .logo {
        margin-bottom: 5px;
    }
    
    .logo svg {
        width: 25px;
        height: 25px;
    }
    
    /* 横屏模式下表单字段横排显示 */
    .login-form {
        margin-bottom: 8px;
    }
    
    .form-row {
        display: flex;
        gap: 10px;
        align-items: flex-end;
        flex-wrap: nowrap;
    }
    
    .input-group {
        margin-bottom: 6px;
        flex: 1;
        min-width: 0;
    }
    
    .input-group label {
        font-size: 11px;
        margin-bottom: 2px;
        display: block;
    }
    
    .password-input-wrapper input,
    input[type="text"] {
        padding: 6px 28px 6px 8px;
        font-size: 12px;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .password-input-wrapper {
        position: relative;
        width: 100%;
    }
    
    .toggle-password {
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .toggle-password svg {
        width: 14px;
        height: 14px;
    }
    
    .remember-password-wrapper {
        margin-bottom: 6px;
    }
    
    .remember-checkbox {
        font-size: 10px;
    }
    
    .checkmark {
        width: 14px;
        height: 14px;
        margin-right: 6px;
    }
    
    .remember-checkbox input[type="checkbox"]:checked + .checkmark::after {
        width: 3px;
        height: 6px;
        top: 1px;
        left: 4px;
    }
    
    .login-button {
        padding: 6px 12px;
        font-size: 12px;
        margin-top: 4px;
        border-radius: 8px;
        width: 100%;
    }
    
    .login-footer p {
        font-size: 8px;
        margin: 4px 0 0 0;
    }
    
    .decoration-circle {
        display: none;
    }
    
    .error-message {
        padding: 4px 8px;
        font-size: 9px;
        margin-top: 4px;
        border-radius: 6px;
    }
}

/* 中等屏幕横屏模式 - 屏幕高度足够时使用竖排布局 */
@media (orientation: landscape) and (min-height: 501px) and (max-width: 1024px) {
    body {
        overflow-y: auto;
        padding: 10px 0;
    }
    
    .login-container {
        padding: 10px 20px;
        max-width: 500px;
        margin: 10px auto;
    }
    
    .login-box {
        padding: 20px 30px;
        border-radius: 16px;
    }
    
    .login-header {
        margin-bottom: 20px;
    }
    
    .login-header h1 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .login-header p {
        font-size: 12px;
    }
    
    .logo svg {
        width: 40px;
        height: 40px;
    }
    
    /* 屏幕高度足够时使用竖排布局 */
    .form-row {
        display: block;
    }
    
    .input-group {
        margin-bottom: 15px;
        width: 100%;
    }
    
    .input-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .password-input-wrapper input,
    input[type="text"] {
        padding: 10px 35px 10px 12px;
        font-size: 14px;
        border-radius: 12px;
    }
    
    .login-button {
        padding: 12px;
        font-size: 14px;
        margin-top: 10px;
    }
    
    .decoration-circle {
        display: none;
    }
}

/* 极小屏幕特殊处理 - 确保在任何情况下都能显示完整 */
@media (max-width: 480px) and (orientation: landscape) and (max-height: 320px) {
    body {
        padding: 1px 0;
        font-size: 12px;
    }
    
    .login-container {
        padding: 1px 5px;
        max-width: 95vw;
        margin: 1px auto;
    }
    
    .login-box {
        padding: 5px 10px;
        border-radius: 8px;
    }
    
    .login-header {
        margin-bottom: 4px;
    }
    
    .login-header h1 {
        font-size: 12px;
        margin-bottom: 2px;
        line-height: 1;
    }
    
    .login-header p {
        font-size: 8px;
        margin-bottom: 0;
    }
    
    .logo {
        margin-bottom: 3px;
    }
    
    .logo svg {
        width: 20px;
        height: 20px;
    }
    
    .login-form {
        margin-bottom: 4px;
    }
    
    .form-row {
        gap: 8px;
    }
    
    .input-group {
        margin-bottom: 3px;
    }
    
    .input-group label {
        font-size: 9px;
        margin-bottom: 1px;
    }
    
    .password-input-wrapper input,
    input[type="text"] {
        padding: 4px 24px 4px 6px;
        font-size: 10px;
        border-radius: 6px;
        min-height: 20px;
    }
    
    .toggle-password {
        right: 4px;
    }
    
    .toggle-password svg {
        width: 12px;
        height: 12px;
    }
    
    .login-button {
        padding: 4px 8px;
        font-size: 10px;
        margin-top: 2px;
        border-radius: 6px;
        min-height: 24px;
    }
    
    .login-footer p {
        font-size: 7px;
        margin: 2px 0 0 0;
    }
    
    .error-message {
        padding: 2px 6px;
        font-size: 8px;
        margin-top: 2px;
        border-radius: 4px;
    }
}

/* 确保表单在所有横屏模式下都能自适应 */
@media (orientation: landscape) {
    /* 基础自适应规则 */
    .form-row {
        display: flex;
        flex-wrap: wrap;
    }
    
    /* 当屏幕宽度足够时，使用横排布局 */
    @media (min-width: 480px) {
        .form-row {
            flex-wrap: nowrap;
        }
    }
    
    /* 当屏幕宽度不够时，自动换行 */
    @media (max-width: 479px) {
        .form-row {
            flex-direction: column;
        }
        
        .input-group {
            width: 100%;
            margin-bottom: 8px;
        }
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .login-box {
        background: rgba(31, 41, 55, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .login-header h1 {
        color: #f9fafb;
    }
    
    .login-header p {
        color: #d1d5db;
    }
    
    .input-group label {
        color: #e5e7eb;
    }
    
    .password-input-wrapper input {
        background: rgba(55, 65, 81, 0.8);
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .password-input-wrapper input::placeholder {
        color: #9ca3af;
    }
    
    .remember-checkbox {
        color: #d1d5db;
    }
    
    .remember-checkbox:hover {
        color: #a78bfa;
    }
    
    .checkmark {
        border-color: #6b7280;
        background: rgba(55, 65, 81, 0.8);
    }
    
    .remember-checkbox:hover .checkmark {
        border-color: #a78bfa;
        box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.1);
    }
    
    .remember-checkbox input[type="checkbox"]:checked + .checkmark {
        background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
        border-color: #7c3aed;
        box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    }
    
    .login-footer p {
        color: #6b7280;
    }
}