/* ========================================
   复利计算器 - 样式文件
   ======================================== */

:root {
    --primary-color: #D4AF37;
    --primary-dark: #C5A028;
    --secondary-color: #1B3A5C;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #F5F7FA;
    --card-bg: #ffffff;
    --success-color: #10b981;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    padding: 0 16px 40px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding: 16px 0;
    gap: 12px;
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.back-btn svg {
    width: 20px;
    height: 20px;
    color: var(--secondary-color);
}

.back-btn:active {
    transform: scale(0.95);
}

.header .title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Calc Section */
.calc-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 24px;
}

.input-group:last-of-type {
    margin-bottom: 20px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 12px;
}

.label-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.label-icon svg {
    width: 100%;
    height: 100%;
    color: var(--primary-color);
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 12px;
    padding: 0 16px;
    margin-bottom: 10px;
    overflow: hidden;
}

.input-field {
    flex: 1 1 0%;
    min-width: 60px;
    border: none;
    background: transparent;
    padding: 14px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    outline: none;
}

.input-field::placeholder {
    color: #ccc;
    font-weight: 400;
}

.input-unit {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    padding-left: 4px;
}

.slider-wrapper {
    padding: 0 4px;
}

.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--card-bg);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
    transition: transform 0.2s ease;
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--card-bg);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

/* Calc Button */
.calc-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
}

.calc-btn svg {
    width: 22px;
    height: 22px;
}

.calc-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* Result Section */
.result-section {
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Result Cards */
.result-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.result-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.result-card.highlight {
    background: linear-gradient(135deg, var(--secondary-color), #2d5a8a);
    color: #fff;
}

.result-card.highlight .card-label,
.result-card.highlight .card-hint {
    color: rgba(255, 255, 255, 0.8);
}

.card-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 6px;
}

.card-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.card-value.profit {
    color: var(--success-color);
}

.result-card.highlight .card-value {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.card-value-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.card-hint {
    font-size: 0.7rem;
    color: var(--text-light);
}

.card-wan {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    text-align: center;
}

.summary-value-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.summary-wan {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Summary Bar */
.summary-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.summary-item {
    flex: 1;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.summary-sub {
    display: block;
    font-size: 0.8rem;
    color: var(--success-color);
    margin-top: 2px;
}

.summary-divider {
    width: 1px;
    height: 40px;
    background: #e5e7eb;
    margin: 0 20px;
}

/* Chart Container */
.chart-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 16px;
    text-align: center;
}

.chart-wrapper {
    height: 250px;
    position: relative;
}

/* Detail Section */
.detail-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.detail-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 16px;
}

.detail-title svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.detail-list {
    max-height: 300px;
    overflow-y: auto;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-year {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.detail-values {
    text-align: right;
}

.detail-amount {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.detail-profit {
    font-size: 0.8rem;
    color: var(--success-color);
}

/* Responsive */
@media screen and (max-width: 375px) {
    .result-cards {
        gap: 8px;
    }

    .card-value {
        font-size: 1rem;
    }

    .result-card.highlight .card-value {
        font-size: 0.9rem;
    }

    .chart-wrapper {
        height: 200px;
    }
}

/* Safe Area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}

/* 暗色模式保持品牌色调 */
@media (prefers-color-scheme: dark) {
    body {
        background: #F5F7FA;
        color: #333;
    }
}
