/* ROI计算器统一美化样式 - 移动端优化版 */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 性能优化 */
* {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    background: var(--primary-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

.mobile-optimized {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.container-fluid {
    padding: 0;
    margin: 0;
    width: 100%;
    min-height: 100vh;
}

.main-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 1rem;
    min-height: 100vh;
    transition: var(--transition-normal);
    will-change: transform;
}

.main-container:hover {
    box-shadow: none;
    transform: none;
}

.page-title {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    padding: 0.5rem 0;
    animation: fadeInDown 0.8s ease-out;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
    animation: scaleIn 0.6s ease-out 0.3s both;
}

.form-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.6s ease-out 0.2s both;
    will-change: transform;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: block;
    transition: var(--transition-fast);
}

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: var(--transition-normal);
    font-size: 1rem;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    will-change: border-color, box-shadow, transform;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
    outline: none;
}

.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    animation: shake 0.5s ease-in-out;
}

.input-group {
    display: flex;
    width: 100%;
    position: relative;
}

.input-group.focused {
    transform: scale(1.02);
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    flex: 1;
}

.input-group-text {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    font-weight: 600;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: var(--transition-normal);
}

.btn-calculate {
    background: var(--primary-gradient);
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    transition: var(--transition-normal);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.btn-calculate::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: var(--transition-slow);
}

.btn-calculate:hover::before {
    left: 100%;
}

.btn-calculate:hover, 
.btn-calculate:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    color: white;
}

.btn-calculate:disabled {
    opacity: 0.7;
    transform: none;
    cursor: not-allowed;
}

.btn-wide {
    width: 100%;
    max-width: 300px;
}

.result-area {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--card-shadow);
    border-left: 5px solid #667eea;
    transition: var(--transition-normal);
    opacity: 0;
    transform: translateY(20px);
    will-change: opacity, transform;
}

.result-area.show {
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.6s ease-out;
}

.result-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #495057;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.result-title i {
    margin-right: 0.5rem;
    color: #667eea;
    animation: pulse 2s infinite;
}

.metric-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8ecff 100%);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: var(--transition-normal);
    text-align: center;
    will-change: transform, box-shadow;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
}

.metric-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffa237;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: countUp 0.8s ease-out;
}

.metric-value i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

.pricing-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--card-shadow);
    will-change: transform;
}

.pricing-title {
    font-size: 1rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.pricing-title i {
    margin-right: 0.5rem;
}

.price-item {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe8cc 100%);
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.6rem;
    border-left: 4px solid #ffa237;
    transition: var(--transition-normal);
    display: flex;
    justify-content: space-between;
    align-items: center;
    will-change: transform, box-shadow;
}

.price-item:hover {
    transform: translateX(3px);
    box-shadow: 0 3px 15px rgba(255, 162, 55, 0.2);
}

.price-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.price-value {
    font-size: 1rem;
    font-weight: 600;
    color: #ffa237;
}

.footer-links {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    margin-top: 1.5rem;
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.footer-links .btn {
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition-normal);
    will-change: transform;
}

.footer-links .btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.calculation-time {
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaed 100%);
    border-radius: 10px;
    padding: 0.8rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #5f6368;
    text-align: center;
}

.note-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 10px;
    padding: 0.8rem;
    margin-top: 1rem;
    border-left: 4px solid #2196f3;
    font-size: 0.85rem;
}

.note-section b {
    color: #1976d2;
}

/* 错误提示样式 */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--danger-gradient);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transform: translateX(100%);
    transition: var(--transition-normal);
    max-width: 300px;
}

.error-toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-content i {
    font-size: 1.1rem;
}

/* 动画定义 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: translateX(-50%) scaleX(0);
    }
    to {
        transform: translateX(-50%) scaleX(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .main-container {
        padding: 0.8rem;
        border-radius: 0;
    }
    
    .page-title {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }
    
    .form-card, .result-area, .pricing-section {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .btn-calculate {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .metric-card {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.1rem;
    }
    
    .pricing-title {
        font-size: 0.9rem;
    }
    
    .price-item {
        padding: 0.7rem;
    }
    
    .price-label, .price-value {
        font-size: 0.8rem;
    }
    
    .footer-links .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .error-toast {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .error-toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0.5rem;
    }
    
    .page-title {
        font-size: 1.4rem;
    }
    
    .form-card, .result-area, .pricing-section {
        padding: 0.8rem;
    }
    
    .metric-value {
        font-size: 1rem;
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .metric-value i {
        margin-right: 0;
    }
    
    .price-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    
    .calculation-time, .note-section {
        font-size: 0.75rem;
        padding: 0.6rem;
    }
}

/* 兼容原有样式 */
.fz, .fz2 {
    font-size: 1rem;
}

/* 触摸优化 */
.btn, .form-control, .price-item {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* 防止缩放 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* 滚动条优化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* 性能优化 */
.container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    contain: layout style paint;
}

/* 预加载优化 */
.form-card,
.result-area,
.pricing-section,
.metric-card,
.price-item {
    contain: layout style;
}

/* 减少重绘 */
.btn-calculate,
.metric-card,
.price-item {
    transform: translateZ(0);
}