/**
 * GoPixelArt - 认证页面 Glassmorphism 样式
 * iOS Glassmorphism Pro Max 设计规范 v2.0
 */

/* ==================== CSS 变量 ==================== */
:root {
    /* 亮色模式 */
    --auth-bg-gradient: linear-gradient(180deg, #F2F2F7 0%, #E5E5EA 100%);
    --auth-glass-bg: rgba(255, 255, 255, 0.7);
    --auth-glass-border: rgba(255, 255, 255, 0.5);
    --auth-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --auth-primary: #007AFF;
    --auth-primary-gradient: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    --auth-success: #34C759;
    --auth-warning: #FF9500;
    --auth-danger: #FF3B30;
    --auth-text-primary: #1C1C1E;
    --auth-text-secondary: #3C3C43;
    --auth-text-muted: #8E8E93;
    --auth-input-bg: rgba(255, 255, 255, 0.5);
    --auth-input-border: rgba(0, 0, 0, 0.08);
    --auth-input-focus-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);

    /* 动效缓动函数 */
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

[data-theme="dark"] {
    --auth-bg-gradient: linear-gradient(180deg, #000000 0%, #1C1C1E 100%);
    --auth-glass-bg: rgba(44, 44, 46, 0.8);
    --auth-glass-border: rgba(255, 255, 255, 0.1);
    --auth-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --auth-text-primary: #FFFFFF;
    --auth-text-secondary: #EBEBF5;
    --auth-text-muted: #8E8E93;
    --auth-input-bg: rgba(44, 44, 46, 0.6);
    --auth-input-border: rgba(255, 255, 255, 0.1);
}

/* ==================== 基础布局 ==================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg-gradient);
    padding: 20px;
    position: relative;
    overflow-x: hidden; /* 防止水平溢出，但允许垂直滚动 */
    overflow-y: auto;
}

/* 彩色光晕装饰 */
.auth-page::before,
.auth-page::after {
    content: '';
    position: fixed;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.auth-page::before {
    top: -20%;
    right: -10%;
    background: rgba(0, 122, 255, 0.3);
}

.auth-page::after {
    bottom: -20%;
    left: -10%;
    background: rgba(88, 86, 214, 0.25);
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ==================== 玻璃卡片 ==================== */
.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: var(--auth-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--auth-glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--auth-glass-shadow);
    animation: fadeInUp 0.5s var(--ease-out) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 渐变边框光效 */
.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(255,255,255,0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

/* ==================== 头部 ==================== */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: var(--auth-primary-gradient);
    border-radius: 16px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3); }
    50% { box-shadow: 0 8px 32px rgba(0, 122, 255, 0.5); }
}

.auth-logo svg,
.auth-logo img {
    width: 32px;
    height: 32px;
    color: white;
}

.auth-title {
    color: var(--auth-text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--auth-text-muted);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.5;
}

/* ==================== 表单元素 ==================== */
.auth-form-group {
    margin-bottom: 20px;
}

.auth-label {
    display: block;
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--auth-input-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--auth-input-border);
    border-radius: 12px;
    color: var(--auth-text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s var(--ease-out);
    box-sizing: border-box;
}

.auth-input::placeholder {
    color: var(--auth-text-muted);
}

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: var(--auth-input-focus-shadow);
    background: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .auth-input:focus {
    background: rgba(44, 44, 46, 0.8);
}

.auth-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 输入框行 (用于验证码等) */
.auth-input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.auth-input-row .auth-input {
    flex: 1;
    min-width: 0;
}

/* 验证码图片 */
.auth-captcha-img {
    height: 48px;
    min-width: 120px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid var(--auth-input-border);
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s var(--ease-out);
}

.auth-captcha-img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 辅助文本 */
.auth-hint {
    font-size: 0.8125rem;
    color: var(--auth-text-muted);
    margin-top: 8px;
}

/* ==================== 按钮 ==================== */
.auth-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.auth-btn:active {
    transform: scale(0.97);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 主按钮 */
.auth-btn-primary {
    background: var(--auth-primary-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
}

/* 次要按钮 */
.auth-btn-secondary {
    background: var(--auth-glass-bg);
    color: var(--auth-text-primary);
    border: 1px solid var(--auth-input-border);
}

.auth-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .auth-btn-secondary:hover:not(:disabled) {
    background: rgba(44, 44, 46, 0.9);
}

/* 发送验证码按钮 */
.auth-btn-code {
    min-width: 120px;
    padding: 14px 16px;
    background: var(--auth-glass-bg);
    color: var(--auth-primary);
    border: 1px solid var(--auth-primary);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.auth-btn-code:hover:not(:disabled) {
    background: rgba(0, 122, 255, 0.1);
}

.auth-btn-code:disabled {
    color: var(--auth-text-muted);
    border-color: var(--auth-input-border);
}

/* 水波纹效果 */
.auth-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.auth-btn:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: 0s;
}

/* ==================== 消息提示 ==================== */
.auth-message {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.3s var(--ease-out);
}

.auth-message-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.auth-message-text {
    flex: 1;
}

.auth-message-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
}

.auth-message-close:hover {
    opacity: 1;
}

.auth-message-success {
    background: rgba(52, 199, 89, 0.15);
    border: 1px solid rgba(52, 199, 89, 0.3);
    color: #1B7340;
}

[data-theme="dark"] .auth-message-success {
    color: #4ADE80;
}

.auth-message-error {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #991B1B;
}

[data-theme="dark"] .auth-message-error {
    color: #FCA5A5;
}

.auth-message-warning {
    background: rgba(255, 149, 0, 0.15);
    border: 1px solid rgba(255, 149, 0, 0.3);
    color: #92400E;
}

[data-theme="dark"] .auth-message-warning {
    color: #FCD34D;
}

.auth-message-info {
    background: rgba(0, 122, 255, 0.15);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #1E40AF;
}

[data-theme="dark"] .auth-message-info {
    color: #93C5FD;
}

/* ==================== 分隔线 ==================== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    color: var(--auth-text-muted);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--auth-input-border), transparent);
}

.auth-divider span {
    padding: 0 16px;
    white-space: nowrap;
}

/* ==================== OAuth 按钮 ==================== */
.auth-oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--auth-glass-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 12px;
    color: var(--auth-text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s var(--ease-out);
}

.auth-oauth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.auth-oauth-btn svg {
    width: 20px;
    height: 20px;
}

.auth-oauth-btn-github {
    background: #24292e;
    color: white;
    border-color: #24292e;
}

.auth-oauth-btn-github:hover {
    background: #1a1e22;
}

.auth-oauth-btn-google {
    background: white;
    border-color: #e2e8f0;
}

.auth-oauth-btn-linuxdo {
    background: linear-gradient(135deg, #4a90d9, #3a70b9);
    color: white;
    border-color: transparent;
}

/* ==================== 底部链接 ==================== */
.auth-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--auth-input-border);
}

.auth-footer-text {
    color: var(--auth-text-muted);
    font-size: 0.9375rem;
}

.auth-footer-link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
    transition: opacity 0.2s;
}

.auth-footer-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ==================== 两步验证特殊样式 ==================== */
.auth-totp-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.auth-totp-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.3em;
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
}

.auth-totp-hint {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--auth-input-border);
}

.auth-totp-hint p {
    color: var(--auth-text-muted);
    font-size: 0.8125rem;
    margin: 0;
    line-height: 1.6;
}

/* ==================== 主题切换按钮 ==================== */
.auth-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--auth-glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--auth-glass-border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s var(--ease-out);
    z-index: 100;
}

.auth-theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ==================== Toast 通知 ==================== */
.auth-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.auth-toast {
    background: var(--auth-glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--auth-glass-border);
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    animation: toastIn 0.3s var(--ease-spring);
    pointer-events: auto;
}

.auth-toast-icon {
    font-size: 1.25rem;
}

.auth-toast-text {
    flex: 1;
    color: var(--auth-text-primary);
    font-size: 0.9375rem;
}

.auth-toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    color: var(--auth-text-primary);
    padding: 0;
}

.auth-toast-close:hover {
    opacity: 1;
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==================== View Transitions API ==================== */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    z-index: 1;
    animation: circleReveal 0.7s var(--ease-in-out) forwards;
}

::view-transition-old(root) {
    z-index: 0;
}

@keyframes circleReveal {
    from { clip-path: circle(0% at var(--reveal-x, 100%) var(--reveal-y, 0%)); }
    to { clip-path: circle(150% at var(--reveal-x, 100%) var(--reveal-y, 0%)); }
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
    .auth-card {
        padding: 28px 24px;
        border-radius: 20px;
    }

    .auth-title {
        font-size: 1.25rem;
    }

    .auth-input {
        padding: 12px 14px;
    }

    .auth-btn {
        padding: 12px 20px;
    }

    .auth-theme-toggle {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
}

/* ==================== 无障碍 ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.auth-input:focus-visible,
.auth-btn:focus-visible,
.auth-oauth-btn:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}

/* 跳过链接 (无障碍) */
.auth-skip-link {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--auth-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    z-index: 100;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s, opacity 0.2s;
}

.auth-skip-link:focus {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
