/* 认证页面专用样式 - 响应式设计 */

/* ========== 全局变量 ========== */
:root {
    --auth-primary: #4e73df;
    --auth-primary-light: #5a82f7;
    --auth-primary-dark: #3d5ac7;
    --auth-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --auth-white: #ffffff;
    --auth-gray-50: #f9fafb;
    --auth-gray-100: #f3f4f6;
    --auth-gray-200: #e5e7eb;
    --auth-gray-300: #d1d5db;
    --auth-gray-400: #9ca3af;
    --auth-gray-500: #6b7280;
    --auth-gray-600: #4b5563;
    --auth-gray-700: #374151;
    --auth-gray-800: #1f2937;
    --auth-gray-900: #111827;
    --auth-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --auth-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --auth-radius: 0.75rem;
    --auth-radius-lg: 1rem;
    --auth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 基础样式重置 ========== */
* {
    box-sizing: border-box;
}

body.auth-page {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--auth-gradient);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== 认证容器 ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

/* 背景装饰 */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
}

/* ========== 认证卡片 ========== */
.auth-card {
    background: var(--auth-white);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.6s ease-out;
}

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

/* ========== 认证头部 ========== */
.auth-header {
    text-align: center;
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--auth-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--auth-white);
    font-size: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.auth-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--auth-gray-800);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.auth-header p {
    color: var(--auth-gray-500);
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ========== 表单样式 ========== */
.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--auth-gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
}

.form-group .text-danger {
    color: #ef4444;
    font-weight: 700;
}

/* 输入框容器 */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group-prepend {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    pointer-events: none;
}

.input-group-text {
    background: transparent;
    border: none;
    color: var(--auth-gray-400);
    font-size: 1rem;
    padding: 0;
}

.form-control {
    width: 100%;
    height: 52px;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--auth-gray-200);
    border-radius: var(--auth-radius);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--auth-gray-800);
    background: var(--auth-white);
    transition: var(--auth-transition);
    outline: none;
}

.form-control::placeholder {
    color: var(--auth-gray-400);
    font-weight: 400;
}

.form-control:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1);
    transform: translateY(-1px);
}

.form-control:focus + .input-group-prepend .input-group-text {
    color: var(--auth-primary);
}

/* 密码显示切换按钮 */
.input-group-append {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.toggle-password {
    background: none;
    border: none;
    color: var(--auth-gray-400);
    font-size: 1rem;
    padding: 0;
    cursor: pointer;
    transition: var(--auth-transition);
    outline: none;
}

.toggle-password:hover {
    color: var(--auth-primary);
    transform: scale(1.1);
}

/* 帮助文本 */
.form-text {
    font-size: 0.8rem;
    color: var(--auth-gray-500);
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* 复选框样式 */
.custom-control {
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 0;
    margin-bottom: 0;
}

.custom-control-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-control-label {
    position: relative;
    margin-bottom: 0;
    padding-left: 2rem;
    font-size: 0.875rem;
    color: var(--auth-gray-600);
    cursor: pointer;
    line-height: 1.5;
}

.custom-control-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid var(--auth-gray-300);
    border-radius: 4px;
    background: var(--auth-white);
    transition: var(--auth-transition);
}

.custom-control-input:checked + .custom-control-label::before {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.custom-control-input:checked + .custom-control-label::after {
    content: '✓';
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-white);
    font-size: 12px;
    font-weight: bold;
}

.custom-control-label a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--auth-transition);
}

.custom-control-label a:hover {
    text-decoration: underline;
    color: var(--auth-primary-dark);
}

/* ========== 按钮样式 ========== */
.btn-primary {
    width: 100%;
    height: 52px;
    background: var(--auth-gradient);
    border: none;
    border-radius: var(--auth-radius);
    color: var(--auth-white);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    cursor: pointer;
    transition: var(--auth-transition);
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover::before {
    left: 100%;
}

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

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.3);
}

.btn-primary i {
    margin-right: 0.5rem;
}

/* ========== 认证底部 ========== */
.auth-footer {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--auth-gray-200);
}

.auth-footer p {
    margin: 0;
    color: var(--auth-gray-600);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--auth-transition);
}

.auth-footer a:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

/* ========== 加载动画 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    background: var(--auth-white);
    padding: 2rem;
    border-radius: var(--auth-radius-lg);
    text-align: center;
    min-width: 200px;
    box-shadow: var(--auth-shadow-lg);
    animation: fadeIn 0.3s ease-out;
}

.loading-spinner .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-bottom: 1rem;
    color: var(--auth-primary);
}

.loading-spinner p {
    margin: 0;
    color: var(--auth-gray-600);
    font-weight: 500;
}

/* ========== 警告框样式 ========== */
.alert {
    border: none;
    border-radius: var(--auth-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

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

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
    border-left: 4px solid #22c55e;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.alert i {
    margin-right: 0.5rem;
}

.alert .close {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    transition: var(--auth-transition);
}

.alert .close:hover {
    opacity: 1;
}

/* ========== 响应式设计 ========== */

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .auth-card {
        max-width: 400px;
        padding: 2rem;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-logo {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }
}

/* 手机设备 (最大 768px) */
@media (max-width: 768px) {
    .auth-container {
        padding: 0.75rem;
    }
    
    .auth-card {
        max-width: 100%;
        padding: 1.5rem;
        border-radius: var(--auth-radius);
    }
    
    .auth-header {
        margin-bottom: 1.5rem;
    }
    
    .auth-header h1 {
        font-size: 1.375rem;
    }
    
    .auth-logo {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-control {
        height: 48px;
        font-size: 0.9rem;
    }
    
    .btn-primary {
        height: 48px;
        font-size: 0.95rem;
    }
    
    .auth-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
}

/* 小屏手机 (最大 480px) */
@media (max-width: 480px) {
    .auth-container {
        padding: 0.5rem;
    }
    
    .auth-card {
        padding: 1.25rem;
    }
    
    .auth-header h1 {
        font-size: 1.25rem;
    }
    
    .auth-logo {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .form-control {
        height: 44px;
        padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    }
    
    .btn-primary {
        height: 44px;
        font-size: 0.9rem;
    }
    
    .input-group-prepend {
        padding: 0 0.75rem;
    }
    
    .input-group-append {
        padding: 0 0.75rem;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-container {
        padding: 0.5rem;
    }
    
    .auth-card {
        padding: 1rem;
        max-width: 500px;
    }
    
    .auth-header {
        margin-bottom: 1rem;
    }
    
    .auth-logo {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .auth-header h1 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .auth-footer {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
}

/* ========== 动画效果 ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.pulse {
    animation: pulse 2s infinite;
}

/* ========== 辅助类 ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

/* ========== 深色模式支持 ========== */
@media (prefers-color-scheme: dark) {
    .auth-card {
        background: var(--auth-gray-800);
        border-color: var(--auth-gray-700);
    }
    
    .auth-header h1 {
        color: var(--auth-white);
    }
    
    .auth-header p {
        color: var(--auth-gray-300);
    }
    
    .form-group label {
        color: var(--auth-gray-200);
    }
    
    .form-control {
        background: var(--auth-gray-700);
        border-color: var(--auth-gray-600);
        color: var(--auth-white);
    }
    
    .form-control::placeholder {
        color: var(--auth-gray-400);
    }
    
    .custom-control-label {
        color: var(--auth-gray-300);
    }
    
    .auth-footer p {
        color: var(--auth-gray-300);
    }
    
    .loading-spinner {
        background: var(--auth-gray-800);
    }
    
    .loading-spinner p {
        color: var(--auth-gray-300);
    }
}
