* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

@supports (height: 100dvh) {
    body {
        min-height: 100dvh;
    }
}

.container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body.app-home .container,
.container.app-shell {
    width: min(1180px, calc(100vw - 72px));
    max-width: 1180px;
    min-height: 0;
    padding: 34px 36px 0;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.logo {
    font-size: 52px;
    font-weight: bold;
    color: #1e3c72;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.title {
    font-size: 28px;
    color: #333;
    font-weight: 600;
}

.subtitle {
    font-size: 14px;
    color: #999;
    margin-top: 8px;
}

/* 表单样式 */
.form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #1e3c72;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

.form-group input::placeholder {
    color: #bbb;
}

/* 复选框样式 */
.form-group.checkbox {
    display: flex;
    align-items: flex-start;
    margin-bottom: 28px;
}

.form-group.checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #1e3c72;
    flex-shrink: 0;
}

.form-group.checkbox label {
    margin: 0;
    font-size: 13px;
    color: #666;
    font-weight: 400;
    line-height: 1.5;
}

.form-side-link {
    margin-left: auto;
    color: #1e3c72;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.form-side-link:hover {
    text-decoration: underline;
}

.form-group.checkbox .link {
    color: #1e3c72;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.form-group.checkbox .link:hover {
    text-decoration: underline;
}

/* 错误信息 */
.error-msg {
    display: block;
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    min-height: 16px;
}

/* 验证码样式 */
.captcha-group {
    margin-bottom: 20px;
}

.captcha-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.captcha-container input {
    flex: 1;
}

.captcha-image {
    width: 100px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #f5f5f5;
    display: block;
}

.btn-refresh {
    padding: 10px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-refresh:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.btn-refresh:active {
    background: #ddd;
}

.btn-refresh.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 提交按钮 */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(30, 60, 114, 0.3);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 加载状态 */
.btn-submit.loading {
    position: relative;
    color: transparent;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 底部导航 */
.footer-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.footer-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.footer-btn .icon {
    font-size: 22px;
    margin-bottom: 6px;
}

.footer-btn:hover {
    background: #f0f0f0;
    border-color: #ddd;
    color: #1e3c72;
}

.footer-btn:active {
    background: #e8e8e8;
}

.forgot-step-hidden {
    display: none;
}

.forgot-footer-nav {
    grid-template-columns: repeat(2, 1fr);
}

.auth-footer-nav {
    grid-template-columns: repeat(2, 1fr);
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 25px 15px;
        border-radius: 12px;
    }

    body.app-home,
    body.app-page {
        padding: 0;
        overflow: hidden;
    }

    body.app-home .container,
    .container.app-shell {
        width: 100vw;
        max-width: none;
        min-height: 100vh;
        padding: calc(10px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
        border-radius: 0;
        box-shadow: none;
    }

    @supports (height: 100dvh) {
        body.app-home .container,
        .container.app-shell {
            min-height: 100dvh;
        }
    }

    .header {
        margin-bottom: 30px;
        padding-bottom: 20px;
    }

    .logo {
        font-size: 40px;
        margin-bottom: 6px;
    }

    .title {
        font-size: 22px;
    }

    .subtitle {
        font-size: 13px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"] {
        padding: 11px 14px;
        font-size: 13px;
    }

    .btn-submit {
        padding: 12px;
        font-size: 15px;
        margin-top: 12px;
    }

    .footer-nav {
        gap: 10px;
        margin-top: 20px;
        padding-top: 20px;
    }

    .footer-btn {
        padding: 10px;
        font-size: 11px;
    }

    .footer-btn .icon {
        font-size: 20px;
        margin-bottom: 5px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 15px 12px;
    }

    body.app-home .container,
    .container.app-shell {
        padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
    }

    .header {
        margin-bottom: 25px;
        padding-bottom: 15px;
    }

    .logo {
        font-size: 32px;
    }

    .title {
        font-size: 18px;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"] {
        font-size: 12px;
    }
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: #2ecc71;
    color: white;
    border-radius: 6px;
    font-size: 14px;
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

.message.error {
    background: #e74c3c;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}
