/* Calculator Specific Styles */

/* Calculator Section */
.calculator-section {
    padding: var(--space-16) 0;
    background-color: var(--gray-50);
}

.calculator-container {
    background-color: white;
    border-radius: var(--rounded-2xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-10);
    margin: var(--space-8) 0;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.calculator-header {
    text-align: center;
    margin-bottom: var(--space-10);
    padding-bottom: var(--space-6);
    border-bottom: 2px solid var(--gray-100);
}

.calculator-header h2 {
    color: var(--gray-900);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.calculator-subtitle {
    color: var(--gray-600);
    font-size: 1.125rem;
    margin: 0;
}

/* Form Sections */
.form-section {
    margin-bottom: var(--space-10);
}

.section-title {
    color: var(--gray-800);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: var(--rounded-sm);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

/* Input Groups */
.input-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.input-group label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.input-group input,
.input-group select {
    padding: var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--rounded-lg);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: all var(--transition-base);
    background-color: white;
    color: var(--gray-900);
    min-height: 48px; /* Touch-friendly minimum */
    width: 100%;
    box-sizing: border-box;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.input-group input[type="number"] {
    font-family: var(--font-mono);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
    padding-right: 50px;
}

.input-help {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: var(--space-2);
    line-height: 1.4;
}

/* Input States */
.input-group input:hover,
.input-group select:hover {
    border-color: var(--gray-300);
}

.input-group input.error,
.input-group select.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-group input.success,
.input-group select.success {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Results Container */
.results-container {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: var(--rounded-2xl);
    padding: var(--space-10);
    margin-top: var(--space-10);
    color: white;
    animation: fadeIn 0.6s ease-out;
}

.results-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.results-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: white;
}

.usage-stats {
    font-size: 0.9rem;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.result-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.result-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.2);
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.5));
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    display: block;
}

.result-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.result-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: white;
    word-break: break-word;
}

/* Special styling for different result types */
.result-card.capital-gain .result-icon {
    color: #fbbf24; /* amber-400 */
}

.result-card.tax-owed .result-icon {
    color: #f87171; /* red-400 */
}

.result-card.net-profit .result-icon {
    color: #34d399; /* emerald-400 */
}

.result-card.effective-rate .result-icon {
    color: #a78bfa; /* violet-400 */
}

/* Detailed Breakdown */
.detailed-breakdown {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--rounded-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.breakdown-section {
    margin-bottom: var(--space-6);
}

.breakdown-section:last-child {
    margin-bottom: 0;
}

.breakdown-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-4);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: var(--space-2);
}

.calculation-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.calculation-step:last-child {
    border-bottom: none;
}

.calculation-step.highlight {
    font-weight: 700;
    font-size: 1.125rem;
    padding: var(--space-4) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    margin: var(--space-2) -var(--space-4);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    border-radius: var(--rounded-lg);
}

.calculation-step .label {
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

.calculation-step .value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: white;
    text-align: right;
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

.results-actions .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.results-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Error States */
.error-message {
    background-color: var(--error-color);
    color: white;
    padding: var(--space-4);
    border-radius: var(--rounded-lg);
    margin: var(--space-4) 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.error-message::before {
    content: '⚠️';
    font-size: 1.25rem;
}

/* Success States */
.success-message {
    background-color: var(--success-color);
    color: white;
    padding: var(--space-4);
    border-radius: var(--rounded-lg);
    margin: var(--space-4) 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.success-message::before {
    content: '✓';
    font-size: 1.25rem;
}

/* Info Messages */
.info-message {
    background-color: var(--primary-color);
    color: white;
    padding: var(--space-4);
    border-radius: var(--rounded-lg);
    margin: var(--space-4) 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.info-message::before {
    content: 'ℹ️';
    font-size: 1.25rem;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--gray-900);
    color: white;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--rounded-md);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: 1000;
}

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

/* Progress Indicator */
.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--space-8);
    gap: var(--space-4);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.progress-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: var(--gray-200);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.875rem;
}

.progress-step.active .progress-number {
    background-color: var(--primary-color);
    color: white;
}

.progress-step.completed .progress-number {
    background-color: var(--success-color);
    color: white;
}

.progress-line {
    width: 2rem;
    height: 2px;
    background-color: var(--gray-200);
}

.progress-step.completed + .progress-step .progress-line {
    background-color: var(--success-color);
}

/* Animation Delays for Results Cards */
.result-card:nth-child(1) {
    animation-delay: 0.1s;
}

.result-card:nth-child(2) {
    animation-delay: 0.2s;
}

.result-card:nth-child(3) {
    animation-delay: 0.3s;
}

.result-card:nth-child(4) {
    animation-delay: 0.4s;
}

/* Professional disclaimer in results */
.professional-disclaimer {
    background: linear-gradient(135deg, #fef3c7, #fcd34d);
    border: 2px solid #f59e0b;
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin: var(--space-8) 0;
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
}

.disclaimer-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.disclaimer-content h4 {
    color: #92400e;
    margin: 0 0 var(--space-3) 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.disclaimer-content p {
    color: #78350f;
    margin: var(--space-2) 0;
    line-height: 1.6;
}

.disclaimer-content p:last-child {
    margin-bottom: 0;
    font-size: 0.875rem;
    opacity: 0.8;
}

.disclaimer-content strong {
    color: #451a03;
}

/* Mobile-specific calculator optimizations */
@media (max-width: 767px) {
    .calculator-section {
        padding: var(--space-10) 0;
    }
    
    .calculator-container {
        padding: var(--space-4);
        margin: var(--space-3) 0;
        border-radius: var(--rounded-lg);
        box-shadow: var(--shadow-lg);
    }
    
    .calculator-header {
        margin-bottom: var(--space-6);
        padding-bottom: var(--space-4);
    }
    
    .calculator-header h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: var(--space-3);
    }
    
    .calculator-subtitle {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .form-section {
        margin-bottom: var(--space-6);
    }
    
    .section-title {
        font-size: 1.125rem;
        margin-bottom: var(--space-4);
        padding-bottom: var(--space-2);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .input-group {
        margin-bottom: 0;
    }
    
    .input-group label {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: var(--space-2);
        color: var(--gray-800);
    }
    
    .input-group input,
    .input-group select {
        padding: var(--space-4) var(--space-4);
        font-size: 1rem;
        border-radius: var(--rounded-md);
        border-width: 1px;
        min-height: 56px; /* 增加到56px确保触摸友好 */
        box-sizing: border-box;
    }
    
    .input-group select {
        background-size: 16px;
        background-position: right 14px center;
        padding-right: 45px;
    }
    
    .input-help {
        font-size: 0.75rem;
        margin-top: var(--space-1);
        line-height: 1.4;
    }
    
    /* Input wrapper for mobile */
    .input-wrapper {
        position: relative;
    }
    
    .input-prefix {
        position: absolute;
        left: var(--space-3);
        top: 50%;
        transform: translateY(-50%);
        color: var(--gray-500);
        font-size: 1rem;
        pointer-events: none;
        z-index: 1;
        font-weight: 500;
    }
    
    .input-wrapper input {
        padding-left: calc(var(--space-6) + 0.5rem);
    }
    
    /* Enhanced touch targets */
    .btn {
        min-height: 56px; /* 统一为56px */
        padding: var(--space-4) var(--space-6);
        font-size: 1rem;
        font-weight: 600;
        border-radius: var(--rounded-lg);
        touch-action: manipulation;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.2;
    }
    
    /* Improved validation states for mobile */
    .input-validation {
        position: absolute;
        right: var(--space-3);
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.25rem;
        line-height: 1;
    }
    
    .input-group input.error ~ .input-validation::before {
        content: '⚠️';
        color: var(--error-color);
    }
    
    .input-group input.success ~ .input-validation::before {
        content: '✓';
        color: var(--success-color);
    }
    
    /* Dynamic help styling for mobile */
    .dynamic-help {
        background: var(--primary-color);
        color: white;
        padding: var(--space-3);
        border-radius: var(--rounded-md);
        margin-top: var(--space-2);
        font-size: 0.8rem;
        line-height: 1.4;
        position: relative;
    }
    
    .dynamic-help::before {
        content: '';
        position: absolute;
        top: -6px;
        left: var(--space-4);
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-bottom: 6px solid var(--primary-color);
    }
    
    .dynamic-help p {
        margin: 0;
        color: rgba(255, 255, 255, 0.95);
    }
    
    .dynamic-help strong {
        color: white;
    }
    
    /* Gain preview mobile styling */
    .gain-preview {
        background: var(--success-color);
        color: white;
        padding: var(--space-2) var(--space-3);
        border-radius: var(--rounded-md);
        font-size: 0.8rem;
        font-weight: 600;
        margin-top: var(--space-2);
        text-align: center;
    }
    
    .gain-preview .gain-amount {
        font-weight: 700;
        font-size: 0.9rem;
    }
    
    /* Required field indicators */
    .required {
        color: var(--error-color);
        font-weight: 700;
    }
    
    /* Form submission button area */
    .form-section:last-child {
        margin-top: var(--space-8);
        padding-top: var(--space-6);
        border-top: 1px solid var(--gray-200);
        text-align: center;
    }
    
    .form-section:last-child .btn {
        width: 100%;
        margin-bottom: var(--space-3);
    }
    
    .form-section:last-child .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Progress guide mobile */
    .interactive-guide {
        background: var(--gray-50);
        border-radius: var(--rounded-lg);
        padding: var(--space-4);
        margin-bottom: var(--space-6);
    }
    
    .guide-progress {
        text-align: center;
    }
    
    .progress-bar {
        width: 100%;
        height: 6px;
        background: var(--gray-200);
        border-radius: 3px;
        overflow: hidden;
        margin-bottom: var(--space-2);
    }
    
    .progress-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
        transition: width 0.3s ease;
        border-radius: 3px;
    }
    
    .progress-text {
        font-size: 0.8rem;
        color: var(--gray-600);
        font-weight: 500;
    }
}

/* Ultra-small screens (320px and below) */
@media (max-width: 320px) {
    .calculator-container {
        padding: var(--space-3);
        margin: var(--space-2) 0;
    }
    
    .calculator-header h2 {
        font-size: 1.375rem;
    }
    
    .input-group input,
    .input-group select {
        padding: var(--space-3);
        font-size: 0.95rem;
    }
    
    .btn {
        padding: var(--space-3) var(--space-4);
        font-size: 0.9rem;
    }
}