/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 主要内容区域 */
main {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 40px;
    margin-bottom: 40px;
}

/* 功能卡片 */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .feature-cards {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .feature-card {
        padding: 30px 20px;
    }
    
    .feature-icon {
        font-size: 2.5rem;
    }
    
    .feature-card h3 {
        font-size: 1.2rem;
    }
}

.feature-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

.feature-card:hover::before {
    left: 100%;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.2) rotate(5deg);
}

.feature-card h3 {
    color: #333;
    font-size: 1.4rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

.feature-card:nth-child(1) {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.feature-card:nth-child(2) {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.feature-card:nth-child(3) {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}

.feature-card:nth-child(1):hover {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    transform: translateY(-10px) scale(1.02);
}

.feature-card:nth-child(2):hover {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    transform: translateY(-10px) scale(1.02);
}

.feature-card:nth-child(3):hover {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    transform: translateY(-10px) scale(1.02);
}

/* 标签切换 */
.calculator-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 50px;
    flex-wrap: wrap;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tab-btn {
    padding: 15px 30px;
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    font-weight: 600;
    border-radius: 40px;
    position: relative;
    z-index: 1;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

/* 计算器内容 */
.calculator-content {
    position: relative;
}

.calculator-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.calculator-section.active {
    display: block;
}

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

.calculator-section {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.calculator-section:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.calculator-section:nth-child(1) {
    background: linear-gradient(135deg, #fff5f5, #ffe8e8);
    border-left: 5px solid #ff9a9e;
}

.calculator-section:nth-child(2) {
    background: linear-gradient(135deg, #f0ffff, #e6f7ff);
    border-left: 5px solid #a8edea;
}

.calculator-section:nth-child(3) {
    background: linear-gradient(135deg, #fffbf0, #fff2e6);
    border-left: 5px solid #fcb69f;
}

.calculator-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.calculator-section:nth-child(1) h2::before {
    content: '🧮';
    font-size: 1.5rem;
}

.calculator-section:nth-child(2) h2::before {
    content: '📊';
    font-size: 1.5rem;
}

.calculator-section:nth-child(3) h2::before {
    content: '📈';
    font-size: 1.5rem;
}

.section-desc {
    color: #666;
    margin-bottom: 35px;
    font-size: 1.2rem;
    background: rgba(255,255,255,0.7);
    padding: 15px 20px;
    border-radius: 15px;
    border-left: 4px solid currentColor;
}

/* 输入组 */
.input-group {
    margin-bottom: 30px;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.8);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    justify-content: center;
}

.input-row span {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    background: rgba(102, 126, 234, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
}

input[type="number"] {
    padding: 18px 25px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: 1.3rem;
    width: 180px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-weight: 600;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

input[type="number"]:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* 结果显示 */
.result {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 35px;
    margin-top: 30px;
    border: 1px solid #e9ecef;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 20px 20px 0 0;
}

.result:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.result-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.4;
    text-align: center;
}

.result-formula {
    font-size: 1.1rem;
    color: #666;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
    margin-top: 15px;
    line-height: 1.6;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.result.show {
    animation: slideIn 0.4s ease;
}

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

.result-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.result-formula {
    font-size: 1rem;
    color: #666;
    font-family: 'Courier New', monospace;
    background: rgba(102, 126, 234, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

/* 使用示例 */
.usage-examples {
    margin-top: 60px;
    padding-top: 50px;
    border-top: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 50px 40px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.usage-examples h3 {
    color: #333;
    margin-bottom: 40px;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    position: relative;
}

.usage-examples h3::before {
    content: '💡';
    margin-right: 15px;
    font-size: 1.5rem;
}

.usage-examples h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.example-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    padding: 35px 30px;
    border-radius: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.4s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.example-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 20px 20px 0 0;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.example-card:hover::before {
    transform: scaleX(1);
}

.example-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.example-card h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.example-card:nth-child(1) h4::before {
    content: '🛍️';
    font-size: 1.2rem;
}

.example-card:nth-child(2) h4::before {
    content: '🍽️';
    font-size: 1.2rem;
}

.example-card:nth-child(3) h4::before {
    content: '💳';
    font-size: 1.2rem;
}

.example-card:nth-child(4) h4::before {
    content: '🎓';
    font-size: 1.2rem;
}

.example-card:nth-child(5) h4::before {
    content: '📝';
    font-size: 1.2rem;
}

.example-card:nth-child(6) h4::before {
    content: '📖';
    font-size: 1.2rem;
}

.example-card:nth-child(7) h4::before {
    content: '💰';
    font-size: 1.2rem;
}

.example-card:nth-child(8) h4::before {
    content: '📈';
    font-size: 1.2rem;
}

.example-card:nth-child(9) h4::before {
    content: '📊';
    font-size: 1.2rem;
}

.example-card:nth-child(10) h4::before {
    content: '🏢';
    font-size: 1.2rem;
}

.example-card:nth-child(11) h4::before {
    content: '👥';
    font-size: 1.2rem;
}

.example-card:nth-child(12) h4::before {
    content: '🎯';
    font-size: 1.2rem;
}

.example-card p {
    color: #666;
    line-height: 1.7;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.5);
    padding: 15px;
    border-radius: 12px;
    border-left: 3px solid #667eea;
}

/* 公式解释 */
.formula-explanation {
    margin-top: 60px;
    padding-top: 50px;
    border-top: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.formula-explanation h3 {
    color: #333;
    margin-bottom: 40px;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    position: relative;
}

.formula-explanation h3::before {
    content: '📐';
    margin-right: 15px;
    font-size: 1.5rem;
}

.formula-explanation h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 30px;
}

.formula-item {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    padding: 35px 30px;
    border-radius: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.4s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.formula-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 20px 20px 0 0;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.formula-item:hover::before {
    transform: scaleX(1);
}

.formula-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.formula-item h4 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.formula-item:nth-child(1) h4::before {
    content: '🧮';
    font-size: 1.2rem;
}

.formula-item:nth-child(2) h4::before {
    content: '📊';
    font-size: 1.2rem;
}

.formula-item:nth-child(3) h4::before {
    content: '📈';
    font-size: 1.2rem;
}

.formula-item p {
    margin-bottom: 15px;
    color: #555;
    line-height: 1.7;
    font-size: 1.1rem;
}

.formula-item strong {
    color: #667eea;
    font-weight: 700;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.formula-item p:nth-child(2) {
    background: rgba(255, 193, 7, 0.1);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.formula-item p:nth-child(3) {
    background: rgba(40, 167, 69, 0.1);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #28a745;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* 语言切换器 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-menu {
    position: relative;
}

.current-lang {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.current-lang:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.lang-dropdown a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.lang-dropdown a:last-child {
    border-bottom: none;
}

.lang-dropdown a:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .language-switcher {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .lang-dropdown {
        position: relative;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 10px;
    }
    
    .lang-dropdown.show {
        transform: translateX(-50%) translateY(0);
    }
}

/* 页脚 */
footer {
    text-align: center;
    color: white;
    margin-top: 40px;
}

footer p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-links a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    main {
        padding: 25px;
        margin-bottom: 20px;
    }
    
    .calculator-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .tab-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        text-align: center;
    }
    
    .calculator-section h2 {
        font-size: 1.5rem;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    input[type="number"] {
        width: 100%;
        font-size: 1.1rem;
    }
    
    .input-row span {
        text-align: center;
        margin: 5px 0;
    }
    
    button {
        width: 100%;
        padding: 15px;
    }
    
    .examples-grid,
    .formula-grid {
        grid-template-columns: 1fr;
    }
    
    .result-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    main {
        padding: 20px;
        border-radius: 15px;
    }
    
    .calculator-section h2 {
        font-size: 1.3rem;
    }
    
    input[type="number"] {
        font-size: 1rem;
        padding: 12px;
    }
    
    .result {
        padding: 20px;
    }
    
    .result-text {
        font-size: 1rem;
    }
}

/* 加载动画 */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 错误样式 */
.error {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-left-color: #f44336;
}

.error .result-text {
    color: #f44336;
}

/* 成功样式 */
.success {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border-left-color: #4caf50;
}

.success .result-text {
    color: #2e7d32;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 打印样式 */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: none;
    }
    
    main {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    button {
        display: none;
    }
}