﻿*, *::before, *::after {
  box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

body.night-mode {
    background: linear-gradient(135deg, #1a202c 0%, #1e293b 100%);
    color: #cbd5e1;
}

.container {
    width: 100%;
    padding: 20px;
    min-width: 300px;
    border-radius: 8px;
    display: flex;
    flex-direction: column; /* Default: Stack vertically */
    align-items: center; /* Center items horizontally when stacked */
    gap: 2rem; /* Add gap for vertical stacking */
}

h1 {
    color: #1e40af;
    font-size: 2.8rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    text-align: center;
    letter-spacing: -0.5px;
}

h2 {
    color: #1e3a8a;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.welcome-text {
    background: rgba(255, 255, 255, 0.9);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    text-align: center;
    line-height: 1.6;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.night-mode .welcome-text {
    background: rgba(31, 41, 55, 0.9);
}

.welcome-text p {
    margin: 1rem 0;
    font-size: 1rem;
    line-height: 1.6;
}

.highlight {
    color: #1d4ed8;
    font-weight: 600;
}

.security-tip {
    color: #065f46;
}

.security-warning {
    color: #92400e;
}

.security-alert {
    color: #dc2626;
}

input[type="text"],
input[type="password"],
select {
    background: #f8fafc;
    box-sizing: border-box;
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* 输入框聚焦状态 */
input:focus,
select:focus {
    background: white;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.15),
    0 2px 6px rgba(30, 58, 138, 0.05);
}

button {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
    color: white;
    padding: 1.2rem 1.8rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 6px rgba(30, 58, 138, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(30, 58, 138, 0.15),
    0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(30, 58, 138, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn {
    display: block;
    margin-top: 1.5rem;
    color: #64748b;
    transition: color 0.2s ease;
}

.toggle-btn:hover {
    color: #3b82f6;
    text-decoration: none;
}

.form-container {
    background: rgba(255, 255, 255, 0.98);
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.night-mode .form-container {
    background: rgba(31, 41, 55, 0.98);
}

.controls {
    display: flex;
    align-items: start; /* 垂直居中 */
    gap: 1em;
    text-align: center;
    margin-top: 10px;
}

.lang-selector, .dark-toggle {
    display: flex;
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 4em; /* 设置固定高度 */
    width: auto; /* 设置宽度自适应 */
    line-height: 1; /* 控制文本的垂直对齐 */
}



.lang-selector:focus, .dark-toggle:focus {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.lang-selector option {
    color: black;
    background-color: white;
}

.error-message {
    font-size: 1rem;
    margin: -1rem 0 1.5rem;
    height: 2rem;
    color: #dc2626;
    padding-left: 1rem;
}

footer.footer-content {
    display: block !important;
}

.footer-content {
    width: 100%;
    margin-top: auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    transition: background-color 0.3s;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: auto; /* 设置为auto以适应内容 */
    flex: 0 0 auto;
    padding: 0.5rem 0; /* 减少padding */
    flex-direction: row;
    flex-wrap: nowrap; /* 防止换行 */
    justify-content: center;
}

.footer-item p {
    margin: 0;
    font-size: 1rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
    white-space: nowrap; /* 防止换行 */
}

.night-mode .footer-item p {
    color: #adb5bd;
}

.footer-item a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.2s;
    overflow: visible;
    flex-wrap: nowrap;
    max-width: 95vw;
}

.footer-item a:hover {
    color: #3498db;
    text-decoration: underline;
}

.night-mode .footer-item a {
    color: #6574cd;
}

.version {
    font-size: 0.9rem;
    color: #6c757d;
    margin-left: 0.5rem;
    transition: color 0.3s;
}

.night-mode .version {
    color: #8898aa;
}

.footer-item svg {
    vertical-align: middle;
    width: 24px;
    height: 24px;
}

@media (min-width: 600px) and (orientation: landscape) {
     .container {
        padding: 2rem;
        gap: 2rem; /* Keep the gap for horizontal layout */
        flex-direction: row; /* Arrange side-by-side */
        align-items: stretch; /* Make children same height */
        min-height: calc(100vh - 60px); /* Example adjustment if needed */
    }

 .welcome-text,
    .form-container {
        flex: 1 1 50%; /* Each takes roughly half the width */
        min-height: 100%;
        height: auto;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        /* Remove margin if gap is sufficient, or adjust as needed */
        margin: 0; /* Reset any potential default margins */
    }

    .welcome-text > div {
        flex: 1;
        overflow-y: auto;
        padding: 2rem 3rem;
    }

    form {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

@media (max-width: 600px) {

 /* Styles for smaller screens (mostly portrait) */
    body {
        padding: 5px;
    }


    .container {
        flex-direction: column;
        align-items: center; /* 保持，以备后用 */

        width: 100%;
        /* 减小左右内边距 */
        padding: 0.8rem 1rem; /* 上下 0.8rem, 左右 1rem */
        box-sizing: border-box;

        /* 减小上下外边距 */
        margin: 0.8rem auto;
        /* 减小元素间垂直间距 */
        gap: 1rem;
        min-width: 300px; /* 保持最小宽度 */
    }

 .welcome-text,
    .form-container {
        width: 100%; /* 仍然占满容器内容宽度 */
        max-width: 450px; /* 保持最大宽度限制 */
        box-sizing: border-box;

        /* 减小内部 padding */
        padding: 1.5rem;

        /* !!! 强制水平居中 !!! */
        margin-left: auto;
        margin-right: auto;

        /* 重置 flex 属性 */
        flex-basis: auto;
        min-height: auto;
    }

    h1 {
        margin-bottom: 1.5rem;
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .welcome-text p {
        font-size: 1rem;
    }

    input[type="text"],
    input[type="password"],
    select {
        padding: 1rem;
    }

    .form-container {
        padding: 2rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.5rem; /* 减少gap */
        padding: 1.5rem 1.5rem;
    }

    .footer-item p {
        white-space: nowrap;
        flex-wrap: wrap;
    }

    .footer-item a {
        max-width: none;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
    }

    .version {
        display: none;
    }
}

/* 夜间模式下的输入框样式 */
body.night-mode input[type="text"],
body.night-mode input[type="password"],
body.night-mode select {
    background: #31475e; /* 更深的颜色以便对比 */
    color: #dce6f1; /* 更亮的文字颜色 */
    border-color: #31475e;
}

body.night-mode input[type="text"]:focus,
body.night-mode input[type="password"]:focus,
body.night-mode select:focus {
    background: #4361ee; /* 焦点时更深的颜色 */
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(147, 197, 253, 0.15),
    0 2px 6px rgba(30, 58, 138, 0.05);
}

/* 夜间模式下的选择器和切换按钮 */
body.night-mode .lang-selector,
body.night-mode .dark-toggle {
    background: rgba(59, 130, 246, 0.1);
    color: #ffffff; /* 文字颜色改为白色 */
}

body.night-mode .lang-selector:focus,
body.night-mode .dark-toggle:focus {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}