/**
 * 登录注册样式 - auth.css
 * 中国红风格设计 - 传统与现代融合
 */

/* 基础重置与变量 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #C41E3A;
    --primary-gradient: linear-gradient(135deg, #C41E3A 0%, #D7000F 100%);
    --primary-hover: linear-gradient(135deg, #D7000F 0%, #B22222 100%);
    --disabled-color: #CCCCCC;
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --text-white: #FFFFFF;
    --border-color: rgba(196, 30, 58, 0.5);
    --background: linear-gradient(135deg, #FFF5F5 0%, #FFE6E6 100%);
    --icon-color: #C41E3A;
    --shadow-light: 0 8px 32px rgba(196, 30, 58, 0.08);
    --shadow-medium: 0 12px 40px rgba(196, 30, 58, 0.12);
    --shadow-heavy: 0 16px 48px rgba(196, 30, 58, 0.16);
    --shadow-glow: 0 0 20px rgba(196, 30, 58, 0.2);
    --border-radius-lg: 28px;
    --border-radius-md: 20px;
    --border-radius-sm: 12px;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 登录页专属body样式 */
html body.login-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--background) !important;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    margin: 0;
    color: var(--text-primary) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-attachment: fixed;
    background-size: cover;
    position: relative;
    overflow-x: hidden;
}

body.login-body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 90%, rgba(196, 30, 58, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 90% 10%, rgba(196, 30, 58, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 245, 245, 0.9) 0%, transparent 60%);
    z-index: -1;
    animation: gradientShift 15s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Logo区域 */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 40px 20px;
}

.logo-circle {
    width: 90px;
    height: 90px;
    border-radius: var(--border-radius-md);
    background: var(--primary-gradient);
    box-shadow: var(--shadow-medium), 
                var(--shadow-glow),
                0 0 0 1px rgba(196, 30, 58, 0.1) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    margin-bottom: 24px;
    transition: all 0.4s var(--transition-smooth);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 30, 58, 0.3);
    position: relative;
    overflow: hidden;
}

.logo-circle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(196, 30, 58, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.logo-circle:hover {
    transform: translateY(-6px) scale(1.08);
    box-shadow: var(--shadow-heavy),
                var(--shadow-glow),
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.logo-circle:hover::before {
    opacity: 1;
}

.logo-circle:active {
    transform: translateY(-2px) scale(1.02);
}

.logo-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 2px;
}

/* 登录容器 */
.login-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 44px 40px;
    background: linear-gradient(135deg, rgba(255, 245, 245, 0.25) 0%, rgba(255, 230, 230, 0.2) 100%);
    backdrop-filter: blur(24px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium),
                var(--shadow-glow),
                0 0 0 1px rgba(196, 30, 58, 0.2) inset;
    border: 1px solid rgba(196, 30, 58, 0.25);
    position: relative;
    overflow: hidden;
    min-height: calc(50vh - 120px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: containerFadeIn 0.6s ease-out;
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
                rgba(255, 245, 245, 0.3) 0%, 
                rgba(255, 230, 230, 0.3) 100%);
    z-index: -1;
}

/* 错误提示 */
.error-alert {
    background: linear-gradient(135deg, rgba(255, 245, 245, 0.97) 0%, rgba(255, 230, 230, 0.97) 100%);
    border: 1px solid rgba(196, 30, 58, 0.3);
    color: #5A1A1A;
    padding: 18px 24px;
    border-radius: var(--border-radius-md);
    font-size: 15px;
    margin-bottom: 36px;
    text-align: center;
    font-weight: 500;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(12px);
    animation: slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.error-alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #C41E3A 0%, #D7000F 100%);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 输入框样式 */
.input-wrapper {
    margin-bottom: 56px;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: inputWrapperFadeIn 0.6s ease-out backwards;
}

.input-wrapper:first-of-type {
    animation-delay: 0.1s;
}

.input-wrapper:last-of-type {
    animation-delay: 0.2s;
}

@keyframes inputWrapperFadeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.input-item {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s var(--transition-smooth);
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.8);
}

.input-item:focus-within {
    border-color: rgba(196, 30, 58, 0.7);
    box-shadow: var(--shadow-glow);
    background: rgba(255, 255, 255, 0.95);
}

.input-icon {
    font-size: 24px;
    color: var(--icon-color);
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    transition: all 0.4s var(--transition-smooth);
    position: relative;
}

.input-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 230, 230, 0.1);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s ease;
}

.input-item:focus-within .input-icon {
    color: rgba(196, 30, 58, 0.95);
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 2px 8px rgba(196, 30, 58, 0.2));
}

.input-item:focus-within .input-icon::before {
    opacity: 1;
    transform: scale(1);
}

.input-item input {
    flex: 1;
    height: 56px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-primary);
    outline: none;
    transition: color 0.3s ease;
    padding: 0;
    font-weight: 400;
    letter-spacing: 0.5px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

.input-item input:focus {
    color: rgba(31, 41, 55, 0.98);
}

.input-item input::placeholder {
    color: rgba(107, 114, 128, 0.7);
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* 密码输入框特殊样式 */
.password-item {
    padding: 0 20px;
}

.password-item:focus-within {
    border-bottom-color: rgba(196, 30, 58, 0.6);
}

.toggle-password {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(196, 30, 58, 0.08);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(196, 30, 58, 0.7);
    margin-left: 12px;
    padding: 0;
    transition: all 0.4s var(--transition-smooth);
    -webkit-tap-highlight-color: transparent;
    border-radius: 50%;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(196, 30, 58, 0.2);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.toggle-password::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 30, 58, 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s ease;
}

.toggle-password:hover {
    background: rgba(196, 30, 58, 0.25);
    color: rgba(255, 255, 255, 0.95);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), var(--shadow-glow);
}

.toggle-password:hover::before {
    opacity: 1;
    transform: scale(1.2);
}

.toggle-password:active {
    transform: scale(0.98);
    background: rgba(196, 30, 58, 0.18);
    box-shadow: var(--shadow-light);
}

/* 登录按钮 */
.login-btn {
    width: 100%;
    height: 56px;
    background: var(--primary-gradient);
    color: var(--text-white);
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    margin-top: 32px;
    cursor: pointer;
    transition: all 0.5s var(--transition-smooth);
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--shadow-medium);
    letter-spacing: 1.5px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 30, 58, 0.25);
    animation: buttonFadeIn 0.8s ease-out 0.3s backwards;
}

@keyframes buttonFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
                transparent, 
                rgba(196, 30, 58, 0.25), 
                transparent);
    transition: left 0.8s ease;
}

.login-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 30, 58, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.login-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-6px) scale(1.03);
    box-shadow: var(--shadow-heavy),
                var(--shadow-glow);
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover::after {
    width: 300px;
    height: 300px;
}

.login-btn:active {
    background: linear-gradient(135deg, #A61E3A 0%, #C41E3A 100%);
    transform: translateY(-2px) scale(1);
    box-shadow: var(--shadow-light);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #E0A0A0 0%, #F0B0B0 100%);
}

/* 链接区域 */
.form-links {
    margin-top: 44px;
    text-align: center;
    position: relative;
    animation: linksFadeIn 1s ease-out 0.5s backwards;
}

@keyframes linksFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.register-link {
    color: var(--primary-red);
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.4s var(--transition-smooth);
    padding: 0 40px;
    height: 56px;
    line-height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg,
                rgba(255, 230, 230, 0.5) 0%,
                rgba(255, 200, 200, 0.3) 100%);
    display: inline-block;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 30, 58, 0.3);
    letter-spacing: 1.5px;
    position: relative;
    overflow: hidden;
}

.register-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
                rgba(255, 230, 230, 0.25) 0%, 
                rgba(255, 200, 200, 0.08) 100%);
    opacity: 0;
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

.register-link:hover {
    background: linear-gradient(135deg, 
                rgba(255, 230, 230, 0.28) 0%, 
                rgba(255, 200, 200, 0.15) 100%);
    transform: translateY(-4px);
    box-shadow: var(--shadow-light),
                var(--shadow-glow);
}

.register-link:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.register-link:active {
    transform: translateY(-1px);
    background: linear-gradient(135deg, 
                rgba(255, 230, 230, 0.12) 0%, 
                rgba(255, 200, 200, 0.06) 100%);
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(196, 30, 58, 0.9);
    color: white;
    padding: 20px 44px;
    border-radius: var(--border-radius-md);
    font-size: 18px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s var(--transition-smooth);
    z-index: 1000;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-heavy);
    letter-spacing: 0.5px;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: toastPulse 0.5s ease-out;
}

@keyframes toastPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .logo-container {
        padding: 50px 24px 40px;
    }

    .logo-circle {
        width: 82px;
        height: 82px;
        font-size: 40px;
        border-radius: 18px;
        margin-bottom: 20px;
    }

    .logo-title {
        font-size: 22px;
        letter-spacing: 1.5px;
    }

    .login-container {
        max-width: calc(100% - 32px);
        padding: 42px 28px;
        margin: 0 16px;
        border-radius: 26px;
        min-height: calc(50vh - 100px);
    }

    .input-wrapper {
        margin-bottom: 52px;
    }

    .input-item {
        padding: 0 16px;
    }

    .input-item input {
        height: 52px;
        font-size: 17px;
        padding: 0;
        letter-spacing: 0.5px;
    }

    .input-item input::placeholder {
        font-size: 18px;
    }

    .input-icon {
        font-size: 22px;
        margin-right: 10px;
        width: 26px;
    }

    .login-btn {
        height: 52px;
        font-size: 17px;
        border-radius: 14px;
        margin-top: 28px;
        letter-spacing: 1.4px;
    }

    .register-link {
        height: 52px;
        line-height: 52px;
        font-size: 17px;
        border-radius: 14px;
        letter-spacing: 1.4px;
    }

    .toggle-password {
        width: 38px;
        height: 38px;
        font-size: 22px;
        margin-left: 10px;
    }
}

@media (max-width: 360px) {
    .logo-container {
        padding: 40px 20px 32px;
    }

    .logo-circle {
        width: 76px;
        height: 76px;
        font-size: 38px;
        border-radius: 17px;
        margin-bottom: 18px;
    }

    .logo-title {
        font-size: 20px;
        letter-spacing: 1.2px;
    }

    .login-container {
        max-width: calc(100% - 24px);
        padding: 38px 24px;
        margin: 0 12px;
        border-radius: 24px;
        min-height: calc(50vh - 85px);
    }

    .input-wrapper {
        margin-bottom: 48px;
    }

    .input-item {
        padding: 0 14px;
    }

    .input-item input {
        height: 48px;
        font-size: 16px;
        padding: 0;
        letter-spacing: 0.5px;
    }

    .input-item input::placeholder {
        font-size: 16px;
    }

    .input-icon {
        font-size: 20px;
        margin-right: 8px;
        width: 24px;
    }

    .login-btn {
        height: 48px;
        font-size: 16px;
        border-radius: 12px;
        margin-top: 24px;
        letter-spacing: 1.2px;
    }

    .register-link {
        height: 48px;
        line-height: 48px;
        font-size: 16px;
        border-radius: 12px;
        letter-spacing: 1.2px;
    }

    .toggle-password {
        width: 36px;
        height: 36px;
        font-size: 20px;
        margin-left: 8px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .logo-container {
        padding: 28px 20px 20px;
        flex-direction: row;
        gap: 18px;
    }

    .logo-circle {
        width: 60px;
        height: 60px;
        font-size: 30px;
        border-radius: 15px;
        margin-bottom: 0;
    }

    .logo-title {
        font-size: 18px;
        letter-spacing: 0.8px;
    }

    .login-container {
        padding: 32px 28px;
        border-radius: 22px;
        margin: 0 20px;
        min-height: calc(50vh - 75px);
    }

    .input-wrapper {
        margin-bottom: 24px;
    }

    .input-item {
        padding: 0 14px;
    }

    .input-item input {
        height: 48px;
        font-size: 16px;
        padding: 0;
        letter-spacing: 0.5px;
    }

    .input-item input::placeholder {
        font-size: 16px;
    }

    .input-icon {
        font-size: 20px;
        margin-right: 8px;
        width: 24px;
    }

    .login-btn {
        height: 48px;
        font-size: 16px;
        margin-top: 24px;
        border-radius: 12px;
        letter-spacing: 1.4px;
    }

    .register-link {
        height: 48px;
        line-height: 48px;
        font-size: 16px;
        border-radius: 12px;
        letter-spacing: 1.4px;
    }

    .toggle-password {
        width: 36px;
        height: 36px;
        font-size: 20px;
        margin-left: 8px;
    }
}

/* 动画优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 大屏幕优化 */
@media (min-width: 768px) {
    .logo-container {
        padding: 70px 40px 50px;
    }

    .logo-circle {
        width: 100px;
        height: 100px;
        font-size: 48px;
        border-radius: 22px;
        margin-bottom: 28px;
    }

    .logo-title {
        font-size: 26px;
        letter-spacing: 2.5px;
    }

    .login-container {
        padding: 52px 48px;
        border-radius: 32px;
        min-height: calc(50vh - 140px);
    }

    .input-item input {
        height: 64px;
        font-size: 20px;
        letter-spacing: 0.6px;
    }

    .input-icon {
        font-size: 28px;
        margin-right: 14px;
        width: 32px;
    }

    .login-btn {
        height: 64px;
        font-size: 20px;
        border-radius: 16px;
        letter-spacing: 1.8px;
    }

    .register-link {
        height: 64px;
        line-height: 64px;
        font-size: 20px;
        border-radius: 16px;
        letter-spacing: 1.8px;
    }

    .toggle-password {
        width: 44px;
        height: 44px;
        font-size: 28px;
        margin-left: 14px;
    }
}

/* 超大屏幕优化 */
@media (min-width: 1024px) {
    .logo-container {
        padding: 100px 40px 70px;
    }

    .logo-circle {
        width: 110px;
        height: 110px;
        font-size: 54px;
        border-radius: 24px;
        margin-bottom: 32px;
    }

    .logo-title {
        font-size: 30px;
        letter-spacing: 3px;
    }

    .login-container {
        max-width: 560px;
        padding: 64px 56px;
        border-radius: 36px;
        min-height: calc(50vh - 160px);
    }

    .input-item input {
        height: 68px;
        font-size: 22px;
        letter-spacing: 0.7px;
    }

    .input-icon {
        font-size: 30px;
        margin-right: 16px;
        width: 34px;
    }

    .login-btn {
        height: 68px;
        font-size: 22px;
        border-radius: 18px;
        letter-spacing: 2px;
    }

    .register-link {
        height: 68px;
        line-height: 68px;
        font-size: 22px;
        border-radius: 18px;
        letter-spacing: 2px;
    }

    .toggle-password {
        width: 48px;
        height: 48px;
        font-size: 30px;
        margin-left: 16px;
    }
}
