/* ========================================
   FileMind 登录页样式 - 智能文档管理平台
   ======================================== */

/* CSS 变量定义 - FileMind 主题色彩 */
:root {
    --fm-primary: #0ea5e9;
    --fm-primary-hover: #0284c7;
    --fm-primary-light: #e0f2fe;
    --fm-secondary: #6366f1;
    --fm-accent: #10b981;
    --fm-gradient-start: #0ea5e9;
    --fm-gradient-mid: #6366f1;
    --fm-gradient-end: #8b5cf6;
    --fm-text-primary: #0f172a;
    --fm-text-secondary: #475569;
    --fm-text-muted: #94a3b8;
    --fm-text-light: #ffffff;
    --fm-bg-primary: #ffffff;
    --fm-bg-secondary: #f8fafc;
    --fm-bg-dark: #0f172a;
    --fm-border: #e2e8f0;
    --fm-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --fm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --fm-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --fm-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --fm-radius-sm: 8px;
    --fm-radius-md: 12px;
    --fm-radius-lg: 16px;
    --fm-radius-xl: 24px;
}

/* 整体布局 */
.filemind-login-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    height: 100vh;
    background: var(--fm-bg-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
}

.filemind-login-body.login-custom-background {
    background-image: var(--login-background-image);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.fm-login-wrapper {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* 左侧展示区域 */
.fm-login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    overflow: hidden;
}

.fm-login-form-container {
    width: 100%;
    max-width: 460px;
}

.fm-login-right-with-icon {
    flex-direction: column;
    gap: 1rem;
}

.login-box-icon {
    width: auto;
    height: auto;
    max-width: 460px;
    max-height: 96px;
    object-fit: contain;
    flex-shrink: 0;
}

.filemind-login-body.login-custom-background .fm-login-left {
    display: none;
}

.filemind-login-body.login-custom-background .fm-login-right {
    flex: 1 1 auto;
    background: transparent;
    justify-content: flex-end;
    padding-right: clamp(2rem, 10vw, 12rem);
}

.filemind-login-body.login-custom-background .fm-login-right-with-icon {
    display: grid;
    grid-template-columns: minmax(0, 460px);
    align-content: center;
    justify-content: flex-end;
}

.filemind-login-body.login-custom-background .fm-login-right-with-icon .login-box-icon {
    justify-self: center;
}

.login-card {
    width: 100%;
    max-width: 460px;
}

.login-card-body {
    padding: 1.75rem 2rem !important;
}

.login-card-body h4 {
    margin-bottom: 0.75rem;
}

.login-card-body > strong {
    display: block;
    margin-bottom: 1rem;
}

.login-card-body .login-method-panels {
    padding-top: 0.5rem;
}

.login-card-body .login-method-switch {
    margin-top: 1rem;
    padding-top: 0.75rem;
}

.login-card-body .mb-3 {
    margin-bottom: 0.75rem !important;
}

/* Logo 和品牌 */
.fm-login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.fm-logo-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.fm-logo-icon svg {
    width: 100%;
    height: 100%;
}

.fm-brand-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fm-text-primary);
    margin: 0;
    letter-spacing: -0.025em;
}

.fm-brand-text span {
    font-size: 0.8rem;
    color: var(--fm-text-muted);
    display: block;
    margin-top: 2px;
}

/* 登录标题 */
.fm-login-header {
    margin-bottom: 1rem;
}

.fm-login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--fm-text-primary);
    margin: 0 0 0.5rem 0;
}

.fm-login-header p {
    font-size: 0.95rem;
    color: var(--fm-text-secondary);
    margin: 0;
}

/* 租户切换 */
.fm-tenant-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, var(--fm-primary-light) 0%, #ede9fe 100%);
    border-radius: var(--fm-radius-md);
    margin-bottom: 1rem;
    border: 1px solid rgba(14, 165, 233, 0.15);
}

.fm-tenant-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--fm-bg-primary);
    border-radius: var(--fm-radius-sm);
    color: var(--fm-primary);
    flex-shrink: 0;
    box-shadow: var(--fm-shadow-sm);
}

.fm-tenant-info {
    flex: 1;
    min-width: 0;
}

.fm-tenant-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fm-text-muted);
    margin-bottom: 2px;
}

.fm-tenant-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fm-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fm-tenant-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--fm-primary);
    background: var(--fm-bg-primary);
    border: 1px solid var(--fm-primary);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fm-tenant-switch-btn:hover {
    background: var(--fm-primary);
    color: var(--fm-text-light);
}

/* 登录表单主体 */
.fm-login-form-body {
    margin-bottom: 1rem;
}

/* 覆盖 ABP 默认表单样式 */
.fm-login-form-body .form-group {
    margin-bottom: 1.25rem;
}

/* 禁用浮动标签效果 */
.fm-login-form-body .form-floating > label {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    padding: 0 !important;
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 500;
    color: var(--fm-text-primary);
    font-size: 0.875rem;
    height: auto;
    border: none;
    background: transparent;
}

.fm-login-form-body .form-floating > .form-control {
    padding: 0.75rem 1rem !important;
    height: auto !important;
    border-radius: var(--fm-radius-sm);
    border: 1.5px solid var(--fm-border);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.fm-login-form-body .form-floating > .form-control:focus {
    border-color: var(--fm-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.fm-login-form-body .form-floating > .form-control::placeholder {
    opacity: 1 !important;
    color: var(--fm-text-muted) !important;
}

.fm-login-form-body .form-floating > .form-control:focus ~ label,
.fm-login-form-body .form-floating > .form-control:not(:placeholder-shown) ~ label {
    transform: none !important;
    opacity: 1 !important;
}

.fm-login-form-body .form-label {
    font-weight: 500;
    color: var(--fm-text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.fm-login-form-body .form-control {
    border-radius: var(--fm-radius-sm);
    border: 1.5px solid var(--fm-border);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.fm-login-form-body .form-control:focus {
    border-color: var(--fm-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* 记住我复选框 */
.fm-login-form-body .form-check {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    min-width: max-content;
}

.fm-login-form-body .form-check-input {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--fm-border);
    flex-shrink: 0;
}

.fm-login-form-body .form-check-input:checked {
    background-color: var(--fm-primary);
    border-color: var(--fm-primary);
}

.fm-login-form-body .form-check-label {
    font-size: 0.875rem;
    color: var(--fm-text-secondary);
    white-space: nowrap;
}

/* 登录按钮 */
.fm-login-form-body .btn-primary,
.fm-login-form-body button[type="submit"]:not(.sms-send-code-button) {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--fm-primary) 0%, var(--fm-secondary) 100%);
    border: none;
    border-radius: var(--fm-radius-sm);
    color: var(--fm-text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.3);
}

.fm-login-form-body .btn-primary:hover,
.fm-login-form-body button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(14, 165, 233, 0.4);
}

.fm-login-form-body .btn-primary:active,
.fm-login-form-body button[type="submit"]:active {
    transform: translateY(0);
}

/* 链接样式 */
.fm-login-form-body a {
    color: var(--fm-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.fm-login-form-body a:hover {
    color: var(--fm-primary-hover);
    text-decoration: underline;
}

/* 底部信息 */
.fm-login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fm-border);
}

.fm-copyright {
    font-size: 0.8rem;
    color: var(--fm-text-muted);
    margin: 0 0 0.5rem 0;
}

.fm-icp-info,
.fm-police-info {
    font-size: 0.75rem;
    color: var(--fm-text-muted);
    margin: 0.25rem 0;
}

.fm-icp-info a,
.fm-police-info a {
    color: var(--fm-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.fm-icp-info a:hover,
.fm-police-info a:hover {
    color: var(--fm-primary);
}

.fm-police-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.fm-police-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

/* 右侧登录表单区域 */
.fm-login-right {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--fm-bg-primary);
    position: relative;
    z-index: 10;
}

.fm-showcase {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.fm-showcase-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

/* 功能卡片 */
.fm-feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.fm-feature-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: var(--fm-radius-lg);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.fm-feature-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.fm-card-primary .fm-card-icon {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
}

.fm-card-secondary .fm-card-icon {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.fm-card-accent .fm-card-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.fm-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--fm-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--fm-text-light);
}

.fm-feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fm-text-light);
    margin: 0 0 0.5rem 0;
}

.fm-feature-card p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
}

/* 展示文案 */
.fm-showcase-text {
    text-align: center;
}

.fm-showcase-text h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--fm-text-light);
    margin: 0 0 1rem 0;
    letter-spacing: -0.025em;
}

.fm-showcase-text p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
    margin: 0;
    max-width: 480px;
    margin: 0 auto;
}

/* 背景装饰 */
.fm-bg-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.fm-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.fm-blob-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    top: -150px;
    right: -100px;
    animation: fm-float 20s ease-in-out infinite;
}

.fm-blob-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    bottom: -100px;
    left: -50px;
    animation: fm-float 25s ease-in-out infinite reverse;
}

.fm-blob-3 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #10b981, #34d399);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: fm-pulse 15s ease-in-out infinite;
}

.fm-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

@keyframes fm-float {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(30px, 30px);
    }
}

@keyframes fm-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.3;
    }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .fm-feature-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .fm-feature-card {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    .fm-card-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .fm-feature-card h3 {
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 1024px) {
    .fm-login-right {
        flex: 0 0 420px;
    }
    
    .fm-showcase-text h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .fm-login-wrapper {
        flex-direction: column;
    }
    
    .fm-login-left {
        display: none;
    }
    
    .fm-login-right {
        flex: none;
        width: 100%;
        padding: 2rem 1.5rem;
    }

    .filemind-login-body.login-custom-background .fm-login-right {
        justify-content: center;
        padding-right: 1.5rem;
    }

    .filemind-login-body.login-custom-background .fm-login-right-with-icon {
        justify-content: center;
    }
    
    .fm-login-form-container {
        max-width: 100%;
    }
    
    .fm-login-brand {
        justify-content: center;
    }
    
    .fm-login-header {
        text-align: center;
    }
}

/* 警告消息样式覆盖 */
.fm-login-form-body .alert {
    border-radius: var(--fm-radius-sm);
    border: none;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
}

.fm-login-form-body .alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
}

.fm-login-form-body .alert-warning {
    background-color: #fffbeb;
    color: #92400e;
}

.fm-login-form-body .alert-info {
    background-color: var(--fm-primary-light);
    color: var(--fm-primary-hover);
}

/* 验证错误样式 */
.fm-login-form-body .field-validation-error {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

.fm-login-form-body .input-validation-error {
    border-color: #dc2626 !important;
}

.fm-login-form-body .input-validation-error:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.sms-send-code-group {
    flex-wrap: nowrap;
}

.sms-send-code-group .form-control {
    min-width: 0;
}

.sms-send-code-button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    margin-top: 0 !important;
    min-width: 3rem;
    white-space: nowrap;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.sms-send-code-button i {
    font-size: 0.95rem;
}

.login-method-panels {
    min-height: 0;
}

.login-method-switch {
    margin-top: 1rem;
}

.login-method-switch .small {
    color: var(--fm-text-muted) !important;
    letter-spacing: 0.02em;
}

.login-method-switch-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.login-method-link {
    position: relative;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fm-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-method-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.2s ease;
}

.login-method-link:hover,
.login-method-link:focus {
    color: var(--fm-primary);
}

.login-method-link.active {
    color: var(--fm-primary);
}

.login-method-link.active::after {
    background: linear-gradient(135deg, var(--fm-primary) 0%, var(--fm-secondary) 100%);
}

.wechat-scan-panel {
    display: flex;
    flex-direction: column;
}

.wechat-scan-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wechat-scan-qr-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 206px;
    width: 100%;
}

#WeChatScanQrCode {
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

#WeChatScanQrCode.wechat-scan-qrcode-static {
    width: 206px;
    min-height: 206px;
    padding: 12px;
}

#WeChatScanQrCode.wechat-scan-qrcode-official {
    width: min(100%, 320px);
    min-height: 436px;
    padding: 14px;
}

#WeChatScanQrCode .wechat-scan-official-frame {
    width: 292px;
    height: 408px;
    display: block;
    border: 0;
    border-radius: 12px;
    background: #fff;
}

.wechat-scan-callback-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.wechat-scan-callback-state.is-error {
    background: rgba(254, 242, 242, 0.96);
}

.wechat-scan-callback-state__icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
    font-size: 24px;
    font-weight: 700;
}

.wechat-scan-callback-state.is-error .wechat-scan-callback-state__icon {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

.wechat-scan-callback-state__title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.wechat-scan-callback-state__message {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #475569;
}

.wechat-scan-expiry-text {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.wechat-scan-expiry-text.is-error {
    color: #dc2626 !important;
}

.wechat-scan-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.wechat-scan-action-btn {
    min-width: 136px;
}
