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

/* CSS变量定义 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e67e22;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #ecf0f1;
    --border-color: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* 深色模式变量 */
[data-theme="dark"] {
    --primary-color: #34495e;
    --secondary-color: #2c3e50;
    --accent-color: #f39c12;
    --text-primary: #ecf0f1;
    --text-secondary: #95a5a6;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2c2c2c;
    --bg-tertiary: #343434;
    --border-color: #4a4a4a;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition);
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    border-radius: 50%;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--accent-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    color: var(--text-primary);
}

.theme-btn:hover {
    background-color: var(--bg-tertiary);
}

.sun-icon,
.moon-icon {
    transition: var(--transition);
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

[data-theme="light"] .sun-icon {
    display: block;
}

[data-theme="light"] .moon-icon {
    display: none;
}

/* 首页横幅样式 */
.hero {
    margin-top: 60px;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    padding: 4rem 2rem;
}

.hero-content {
    max-width: 800px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.2s backwards;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    animation: fadeInUp 1s ease 0.4s backwards;
    box-shadow: var(--shadow-md);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 通用容器和标题样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
}

/* 八字计算器样式 */
.calculator-section {
    padding: 6rem 2rem;
    background-color: var(--bg-secondary);
}

.calculator-form {
    max-width: 800px;
    margin: 0 auto 3rem;
    background-color: var(--bg-primary);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

.calculate-button {
    width: 100%;
    padding: 1rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.calculate-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-button:active {
    transform: translateY(0);
}

/* 测算结果样式 */
.result-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-primary);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.5s ease;
}

.hidden { display: none; }
.result-container.hidden { display: none; }

/* 手机号验证样式 */
.phone-verification {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.phone-verification .form-group {
    margin-bottom: 1.5rem;
}

.phone-verification label {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: #636e72;
    margin-bottom: 0.8rem;
}

.phone-verification input[type="tel"] {
    width: 100%;
    max-width: 300px;
    padding: 0.9rem 1.2rem;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1rem;
    color: #2c3e50;
    background-color: #fff;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
}

.phone-verification input[type="tel"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.verify-phone-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.9rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.verify-phone-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.verify-phone-button:active {
    transform: translateY(0);
}

.actual-result {
    animation: fadeIn 0.5s ease;
}

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

.result-container h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.bazi-result {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: center;
}

.bazi-result h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.bazi-result .bazi-chars {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1rem;
    letter-spacing: 0.5rem;
}

.fortune-services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.fortune-service-item {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.fortune-service-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.fortune-service-item h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.fortune-service-item .service-result {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background-color: var(--bg-primary);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.fortune-service-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.service-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.service-list.centered {
    justify-items: center;
    text-align: center;
}

.service-item {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    max-width: 300px;
    transition: var(--transition);
}

.service-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.service-item h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.service-item p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
}

/* 总结样式 */
.summary {
    background-color: var(--bg-secondary);
    padding: 1.8rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border-left: 5px solid var(--accent-color);
}

.summary h4 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.2rem;
}

.summary p {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.summary p:last-child {
    margin-bottom: 0;
    font-weight: 500;
    color: var(--accent-color);
}

/* 关于我们样式 */
.about-section {
    padding: 6rem 2rem;
    background-color: var(--bg-secondary);
}

.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    margin-top: 2rem;
}

.about-text h3,
.about-features h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.about-text p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.about-features ul {
    list-style: none;
}

.about-features li {
    padding: 0.75rem 0;
    color: var(--text-primary);
    position: relative;
    padding-left: 1.5rem;
}

.about-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: 700;
}

/* 页脚样式 */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem 2rem 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section p {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    opacity: 1;
    color: var(--accent-color);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.9rem;
    opacity: 0.7;
}

.warning-text {
    font-size: 0.8rem;
    opacity: 0.6;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .calculator-form {
        padding: 1.5rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 10px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo img {
        width: 30px;
        height: 30px;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .cta-button {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }

    .container {
        padding: 0 10px;
    }

    .calculator-section,
    .services-section,
    .about-section {
        padding: 4rem 1rem;
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}