/* 引入Bootstrap Icons */
@import url('../libs/bootstrap-icons/bootstrap-icons.css');

/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    min-height: 100dvh; /* 使用动态视口高度,支持现代浏览器 */
}

/* ==================== 分屏布局容器 ==================== */
.split-login-container {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh; /* 使用动态视口高度 */
    width: 100%;
}

/* ==================== 左侧欢迎区域 ==================== */
.welcome-section {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    overflow: hidden;
}

.welcome-content {
    position: relative;
    z-index: 10;
    color: white;
    max-width: 600px;
}

/* Logo样式 */
.platform-logo {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease-out;
}

.platform-logo img {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.15));
}

/* 双Logo并排样式 */
.platform-logo.dual-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.platform-logo.dual-logo img {
    max-width: 140px;
    max-height: 100px;
    object-fit: contain;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-title {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
    animation: fadeInLeft 0.8s ease-out;
}

.welcome-description {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.95;
    animation: fadeInLeft 1s ease-out;
}

/* 装饰性几何图形 */
.decoration-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50px;
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 300px;
    height: 80px;
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b95 100%);
    top: 15%;
    left: 10%;
    transform: rotate(-25deg);
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 60px;
    background: linear-gradient(135deg, #ffd56b 0%, #ff9a56 100%);
    top: 50%;
    left: 5%;
    transform: rotate(15deg);
    animation-delay: 2s;
}

.shape-3 {
    width: 250px;
    height: 70px;
    background: linear-gradient(135deg, #ff6b95 0%, #ffd56b 100%);
    bottom: 20%;
    left: 15%;
    transform: rotate(-35deg);
    animation-delay: 4s;
}

.shape-4 {
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b95 100%);
    bottom: 10%;
    right: 15%;
    border-radius: 50%;
    animation-delay: 1s;
}

.shape-5 {
    width: 150px;
    height: 50px;
    background: linear-gradient(135deg, #ffd56b 0%, #ff9a56 100%);
    top: 30%;
    right: 20%;
    transform: rotate(45deg);
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(var(--rotate, 0deg));
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(calc(var(--rotate, 0deg) + 5deg));
    }
    50% {
        transform: translateY(-40px) translateX(-10px) rotate(calc(var(--rotate, 0deg) - 5deg));
    }
    75% {
        transform: translateY(-20px) translateX(10px) rotate(calc(var(--rotate, 0deg) + 5deg));
    }
}

/* ==================== 右侧登录区域 ==================== */
.login-section {
    flex: 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
    animation: fadeInRight 0.8s ease-out;
}

.login-header {
    margin-bottom: 40px;
}

.login-title {
    font-size: 32px;
    font-weight: 600;
    color: #a78bfa;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* ==================== 表单样式 ==================== */
.modern-login-form {
    width: 100%;
}

.form-group {
    margin-bottom: 24px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 18px;
    color: #a78bfa;
    font-size: 18px;
    z-index: 1;
    pointer-events: none;
}

.modern-input {
    width: 100%;
    height: 50px;
    padding: 12px 50px 12px 50px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 15px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    outline: none;
}

.modern-input:focus {
    border-color: #a78bfa;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.1);
}

.modern-input::placeholder {
    color: #adb5bd;
}

.toggle-password {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: #adb5bd;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #a78bfa;
}

/* 表单选项 */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.remember-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.remember-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #a78bfa;
}

.remember-checkbox span {
    font-size: 14px;
    color: #6c757d;
}

.forgot-password {
    font-size: 14px;
    color: #a78bfa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #8b5cf6;
    text-decoration: underline;
}

/* 登录按钮 */
.modern-login-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modern-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.5);
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.modern-login-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(167, 139, 250, 0.3);
}

.modern-login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.3);
}

/* 加载动画 */
.spinner-border-sm {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 2px;
}

/* ==================== 消息提示 ==================== */
.alert {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    animation: slideInUp 0.4s ease-out;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

/* ==================== 动画效果 ==================== */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .welcome-title {
        font-size: 40px;
    }

    .welcome-description {
        font-size: 16px;
    }

    .welcome-section,
    .login-section {
        padding: 40px;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto; /* 允许移动端滚动 */
    }

    .split-login-container {
        flex-direction: column;
        min-height: auto; /* 移除固定高度,允许内容撑开 */
    }

    .welcome-section {
        flex: 0 0 auto;
        min-height: 35vh;
        min-height: 35dvh;
        padding: 30px;
    }

    .platform-logo img {
        max-width: 180px;
    }

    .platform-logo.dual-logo {
        gap: 20px;
    }

    .platform-logo.dual-logo img {
        max-width: 100px;
        max-height: 70px;
    }

    .welcome-title {
        font-size: 32px;
    }

    .welcome-description {
        font-size: 14px;
    }

    .login-section {
        flex: 0 0 auto;
        min-height: 65vh;
        min-height: 65dvh;
        padding: 30px 20px 60px 20px; /* 增加底部内边距,防止按钮被遮挡 */
    }

    .login-form-wrapper {
        max-width: 100%;
        padding-bottom: 40px; /* 额外的底部空间 */
    }

    .login-title {
        font-size: 28px;
    }

    .decoration-shapes {
        opacity: 0.5;
    }

    .shape {
        transform: scale(0.7);
    }
}

@media (max-width: 480px) {
    .welcome-section {
        flex: 0 0 auto;
        min-height: 30vh;
        min-height: 30dvh;
        padding: 20px;
    }

    .platform-logo {
        margin-bottom: 20px;
    }

    .platform-logo img {
        max-width: 140px;
    }

    .platform-logo.dual-logo {
        gap: 15px;
    }

    .platform-logo.dual-logo img {
        max-width: 80px;
        max-height: 60px;
    }

    .welcome-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .welcome-description {
        font-size: 13px;
    }

    .login-section {
        padding: 20px 16px 80px 16px; /* 显著增加底部内边距 */
        min-height: 70vh;
        min-height: 70dvh;
    }

    .login-form-wrapper {
        padding-bottom: 60px; /* 更多底部空间 */
    }

    .login-title {
        font-size: 24px;
    }

    .modern-input {
        height: 46px;
        font-size: 14px;
        padding: 10px 45px 10px 45px;
    }

    .modern-login-btn {
        height: 46px;
        font-size: 15px;
        margin-bottom: 20px; /* 按钮下方留白 */
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* 确保消息提示也有底部空间 */
    .alert {
        margin-bottom: 30px;
    }
}

/* ==================== 移动端安全视口处理 ==================== */
/* 为所有移动设备添加额外的视口安全边距 */
@media (max-width: 768px) {
    /* iOS Safari 安全区域支持 */
    .login-section {
        padding-bottom: max(60px, env(safe-area-inset-bottom, 60px));
    }
}

@media (max-width: 480px) {
    .login-section {
        padding-bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
    }
}

/* ==================== 浏览器兼容性 ==================== */
@supports (-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px)) {
    .modern-input:focus {
        backdrop-filter: blur(10px);
    }
}

/* ==================== 用户协议样式 ==================== */
.agreement-section {
    margin-bottom: 20px;
    padding: 12px 0;
}

.agreement-checkbox {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.5;
}

.agreement-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-right: 10px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #a78bfa;
}

.agreement-checkbox span {
    flex: 1;
}

.agreement-link {
    color: #a78bfa;
    text-decoration: none;
    font-weight: 500;
}

.agreement-link:hover {
    color: #8b5cf6;
    text-decoration: underline;
}

/* 协议模态框 */
.agreement-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.agreement-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.agreement-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.agreement-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agreement-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.agreement-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.agreement-close-btn:hover {
    color: #1f2937;
}

.agreement-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: #374151;
}

.agreement-modal-body h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 20px 0 12px;
}

.agreement-modal-body h4:first-child {
    margin-top: 0;
}

.agreement-modal-body p {
    margin: 0 0 12px;
}

.agreement-modal-body ul,
.agreement-modal-body ol {
    margin: 0 0 12px;
    padding-left: 24px;
}

.agreement-modal-body li {
    margin-bottom: 6px;
}

.agreement-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agreement-version {
    font-size: 12px;
    color: #9ca3af;
}

/* 协议加载中样式 */
.agreement-modal-body .loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.agreement-modal-body .loading-spinner .spinner-border {
    margin-right: 10px;
}

/* 禁用状态的登录按钮 */
.modern-login-btn.agreement-required:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #d1d5db;
    box-shadow: none;
}

/* 动画 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式 - 协议模态框 */
@media (max-width: 480px) {
    .agreement-modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px;
    }

    .agreement-modal-header,
    .agreement-modal-body,
    .agreement-modal-footer {
        padding: 16px;
    }

    .agreement-checkbox {
        font-size: 12px;
    }

    .agreement-modal-header h3 {
        font-size: 18px;
    }

    .agreement-modal-body {
        font-size: 13px;
    }

    .agreement-modal-body h4 {
        font-size: 15px;
    }
}
