/**
 * Typecho 全新登录页面设计
 * 单卡片居中布局 - 黑灰简约风格
 */

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.body-100 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    position: relative;
}

/* ========== 背景装饰 ========== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* 背景网格 */
.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* 背景圆形装饰 */
.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: float 20s ease-in-out infinite;
}

.bg-circle-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 40%, #94a3b8) 0%, color-mix(in srgb, var(--primary-color) 30%, #64748b) 100%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.bg-circle-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 30%, #94a3b8) 0%, color-mix(in srgb, var(--primary-color) 20%, #64748b) 100%);
    bottom: -50px;
    right: -50px;
    animation-delay: -7s;
}

.bg-circle-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 20%, #cbd5e1) 0%, color-mix(in srgb, var(--primary-color) 15%, #94a3b8) 100%);
    top: 50%;
    right: 10%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* ========== 主容器 ========== */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========== 顶部 Logo 区域 ========== */
.login-header {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-color) 0%, color-mix(in srgb, var(--primary-color) 80%, black) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow:
        0 12px 32px color-mix(in srgb, var(--primary-color) 25%, transparent),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* SVG 保持固定大小 */
.logo-icon svg {
    width: 40px;
    height: 40px;
}

/* 图片使用原始大小，移除容器背景装饰 */
.logo-icon:has(img) {
    width: auto;
    height: auto;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.logo-icon img {
    width: auto;
    height: auto;
    max-width: 120px !important;
    max-height: 120px !important;
    display: block;
}

.logo-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

/* ========== 登录卡片 ========== */
.login-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.card-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.card-desc {
    font-size: 14px;
    color: #64748b;
}

/* ========== 表单样式 ========== */
.login-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.form-group.focused .form-label {
    color: var(--primary-color);
}

.label-icon {
    display: flex;
    align-items: center;
    color: #94a3b8;
    transition: color 0.3s ease;
}

.form-group.focused .label-icon {
    color: var(--primary-color);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--primary-color);
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.form-input::placeholder {
    color: #94a3b8;
}

/* ========== 记住我选项 ========== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.checkbox-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, color-mix(in srgb, var(--primary-color) 80%, black) 100%);
    border-radius: 3px;
    transition: transform 0.2s ease;
}

.checkbox:checked + .checkbox-custom {
    border-color: var(--primary-color);
    background: #ffffff;
}

.checkbox:checked + .checkbox-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.checkbox-text {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* ========== 登录按钮 ========== */
.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, color-mix(in srgb, var(--primary-color) 80%, black) 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 14px color-mix(in srgb, var(--primary-color) 30%, transparent),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 80%, black) 0%, color-mix(in srgb, var(--primary-color) 60%, black) 100%);
    box-shadow:
        0 6px 20px color-mix(in srgb, var(--primary-color) 40%, transparent),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-text {
    flex: 1;
    text-align: center;
}

.btn-icon {
    transition: transform 0.3s ease;
}

.submit-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* ========== 卡片底部 ========== */
.card-footer {
    margin-top: 24px;
}

.footer-divider {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.footer-divider::before,
.footer-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.footer-divider span {
    padding: 0 12px;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

.footer-links {
    display: flex;
    gap: 12px;
}

.footer-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    background: #f1f5f9;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.footer-link:hover {
    background: #e2e8f0;
    color: var(--primary-color);
    transform: translateY(-1px);
}

/* ========== 底部信息 ========== */
.login-footer {
    margin-top: 32px;
    text-align: center;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.login-footer p {
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

/* ========== 响应式设计 ========== */
@media (max-width: 480px) {
    body.body-100 {
        display: block;
        padding: 16px;
        align-items: flex-start;
    }

    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .logo-icon {
        width: 64px;
        height: 64px;
    }

    .logo-icon svg {
        width: 36px;
        height: 36px;
    }

    .logo-title {
        font-size: 24px;
    }

    .logo-subtitle {
        font-size: 13px;
    }

    .card-title {
        font-size: 20px;
    }

    .footer-links {
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    body.body-100 {
        padding: 12px;
    }

    .login-card {
        padding: 24px 20px;
    }

    .form-input,
    .submit-btn {
        padding: 12px 16px;
    }
}

/* ========== 消息提示 ========== */
.gate-message {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 9999;
    min-width: 280px;
    max-width: 400px;
    padding: 14px 18px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.gate-message.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.gate-message.success {
    background: #f0fdf4;
    border-color: #86efac;
}

.gate-message.success .message-icon {
    color: #22c55e;
}

.gate-message.error {
    background: #fef2f2;
    border-color: #fca5a5;
}

.gate-message.error .message-icon {
    color: #ef4444;
}

.gate-message.notice {
    background: #fffbeb;
    border-color: #fcd34d;
}

.gate-message.notice .message-icon {
    color: #f59e0b;
}

.message-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.message-content {
    flex: 1;
    font-size: 14px;
    font-weight: 400;
    color: #334155;
    line-height: 1.5;
}

.message-close {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 2px;
}

.message-close:hover {
    color: #64748b;
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 480px) {
    .gate-message {
        min-width: auto;
        width: calc(100vw - 32px);
        top: 16px;
        max-width: none;
    }
}
