/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f8fafc;
    color: #334155;
    line-height: 1.6;
    padding: 0 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 14px 24px;
    background-color: #e2e8f0;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.mode-btn:hover {
    background-color: #cbd5e1;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Input Section */
.input-section {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.input-group {
    margin-bottom: 30px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.input-group label i {
    margin-right: 10px;
    color: #3b82f6;
}

.value-display {
    font-weight: 700;
    color: #3b82f6;
    font-size: 1.2rem;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    margin: 15px 0;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.input-with-unit {
    display: flex;
    align-items: center;
    margin-top: 15px;
}

.input-with-unit input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    transition: border-color 0.3s;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #3b82f6;
}

.unit {
    background-color: #f1f5f9;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-weight: 600;
    color: #475569;
}

.min-max {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #64748b;
}

/* Results Section */
.results-section {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.results-section h2 {
    margin-bottom: 25px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.result-card {
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
}

.total-invested {
    background-color: #f0f9ff;
    border-left: 5px solid #3b82f6;
}

.estimated-returns {
    background-color: #fef7ff;
    border-left: 5px solid #8b5cf6;
}

.total-value {
    background-color: #f0fdf4;
    border-left: 5px solid #10b981;
}

.result-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #475569;
}

.amount {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #1e293b;
}

.breakdown {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 15px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1rem;
}

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

/* Chart Container */
.chart-container {
    height: 300px;
    margin-top: 20px;
    position: relative;
}

/* Information Section */
.info-section {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.info-section h3 {
    margin-bottom: 20px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-item {
    background-color: #f8fafc;
    padding: 20px;
    border-radius: 8px;
}

.info-item h4 {
    color: #3b82f6;
    margin-bottom: 10px;
}

.info-item p {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.info-item p:last-child {
    margin-bottom: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.9rem;
}

.disclaimer {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #94a3b8;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-btn {
        width: 100%;
        justify-content: center;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .amount {
        font-size: 1.8rem;
    }
    
    .input-section, .results-section, .info-section {
        padding: 20px;
    }
    
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .amount {
        font-size: 1.6rem;
    }
    
    .info-content {
        grid-template-columns: 1fr;
    }
    
    .input-with-unit input {
        padding: 12px;
        font-size: 1rem;
    }
    
    .unit {
        padding: 12px 15px;
    }
}

/* Animation for value updates */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.value-updated {
    animation: pulse 0.5s ease;
}
/* ========== ENHANCED MOBILE & DESKTOP COMPATIBILITY ========== */
/* These styles work alongside existing code without modifications */

/* 1. TOUCH-FRIENDLY INTERACTIVE ELEMENTS */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    .mode-btn,
    .slider::-webkit-slider-thumb,
    .slider::-moz-range-thumb {
        min-height: 44px; /* Apple Human Interface Guidelines minimum */
    }
    
    .input-with-unit input {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Increase spacing for finger-friendly interaction */
    .mode-selector {
        gap: 12px;
    }
    
    .mode-btn {
        padding: 16px 20px;
    }
}

/* 2. SAFE AREA SUPPORT FOR NOTCHED DEVICES */
@supports (padding: max(0px)) {
    body {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
    
    .header,
    .input-section,
    .results-section,
    .info-section {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* 3. IMPROVED LANDSCAPE MODE SUPPORT */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        padding: 10px 0;
    }
    
    .header {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    .input-section,
    .results-section,
    .info-section {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .results-grid {
        gap: 15px;
    }
}

/* 4. ENHANCED READABILITY FOR SMALL SCREENS */
@media (max-width: 360px) {
    .header h1 {
        font-size: 1.4rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .header p {
        font-size: 0.95rem;
    }
    
    .input-group label {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .value-display {
        font-size: 1.1rem;
    }
    
    .amount {
        font-size: 1.5rem;
    }
    
    .result-card {
        padding: 20px 15px;
    }
}

/* 5. PREVENT TEXT SIZE ADJUSTMENT ON MOBILE */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 6. SMOOTHER SCROLLING ON MOBILE */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* 7. IMPROVED FOCUS STATES FOR ACCESSIBILITY */
.mode-btn:focus-visible,
.input-with-unit input:focus-visible,
.slider:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* 8. REDUCED MOTION PREFERENCE */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .mode-btn:hover,
    .result-card:hover {
        transform: none;
    }
}

/* 9. DARK MODE SUPPORT (OPTIONAL ENHANCEMENT) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #cbd5e1;
    }
    
    .input-section,
    .results-section,
    .info-section {
        background-color: #1e293b;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    
    .input-group label {
        color: #e2e8f0;
    }
    
    .input-with-unit input {
        background-color: #334155;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .unit {
        background-color: #475569;
        border-color: #475569;
        color: #cbd5e1;
    }
    
    .min-max {
        color: #94a3b8;
    }
    
    .result-card {
        background-color: #334155;
    }
    
    .total-invested {
        background-color: #1e3a5f;
    }
    
    .estimated-returns {
        background-color: #3c1a5f;
    }
    
    .total-value {
        background-color: #064e3b;
    }
    
    .amount {
        color: #f1f5f9;
    }
    
    .info-item {
        background-color: #334155;
    }
    
    .footer {
        color: #94a3b8;
    }
}

/* 10. TABLET OPTIMIZATION (BETWEEN MOBILE AND DESKTOP) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 20px 15px;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .info-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mode-selector {
        gap: 20px;
    }
    
    .mode-btn {
        padding: 16px 28px;
        font-size: 1.05rem;
    }
}

/* 11. HIGH-DPI DISPLAY OPTIMIZATION */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .header,
    .input-section,
    .results-section,
    .info-section {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .mode-btn {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }
}

/* 12. LARGE DESKTOP OPTIMIZATION */
@media (min-width: 1600px) {
    .container {
        max-width: 1400px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .results-grid {
        gap: 35px;
    }
    
    .chart-container {
        height: 350px;
    }
}

/* 13. FOLDABLE DEVICE SUPPORT */
@media (max-width: 300px) {
    .header h1 {
        font-size: 1.2rem;
    }
    
    .mode-btn span {
        display: none; /* Hide text, keep icon only on very small screens */
    }
    
    .mode-btn i {
        font-size: 1.2rem;
    }
}

/* 14. PRINT STYLES */
@media print {
    .mode-selector,
    .slider,
    .input-with-unit input,
    .footer {
        display: none;
    }
    
    .header,
    .input-section,
    .results-section,
    .info-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background-color: white;
        color: black;
    }
}
