/* ===================================
   MOBILE ENHANCEMENTS & RESPONSIVE DESIGN
   =================================== */

/* Mobile-First Chart Containers */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin: 20px 0;
}

@media (min-width: 768px) {
    .chart-container {
        height: 400px;
    }
}

@media (min-width: 1024px) {
    .chart-container {
        height: 450px;
    }
}

/* Responsive Chart Canvas */
.chart-container canvas {
    max-width: 100%;
    height: auto !important;
    touch-action: pan-y;
}

/* Mobile-Friendly Tables */
@media (max-width: 768px) {
    .breakdown-table {
        font-size: 0.85rem;
    }
    
    .breakdown-table th,
    .breakdown-table td {
        padding: 8px 4px;
    }
    
    /* Stack table on very small screens */
    @media (max-width: 480px) {
        .breakdown-table thead {
            display: none;
        }
        
        .breakdown-table tr {
            display: block;
            margin-bottom: 16px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 12px;
        }
        
        .breakdown-table td {
            display: block;
            text-align: right;
            padding: 8px;
            border: none;
        }
        
        .breakdown-table td:before {
            content: attr(data-label);
            float: left;
            font-weight: 600;
            color: #2E7D32;
        }
    }
}

/* Mobile-Friendly Result Cards */
@media (max-width: 768px) {
    .result-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .result-card {
        padding: 16px;
    }
    
    .primary-result {
        padding: 24px 16px;
    }
    
    .big-number {
        font-size: 2rem;
    }
}

/* Touch-Friendly Buttons */
@media (max-width: 768px) {
    .calculate-btn,
    .action-btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-btn {
        width: 100%;
    }
}

/* Mobile Chart Tabs */
@media (max-width: 768px) {
    .chart-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .chart-tab-btn {
        width: 100%;
        padding: 12px;
    }
}

/* Responsive Calculator Grid */
@media (max-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .input-section,
    .results-section {
        max-width: 100%;
    }
}

/* Mobile-Friendly Form Elements */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    input[type="number"],
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Tooltip Enhancements for Mobile */
.info-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 8px;
}

.info-tooltip .tooltip-content {
    visibility: hidden;
    width: 280px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -140px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.info-tooltip .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.info-tooltip:hover .tooltip-content,
.info-tooltip:active .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Mobile: Show tooltip on tap */
@media (max-width: 768px) {
    .info-tooltip .tooltip-content {
        width: 90vw;
        max-width: 320px;
        left: 50%;
        transform: translateX(-50%);
        margin-left: 0;
    }
}

/* Help Section Styling */
.help-section {
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.help-section h4 {
    color: #1B5E20;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.help-section p {
    color: #333;
    line-height: 1.6;
    margin-bottom: 8px;
}

.help-section ul {
    margin-left: 20px;
    color: #333;
}

.help-section li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Inflation Impact Indicator */
.inflation-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #FFF3E0;
    border-radius: 8px;
    margin: 12px 0;
}

.inflation-indicator .icon {
    font-size: 1.5rem;
}

.inflation-indicator .text {
    flex: 1;
    font-size: 0.9rem;
    color: #E65100;
}

/* Calculation Methodology Box */
.methodology-box {
    background: #F5F5F5;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.methodology-box h5 {
    color: #1B5E20;
    margin-bottom: 8px;
    font-size: 1rem;
}

.methodology-box code {
    display: block;
    background: white;
    padding: 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    margin: 8px 0;
    overflow-x: auto;
}

/* Responsive Educational Content */
@media (max-width: 768px) {
    .educational-content {
        padding: 24px 16px;
    }
    
    .content-section {
        padding: 20px 16px;
    }
    
    .content-section h3 {
        font-size: 1.5rem;
    }
    
    .content-section h4 {
        font-size: 1.2rem;
    }
}

/* Chart Legend Improvements */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin: 16px 0;
    padding: 12px;
    background: #F5F5F5;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-label {
    font-size: 0.9rem;
    color: #333;
}

@media (max-width: 480px) {
    .chart-legend {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Comparison Mode Styling */
.comparison-mode {
    background: white;
    border: 2px solid #2E7D32;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.comparison-card {
    background: #F5F5F5;
    padding: 16px;
    border-radius: 8px;
}

/* Scenario Analysis */
.scenario-analysis {
    background: #E3F2FD;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.scenario-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.scenario-tab {
    padding: 10px 16px;
    background: white;
    border: 2px solid #1976D2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.scenario-tab.active {
    background: #1976D2;
    color: white;
}

.scenario-tab:hover {
    background: #1976D2;
    color: white;
}

@media (max-width: 768px) {
    .scenario-tabs {
        flex-direction: column;
    }
    
    .scenario-tab {
        width: 100%;
        text-align: center;
    }
}

/* Loading States */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles */
button:focus,
input:focus,
select:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .result-card,
    .content-section {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Optimizations */
@media print {
    .chart-container {
        height: 300px;
        page-break-inside: avoid;
    }
    
    .breakdown-table {
        page-break-inside: avoid;
    }
    
    .result-card {
        page-break-inside: avoid;
    }
}
.withdrawal-cell {
    color: #D32F2F;
    font-weight: 500;
}

.real-value-cell {
    color: #7B1FA2;
    font-weight: 500;
    font-style: italic;
}
