/* 公共基础样式 - 子淳世界 */

/* 导入主题系统 */
@import url('./theme.css');

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition-theme);
    overflow-x: hidden;
    font-size: 16px;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

/* 确保html和body都占满整个视口 */
html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

* {
    box-sizing: inherit;
}

/* 响应式字体调整 */
@media (max-width: 480px) {
    body {
        font-size: 15px;
        line-height: 1.5;
    }
}

/* 统一的动态光晕背景效果 - 五行布局 - 子淳世界 */
.energy-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.energy-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
    filter: blur(40px);
    animation: float 20s infinite ease-in-out;
}

/* 五行能量球 - 传统五行布局 */
.orb-wood {
    width: 280px;
    height: 280px;
    background: var(--wuxing-wood);
    top: -80px;
    left: -80px;
    animation: woodFloat 175s infinite ease-in-out;
    animation-delay: 0s;
}

.orb-fire {
    width: 260px;
    height: 260px;
    background: var(--wuxing-fire);
    top: -80px;
    right: -80px;
    animation: fireFloat 200s infinite ease-in-out;
    animation-delay: 3s;
}

.orb-earth {
    width: 300px;
    height: 300px;
    background: var(--wuxing-earth);
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    animation: earthFloat 225s infinite ease-in-out;
    animation-delay: 6s;
}

.orb-metal {
    width: 240px;
    height: 240px;
    background: var(--wuxing-metal);
    bottom: -80px;
    right: -80px;
    animation: metalFloat 190s infinite ease-in-out;
    animation-delay: 9s;
}

.orb-water {
    width: 270px;
    height: 270px;
    background: var(--wuxing-water);
    bottom: -80px;
    left: -80px;
    animation: waterFloat 210s infinite ease-in-out;
    animation-delay: 12s;
}

/* 木元素动画 - 围绕整个页面的大型圆周运动 */
@keyframes woodFloat {
    0% {
        transform: translate(0px, 0px) rotate(0deg) scale(1);
    }
    10% {
        transform: translate(calc(50vw - 140px), calc(50vh - 140px)) rotate(45deg) scale(1.1);
    }
    25% {
        transform: translate(calc(80vw - 140px), calc(20vh - 140px)) rotate(90deg) scale(0.9);
    }
    40% {
        transform: translate(calc(60vw - 140px), calc(80vh - 140px)) rotate(135deg) scale(1.2);
    }
    55% {
        transform: translate(calc(20vw - 140px), calc(60vh - 140px)) rotate(180deg) scale(0.8);
    }
    70% {
        transform: translate(calc(30vw - 140px), calc(10vh - 140px)) rotate(225deg) scale(1.15);
    }
    85% {
        transform: translate(calc(70vw - 140px), calc(40vh - 140px)) rotate(270deg) scale(0.9);
    }
    100% {
        transform: translate(0px, 0px) rotate(360deg) scale(1);
    }
}

/* 火元素动画 - 大范围螺旋轨迹 */
@keyframes fireFloat {
    0% {
        transform: translate(0px, 0px) rotate(0deg) scale(1);
    }
    12% {
        transform: translate(calc(70vw - 130px), calc(30vh - 130px)) rotate(50deg) scale(1.2);
    }
    30% {
        transform: translate(calc(30vw - 130px), calc(80vh - 130px)) rotate(120deg) scale(0.8);
    }
    48% {
        transform: translate(calc(90vw - 130px), calc(70vh - 130px)) rotate(190deg) scale(1.1);
    }
    66% {
        transform: translate(calc(10vw - 130px), calc(90vh - 130px)) rotate(260deg) scale(0.9);
    }
    84% {
        transform: translate(calc(85vw - 130px), calc(15vh - 130px)) rotate(330deg) scale(1.05);
    }
    100% {
        transform: translate(0px, 0px) rotate(360deg) scale(1);
    }
}

/* 土元素动画 - 底部大圆周轨迹 */
@keyframes earthFloat {
    0% {
        transform: translate(0px, 0px) rotate(0deg) scale(1);
    }
    15% {
        transform: translate(calc(20vw - 150px), calc(85vh - 150px)) rotate(60deg) scale(0.95);
    }
    35% {
        transform: translate(calc(80vw - 150px), calc(85vh - 150px)) rotate(140deg) scale(1.05);
    }
    55% {
        transform: translate(calc(90vw - 150px), calc(50vh - 150px)) rotate(220deg) scale(0.9);
    }
    75% {
        transform: translate(calc(10vw - 150px), calc(50vh - 150px)) rotate(300deg) scale(1.1);
    }
    100% {
        transform: translate(0px, 0px) rotate(360deg) scale(1);
    }
}

/* 金元素动画 - 顶部大范围轨迹 */
@keyframes metalFloat {
    0% {
        transform: translate(0px, 0px) rotate(0deg) scale(1);
    }
    18% {
        transform: translate(calc(80vw - 120px), calc(15vh - 120px)) rotate(80deg) scale(1.1);
    }
    36% {
        transform: translate(calc(40vw - 120px), calc(25vh - 120px)) rotate(160deg) scale(0.85);
    }
    54% {
        transform: translate(calc(10vw - 120px), calc(35vh - 120px)) rotate(240deg) scale(1.15);
    }
    72% {
        transform: translate(calc(85vw - 120px), calc(45vh - 120px)) rotate(320deg) scale(0.9);
    }
    100% {
        transform: translate(0px, 0px) rotate(360deg) scale(1);
    }
}

/* 水元素动画 - 左侧大圆周运动 */
@keyframes waterFloat {
    0% {
        transform: translate(0px, 0px) rotate(0deg) scale(1);
    }
    20% {
        transform: translate(calc(15vw - 135px), calc(70vh - 135px)) rotate(90deg) scale(1.05);
    }
    40% {
        transform: translate(calc(35vw - 135px), calc(90vh - 135px)) rotate(180deg) scale(0.9);
    }
    60% {
        transform: translate(calc(55vw - 135px), calc(70vh - 135px)) rotate(270deg) scale(1.1);
    }
    80% {
        transform: translate(calc(35vw - 135px), calc(30vh - 135px)) rotate(330deg) scale(0.95);
    }
    100% {
        transform: translate(0px, 0px) rotate(360deg) scale(1);
    }
}

/* 容器和布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
}

/* 针对移动设备的特殊优化 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        min-height: -webkit-fill-available;
        justify-content: center;
    }
}

.container.show {
    opacity: 1;
}

.container.hide {
    opacity: 0;
}

/* 按钮样式 */
.btn, .primary-btn, .login-button, .calculate-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition-smooth);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    /* 确保触摸目标大小符合最佳实践 */
    min-width: 48px;
    min-height: 48px;
    line-height: 1.2;
    box-sizing: border-box;
}

.btn:hover, .primary-btn:hover, .login-button:hover, .calculate-button:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn:disabled, .primary-btn:disabled, .login-button:disabled, .calculate-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* 表单元素样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--input-text);
    transition: var(--transition-smooth);
}

.form-group input:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* 单选按钮组样式 */
.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    margin-right: 0.5rem;
    width: auto;
}

/* 带按钮的输入框样式 */
.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button input {
    flex: 1;
}

.input-with-button button {
    flex-shrink: 0;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--modal-bg);
    border-radius: 6px;
    max-width: 768px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    min-width: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* 统一的加载动画 - 使用注册页面的加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading.hide {
    opacity: 0;
    pointer-events: none;
}

.loading.show {
    opacity: 1;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-light);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}

.toast.error {
    background-color: var(--error-color);
    color: white;
}

.toast.success {
    background-color: var(--success-color);
    color: white;
}

.toast-message {
    font-size: 14px;
}

/* 必填标记 */
.required {
    color: var(--error-color);
    margin-left: 2px;
}

/* 字段提示 */
.field-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* 错误消息 */
.error-message {
    color: var(--error-color);
    margin-top: 15px;
    font-size: 14px;
    display: none;
}

/* 响应式设计基础 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .modal-content {
        width: 98%;
        max-width: 100%;
    }
    
    .modal-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-buttons button {
        width: 100%;
    }
}