/* CSS Reset and Base Styles */
.sip-calculator-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sip-calculator-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #111827;
    background: #ffffff;
    max-width: 100%;
    overflow-x: hidden;
    padding: 1rem;
}

/* Title Section */
.sip-title-container {
    background: #2CEC00;
    color: #ffffff;
    text-align: center;
    padding: 2rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sip-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.sip-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Calculator Card */
.sip-calculator-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

/* Input Section */
.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.input-group input {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #ffffff;
    min-height: 44px; /* Touch-friendly */
}

.input-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group input:invalid {
    border-color: #dc2626;
}

.error-message {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* Advanced Options */
.advanced-options {
    margin-bottom: 1.5rem;
}

.advanced-toggle {
    width: 100%;
    padding: 0.75rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    min-height: 44px;
    transition: all 0.2s;
}

.advanced-toggle:hover {
    border-color: #2563eb;
}

.toggle-icon {
    transition: transform 0.2s;
}

.advanced-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 1rem;
    padding: 1rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
}

/* Buttons */
.button-group {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.primary-button {
    background: #22c55e;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 44px;
    min-width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-button:hover {
    background: #16a34a;
}

.secondary-button {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 44px;
}

.secondary-button:hover {
    background: #1d4ed8;
}

.loading-spinner {
    display: none;
    font-size: 0.875rem;
}

/* Results Section */
.sip-results-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
}

.loading-indicator {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 3px solid #e5e7eb;
    border-top: 3px solid #22c55e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.summary-card h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-card .amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

/* Progress Bar */
.progress-section {
    margin-bottom: 2rem;
}

.progress-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.progress-bar {
    display: flex;
    height: 2.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #e5e7eb;
}

.progress-fill {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    transition: width 0.3s ease;
    padding: 0 0.5rem;
    text-align: center;
}

.progress-fill.investment {
    background: #2563eb;
}

.progress-fill.returns {
    background: #22c55e;
}

/* Charts Section */
.charts-section {
    margin-bottom: 2rem;
}

.charts-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.chart-wrapper {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    height: 300px;
}

/* Detailed Breakdown */
.detailed-breakdown {
    margin-bottom: 2rem;
}

.detailed-breakdown h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item .label {
    font-size: 0.875rem;
    color: #6b7280;
}

.breakdown-item .value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
}

/* Timeline/Table */
.timeline-section {
    margin-bottom: 2rem;
}

.timeline-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #374151;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.sip-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px; /* Ensure horizontal scroll on mobile */
}

.sip-table thead {
    background: #f9fafb;
}

.sip-table th {
    padding: 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.sip-table td {
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    color: #6b7280;
    border-bottom: 1px solid #f3f4f6;
}

.sip-table tr:last-child td {
    border-bottom: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Responsive Design */
@media (min-width: 481px) {
    .sip-title {
        font-size: 2rem;
    }
    
    .summary-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) {
    .sip-calculator-container {
        padding: 2rem;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .sip-title {
        font-size: 2.25rem;
    }
    
    .input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .summary-card {
        padding: 1.25rem;
    }
    
    .summary-card h3 {
        font-size: 1rem;
    }
    
    .summary-card .amount {
        font-size: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .sip-calculator-card {
        padding: 2rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 360px) {
    .sip-calculator-container {
        padding: 0.5rem;
    }
    
    .sip-title-container {
        padding: 1.5rem 0.5rem;
    }
    
    .sip-title {
        font-size: 1.5rem;
    }
    
    .sip-calculator-card {
        padding: 1rem;
    }
    
    .primary-button,
    .secondary-button {
        width: 100%;
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .secondary-button {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .sip-calculator-container {
        padding: 0;
    }
    
    .primary-button,
    .secondary-button,
    .advanced-toggle,
    .input-group input {
        display: none;
    }
    
    .sip-title-container {
        background: #2CEC00 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .sip-calculator-card {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    
    .summary-cards,
    .detailed-breakdown,
    .timeline-section {
        break-inside: avoid;
    }
    
    .chart-wrapper {
        height: 250px;
    }
}