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

/* CSS 变量定义 */
:root {
    /* 主色系 - 专业蓝色 */
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    
    /* 中性色系 */
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --divider-color: #f1f5f9;
    
    /* 文字色系 */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* 状态色系 */
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --info-color: #0284c7;
    
    /* 阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* 边框半径 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* 全局样式 */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background-color);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

.title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.icon {
    font-size: 3.5rem;
    display: inline-block;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* 主内容区域 */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.input-section,
.results-section,
.chart-section {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s ease;
}

.input-section:hover,
.results-section:hover,
.chart-section:hover {
    box-shadow: var(--shadow-xl);
}

.chart-section {
    grid-column: 1 / -1;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--primary-color);
    border-radius: 2px;
}

/* 表单样式 */
.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--surface-color);
}

.input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.input:hover {
    border-color: var(--primary-light);
}

.input::placeholder {
    color: var(--text-light);
}

.calculate-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.calculate-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-sm);
}

/* 结果显示样式 */
.results-grid {
    display: grid;
    gap: 1rem;
}

.result-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.result-card:hover {
    box-shadow: var(--shadow-md);
}

.result-card:nth-child(1) {
    border-left: 4px solid var(--success-color);
}

.result-card:nth-child(2) {
    border-left: 4px solid var(--warning-color);
}

.result-icon {
    font-size: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.result-card:nth-child(1) .result-icon {
    background: var(--success-color);
}

.result-card:nth-child(2) .result-icon {
    background: var(--warning-color);
}

.result-content {
    flex: 1;
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 图表样式 */
.chart-container {
    background: var(--divider-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    overflow: hidden;
}

.chart {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-md);
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

.chart-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background: var(--divider-color);
    border-radius: var(--radius-md);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.footer-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.copyright {
    font-weight: 600;
    color: var(--text-secondary);
}

.icp-info a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.icp-info a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.description {
    font-style: italic;
    color: var(--text-light);
}

/* 高级响应式设计 */
@media (max-width: 1200px) {
    .container {
        max-width: 1000px;
    }
    
    .main {
        gap: 1.75rem;
    }
}

@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .container {
        padding: 2rem 1.5rem;
    }
    
    .input-section,
    .results-section,
    .chart-section {
        padding: 2rem;
    }
    
    .header {
        margin-bottom: 2.5rem;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 2.75rem;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .icon {
        font-size: 3.25rem;
    }
    
    .subtitle {
        font-size: 1.125rem;
        font-weight: 400;
    }
    
    .container {
        padding: 1.5rem 1rem;
    }
    
    .input-section,
    .results-section,
    .chart-section {
        padding: 2rem 1.5rem;
    }
    
    .chart {
        height: 350px;
    }
    
    .chart-info {
        flex-direction: column;
        gap: 1.25rem;
        text-align: center;
    }
    
    .result-card {
        flex-direction: row;
        text-align: left;
        gap: 1.25rem;
        padding: 1.75rem;
    }
    
    .result-icon {
        width: 4rem;
        height: 4rem;
        font-size: 1.75rem;
    }
    
    .calculate-btn {
        padding: 1.125rem 2rem;
        font-size: 1.05rem;
    }
    
    .main {
        gap: 1.5rem;
    }
}

@media (max-width: 640px) {
    .title {
        font-size: 2.25rem;
    }
    
    .icon {
        font-size: 2.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .container {
        padding: 1.25rem 0.75rem;
    }
    
    .input-section,
    .results-section,
    .chart-section {
        padding: 1.5rem 1.25rem;
    }
    
    .result-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
    }
    
    .result-icon {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.5rem;
        margin: 0 auto;
    }
    
    .calculate-btn {
        padding: 1rem 1.75rem;
        font-size: 1rem;
    }
    
    .chart {
        height: 280px;
    }
    
    .footer-content {
        gap: 0.75rem;
        padding: 0 1rem;
    }
    
    .footer-content p {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.875rem;
    }
    
    .icon {
        font-size: 2.25rem;
    }
    
    .subtitle {
        font-size: 0.925rem;
    }
    
    .container {
        padding: 1rem 0.5rem;
    }
    
    .input-section,
    .results-section,
    .chart-section {
        padding: 1.25rem 1rem;
    }
    
    .calculate-btn {
        padding: 0.925rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .chart {
        height: 250px;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .input {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }
}

/* 加载动画 */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 错误状态 */
.input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* 成功状态 */
.input.success {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

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

/* 聚焦时的无障碍支持 */
.calculate-btn:focus,
.input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 简化的提示效果 */
.tooltip {
    background: var(--error-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
}