/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: #333;
    min-height: 100vh;
    padding: 15px;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #fc5903, #ff7b39);
    color: white;
    padding: 25px 20px;
    text-align: center;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(252, 89, 3, 0.2);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    opacity: 0.9;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Navigation Styles */
.mobile-nav {
    display: flex;
    background: white;
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.mobile-nav-btn {
    flex: 1;
    padding: 16px 12px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    border: none;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    touch-action: manipulation;
}

.mobile-nav-btn i {
    font-size: 1.2rem;
}

.mobile-nav-btn.active {
    background: #fc5903;
    color: white;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.15);
}

/* Main Content Layout */
.calculator-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.input-section, .result-section {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 0;
}

/* Card Styles */
.card {
    background: white;
    padding: 25px;
    transition: all 0.3s ease;
}

.card-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #fc5903;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f5f5f5;
}

.card-title i {
    background: rgba(252, 89, 3, 0.1);
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fc5903;
    font-size: 1.1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #444;
    font-size: 1rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    color: #fc5903;
    font-size: 1rem;
}

.input-with-icon input, 
.input-with-icon select {
    width: 100%;
    padding: 15px 15px 15px 50px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: #333;
    height: 55px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-with-icon select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em 1.5em;
}

.input-with-icon input:focus, 
.input-with-icon select:focus {
    border-color: #fc5903;
    outline: none;
    box-shadow: 0 0 0 4px rgba(252, 89, 3, 0.2);
}

.advanced-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 25px;
    cursor: pointer;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    font-weight: 600;
    color: #fc5903;
    border: 1px solid #eee;
    font-size: 1rem;
    touch-action: manipulation;
}

.advanced-toggle i {
    transition: all 0.3s ease;
}

.advanced-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.advanced-content.active {
    max-height: 500px;
    margin-top: 15px;
}

/* Results Styles */
.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.result-box {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.result-box h3 {
    font-size: 1.1rem;
    color: #444;
    margin-bottom: 10px;
}

.result-box .value {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fc5903;
    margin: 5px 0;
}

.result-box .label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.chart-container {
    height: 250px;
    margin-top: 20px;
    position: relative;
}

/* Button Styles */
.btn-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 140px;
    padding: 16px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    touch-action: manipulation;
    min-height: 60px;
}

.btn-primary {
    background: #fc5903;
    color: white;
}

.btn-secondary {
    background: #f0f2f5;
    color: #444;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Eligibility Section */
.eligibility-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 1px solid #eee;
    display: none;
}

.eligibility-result {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.eligibility-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.eligibility-card:hover {
    transform: translateY(-5px);
}

.eligibility-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fc5903;
    margin: 10px 0;
}

.eligibility-card .label {
    color: #666;
    font-size: 0.9rem;
}

.success {
    background: rgba(76, 201, 240, 0.1);
    border-color: #4cc9f0;
}

.warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

/* Loading spinner */
.loader {
    display: none;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #fc5903;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animation for section transitions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.input-section, .result-section, .eligibility-section {
    animation: fadeIn 0.5s ease-out;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 992px) {
    .calculator-content {
        flex-direction: column;
    }
    
    .result-grid, .eligibility-result {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.7rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .card-title {
        font-size: 1.3rem;
    }
    
    .result-box .value {
        font-size: 1.5rem;
    }
    
    .input-with-icon input,
    .input-with-icon select {
        padding: 14px 14px 14px 45px;
        font-size: 1rem;
    }
    
    .btn {
        padding: 15px;
        font-size: 1rem;
        min-height: 55px;
    }
    
    .mobile-nav-btn {
        padding: 14px 10px;
        font-size: 0.9rem;
        min-height: 70px;
    }
    
    .eligibility-card .value {
        font-size: 1.4rem;
    }
}

@media (max-width: 576px) {
    body {
        padding: 10px;
    }
    
    .calculator-container {
        padding: 5px;
    }
    
    .header {
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 18px;
    }
    
    .card-title {
        font-size: 1.25rem;
        margin-bottom: 18px;
    }
    
    .card-title i {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .result-grid, .eligibility-result {
        grid-template-columns: 1fr;
    }
    
    .result-box .value {
        font-size: 1.4rem;
    }
    
    .chart-container {
        height: 220px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .input-with-icon input,
    .input-with-icon select {
        padding: 13px 13px 13px 42px;
        font-size: 0.95rem;
        height: 50px;
    }
    
    .btn {
        min-width: 100%;
        padding: 14px;
        font-size: 0.98rem;
        min-height: 52px;
    }
    
    .mobile-nav-btn {
        padding: 14px 10px;
        font-size: 0.9rem;
        min-height: 65px;
    }
    
    .advanced-toggle {
        padding: 13px 15px;
    }
    
    .eligibility-card .value {
        font-size: 1.3rem;
    }
}

@media (max-width: 400px) {
    .header {
        padding: 20px 12px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .card-title i {
        width: 36px;
        height: 36px;
    }
    
    .result-box, .eligibility-card {
        padding: 18px 15px;
    }
    
    .result-box h3, .eligibility-card h3 {
        font-size: 1rem;
    }
    
    .result-box .value {
        font-size: 1.3rem;
    }
    
    .eligibility-card .value {
        font-size: 1.2rem;
    }
    
    .chart-container {
        height: 200px;
    }
    
    .mobile-nav-btn {
        font-size: 0.85rem;
        gap: 5px;
        padding: 12px 8px;
        min-height: 60px;
    }
    
    .mobile-nav-btn i {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 12px;
        font-size: 0.95rem;
        min-height: 50px;
    }
}

/* Reduced Motion Media Query */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .eligibility-card:hover {
        transform: none;
    }
    
    .loader {
        animation: none;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #fc5903;
    }
}