/* Bloom IdentityServer 认证页面样式 */

:root {
    --primary-color: #000000;
    --primary-hover: #1f2937;
    --secondary-color: #374151;
    --success-color: #111827;
    --danger-color: #1f2937;
    --warning-color: #4b5563;
    --dark-color: #000000;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
}

/* 认证容器 */
.auth-container {
    width: 100%;
    max-width: 480px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 认证卡片 */
.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px 32px; /* 减少内边距 */
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    max-height: 95vh; /* 限制最大高度 */
    overflow-y: auto; /* 如果内容过多则滚动 */
    /* 隐藏滚动条但保持滚动功能 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 和 Edge */
}

/* 隐藏 Webkit 浏览器的滚动条 (Chrome, Safari, Edge) */
.auth-card::-webkit-scrollbar {
    display: none;
}

/* 认证头部 */
.auth-header {
    text-align: center;
    margin-bottom: 32px; /* 减少间距 */
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease-out 0.2s both;
}

.auth-logo svg,
.auth-logo img {
    width: 100%;
    height: 100%;
    display: block;
}

.auth-logo-secure {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-title {
    font-size: 26px; /* 稍微减小 */
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    animation: fadeIn 0.6s ease-out 0.4s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 表单样式 */
.auth-form {
    animation: fadeIn 0.6s ease-out 0.5s both;
}

.form-group {
    margin-bottom: 20px; /* 减少间距 */
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label svg {
    color: var(--primary-color);
}

/* 左侧图标输入框 */
.input-with-left-icon {
    position: relative;
    width: 100%;
}

.input-icon-left {
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    pointer-events: none;
    z-index: 1;
}

.form-control-with-icon {
    padding-left: 48px !important;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    transition: var(--transition);
    background: var(--light-color);
    min-height: 48px; /* 确保输入框有固定高度 */
    line-height: 1.5;
}

.form-control:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control-code {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
}

.form-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.form-check-label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-hover) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

/* 社交登录按钮 */
.social-buttons {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.6s ease-out 0.7s both;
}

.social-buttons form {
    flex: 1;
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.btn-social:hover {
    border-color: var(--primary-color);
    background: var(--light-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-google:hover {
    border-color: var(--primary-color);
    background: #f9fafb;
}

.btn-microsoft:hover {
    border-color: var(--primary-color);
    background: #f9fafb;
}

/* 分隔线 */
.auth-divider {
    position: relative;
    text-align: center;
    margin: 24px 0; /* 减少间距 */
    animation: fadeIn 0.6s ease-out 0.6s both;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    position: relative;
    display: inline-block;
    padding: 0 16px;
    background: white;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 认证页脚 */
.auth-footer {
    text-align: center;
    margin-top: 24px; /* 减少间距 */
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    animation: fadeIn 0.6s ease-out 0.8s both;
}

.auth-footer p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 8px 0;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.auth-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* 验证消息 */
.text-danger {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #dc2626; /* 红色 */
}

/* 错误提示摘要 - 显示在提交按钮上方 */
.error-summary {
    display: none; /* 默认隐藏 */
    margin: 10px 0 14px 0;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #dc2626; /* 红色 */
    background-color: #fef2f2; /* 浅红色背景 */
    border: 1px solid #fecaca; /* 红色边框 */
    border-radius: 4px;
    text-align: center;
}

.error-summary:not(:empty) {
    display: block; /* 有内容时显示 */
}

.error-summary ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.error-summary li {
    margin: 3px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.error-summary li::before {
    content: "⚠";
    font-size: 14px;
}

/* 保留 alert 样式用于其他页面 */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none; /* 默认隐藏 */
}

.alert:not(:empty) {
    display: block; /* 有内容时显示 */
}

.alert-danger {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.alert-danger ul {
    margin: 0;
    padding-left: 20px;
}

.alert-danger li {
    margin: 4px 0;
}

.alert-success {
    background: #f9fafb;
    color: #111827;
    border: 1px solid #e5e7eb;
}

/* 响应式设计 */
@media (max-width: 576px) {
    .auth-card {
        padding: 32px 24px;
    }

    .auth-title {
        font-size: 24px;
    }

    .social-buttons {
        flex-direction: column;
    }

    .social-buttons form {
        flex-direction: column;
    }

    .btn-social {
        width: 100%;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 验证码输入框样式优化 */
.code-input-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.code-input-single {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
    background: var(--light-color);
}

.code-input-single:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

/* 密码强度指示器 */
.password-strength {
    margin-top: 8px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    transition: var(--transition);
}

.password-strength-bar {
    height: 100%;
    transition: var(--transition);
    border-radius: 2px;
}

.password-strength-weak {
    width: 33%;
    background: #6b7280;
}

.password-strength-medium {
    width: 66%;
    background: #4b5563;
}

.password-strength-strong {
    width: 100%;
    background: #000000;
}

.password-strength-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 输入框图标 */
.input-with-icon {
    position: relative;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.input-with-icon .form-control {
    width: 100%;
    padding-right: 48px; /* 为右侧图标留出空间 */
}

.input-icon-right {
    position: absolute;
    right: 16px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    height: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    padding: 2px;
}

.input-icon-right:hover {
    color: var(--primary-color);
}

/* 按钮加载状态 */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 成功提示 */
.success-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 24px;
    animation: slideInDown 0.5s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 信息卡片 */
.info-card {
    padding: 16px;
    background: var(--light-color);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 24px;
}

.info-card p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.info-card strong {
    color: var(--text-primary);
}

/* 返回按钮 */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.btn-back:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--light-color);
}

/* Tooltip */
.tooltip-trigger {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--dark-color);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    transition: var(--transition);
    pointer-events: none;
}

.tooltip-trigger:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark-color) transparent transparent transparent;
}

/* 进度条 */
.progress-bar {
    height: 3px;
    background: var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    background: var(--primary-color);
    color: white;
}

.badge-success {
    background: #374151;
}

.badge-warning {
    background: #4b5563;
}

.badge-danger {
    background: #111827;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .auth-container {
        box-shadow: none;
    }
    
    .social-buttons,
    .auth-footer {
        display: none;
    }
}

