/* ==================== 登录页面安全样式 ==================== */
/* 1. 防止样式劫持 */
/* 2. 增强CSS选择器 */
/* 3. 添加反调试样式 */
/* 4. 混淆关键样式 */
/* ======================================================= */

/* 根元素保护 */
:root {
    /* 主色调 - 使用复杂变量名 */
    --s-p-blue-1: #3498db;
    --s-p-blue-2: #2980b9;
    --s-p-green-1: #27ae60;
    --s-p-orange-1: #f39c12;
    --s-p-purple-1: #9b59b6;
    --s-p-cyan-1: #1abc9c;
    --s-p-red-1: #e74c3c;

    /* 中性色 */
    --s-p-bg-1: #f8f9fa;
    --s-p-bg-2: #ffffff;
    --s-p-text-1: #2c3e50;
    --s-p-text-2: #7f8c8d;
    --s-p-text-3: #95a5a6;
    --s-p-border-1: #e9ecef;

    /* 阴影 */
    --s-p-shadow-1: 0 2px 4px rgba(0, 0, 0, 0.05);
    --s-p-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.08);
    --s-p-shadow-3: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* 圆角 */
    --s-p-radius-1: 8px;
    --s-p-radius-2: 12px;
    --s-p-radius-3: 16px;

    /* 间距 */
    --s-p-space-1: 4px;
    --s-p-space-2: 8px;
    --s-p-space-3: 16px;
    --s-p-space-4: 24px;
    --s-p-space-5: 32px;

    /* 过渡 */
    --s-p-trans-1: 0.15s ease;
    --s-p-trans-2: 0.3s ease;
    --s-p-trans-3: 0.5s ease;

    /* 字体 */
    --s-p-font-1: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    --s-p-font-2: 'Consolas', 'Monaco', monospace;

    /* 安全相关 */
    --s-p-secure-1: rgba(102, 126, 234, 0.1);
    --s-p-secure-2: rgba(102, 126, 234, 0.4);
}

/* 防止CSS注入 - 仅重置通用属性，不使用!important */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 仅对特定需要保护的元素使用!important */
.login-container * {
    box-sizing: border-box !important;
}

/* 隐藏关键元素的默认样式 */
#username,
#password,
#captcha {
    font-family: var(--s-p-font-1) !important;
    font-size: 15px !important;
    letter-spacing: 0.3px !important;
}

/* 防止通过修改字体来检测输入 - 只对密码框生效 */
#password {
    -webkit-text-security: disc;
    text-security: disc;
}

/* 防止复制敏感信息 */
.login-container {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* 允许输入框选择文本 */
.login-container input,
.login-container input[type="text"] {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* 防止屏幕录制时的样式泄露 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 开发者工具检测样式 - 在开发者工具打开时会有异常 */
@media screen and (min-width: 0px) and (max-width: 9999px) {
    /* 正常样式 */
}

/* 打印保护 - 防止打印登录页面 */
@media print {
    body {
        display: none !important;
    }
}

/* 隐藏元素样式 */
.hide {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* 滑块验证码样式增强 */
.slider-captcha-container {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 8px !important;
}

.slider-bg {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    pointer-events: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.slider-puzzle {
    cursor: grab !important;
    pointer-events: auto !important;
    transition: left 0.3s ease !important;
}

.slider-puzzle:active {
    cursor: grabbing !important;
}

.slider-track {
    position: relative !important;
    background: linear-gradient(90deg, #f7fafc 0%, #edf2f7 100%) !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
}

.slider-track-fill {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    height: 100% !important;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%) !important;
    transition: width 0.1s ease !important;
}

.slider-button {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 50% !important;
    cursor: grab !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: bold !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
}

.slider-button:active {
    cursor: grabbing !important;
}

.slider-button.slider-success {
    background: #28a745 !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4) !important;
}

.slider-button.slider-error {
    background: #dc3545 !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4) !important;
}

.slider-tip {
    position: absolute !important;
    text-align: center !important;
    font-size: 12px !important;
    color: #718096 !important;
    pointer-events: none !important;
    z-index: 5 !important;
}

/* 模态框样式增强 */
.modal-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 9999 !important;
    justify-content: center !important;
    align-items: center !important;
    animation: fadeIn 0.3s ease !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    padding: 40px !important;
    border-radius: 24px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    width: 480px !important;
    max-width: 90% !important;
    text-align: center !important;
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes fadeIn {
    from { opacity: 0 !important; }
    to { opacity: 1 !important; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0 !important;
        transform: scale(0.9) translateY(20px) !important;
    }
    to {
        opacity: 1 !important;
        transform: scale(1) translateY(0) !important;
    }
}

/* 错误和成功消息样式 */
.error-message,
.success-message {
    margin-top: 20px !important;
    font-size: 14px !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    text-align: left !important;
    animation: shake 0.5s ease !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0) !important; }
    25% { transform: translateX(-5px) !important; }
    75% { transform: translateX(5px) !important; }
}

.error-message {
    color: #e53e3e !important;
    background: rgba(245, 101, 101, 0.1) !important;
    border: 1px solid rgba(245, 101, 101, 0.3) !important;
}

.success-message {
    color: #38a169 !important;
    background: rgba(72, 187, 120, 0.1) !important;
    border: 1px solid rgba(72, 187, 120, 0.3) !important;
}

/* 加载动画 */
.spinner {
    border: 3px solid rgba(102, 126, 234, 0.1) !important;
    border-top: 3px solid #667eea !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    animation: spin 0.8s linear infinite !important;
    margin: 0 auto !important;
}

@keyframes spin {
    0% { transform: rotate(0deg) !important; }
    100% { transform: rotate(360deg) !important; }
}

/* 响应式设计保护 */
@media (max-width: 480px) {
    .login-container {
        width: 90% !important;
        max-width: 380px !important;
        padding: 40px 30px !important;
        margin: 20px !important;
    }

    .modal-content {
        width: 90% !important;
        max-width: 400px !important;
        padding: 30px 25px !important;
    }
}

/* 防止选择保护 */
.no-select {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* 禁用文本选择 */
.disabled-select {
    user-select: none !important;
    pointer-events: none !important;
}

/* 安全焦点样式 */
input:focus,
button:focus {
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
}

/* 加载状态 */
.loading {
    display: none !important;
    margin: 15px 0 !important;
    text-align: center !important;
}

.loading.active {
    display: block !important;
}

/* 验证码容器 */
.captcha-container {
    display: none !important;
    transition: all 0.3s ease !important;
}

.captcha-container.show {
    display: block !important;
}

/* 隐藏类 */
.hidden {
    display: none !important;
    visibility: hidden !important;
}
