/* 
 * Net Worth Calculator - Style.css
 * Mobile-first responsive design
 */

/* ===== RESET & BASE STYLES ===== */
.nwc-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* ===== TITLE SECTION ===== */
.nwc-title-container {
    background-color: #2CEC00;
    color: #ffffff;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0;
    width: 100%;
}

.nwc-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.nwc-subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* ===== INPUT SECTION ===== */
.nwc-input-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
}

.nwc-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}

/* Mobile-first: Single column layout */
.nwc-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.nwc-column {
    width: 100%;
}

.nwc-input-group {
    margin-bottom: 1rem;
}

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

.nwc-input-wrapper {
    position: relative;
    width: 100%;
}

.nwc-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #ffffff;
    color: #111827;
    transition: border-color 0.15s ease;
    min-height: 44px; /* Touch-friendly */
}

.nwc-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.nwc-input::placeholder {
    color: #9ca3af;
}

/* Advanced Options */
.nwc-advanced-toggle {
    margin: 1.5rem 0;
    text-align: center;
}

.nwc-toggle-btn {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 44px;
    transition: all 0.15s ease;
}

.nwc-toggle-btn:hover {
    background-color: #f3f4f6;
}

.nwc-toggle-icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.nwc-advanced-options {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: none;
}

.nwc-advanced-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}

/* Action Buttons */
.nwc-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.nwc-btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.nwc-btn-primary {
    background-color: #22c55e;
    color: #ffffff;
}

.nwc-btn-primary:hover {
    background-color: #16a34a;
}

.nwc-btn-secondary {
    background-color: #2563eb;
    color: #ffffff;
}

.nwc-btn-secondary:hover {
    background-color: #1d4ed8;
}

/* Loading Indicator */
.nwc-loading {
    text-align: center;
    padding: 2rem;
    display: none;
}

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

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

/* ===== RESULTS SECTION ===== */
.nwc-results-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem 1rem;
    margin-top: 1.5rem;
    display: none;
}

.nwc-results-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #111827;
}

/* Summary Cards */
.nwc-summary-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.nwc-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.nwc-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.nwc-card-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
}

.nwc-total-card .nwc-card-value {
    color: #22c55e;
}

.nwc-assets-card .nwc-card-value {
    color: #2563eb;
}

.nwc-liabilities-card .nwc-card-value {
    color: #ef4444;
}

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

.nwc-progress-container {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.nwc-progress-bar {
    height: 1rem;
    background-color: #f3f4f6;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.nwc-progress-fill {
    height: 100%;
    background-color: #22c55e;
    border-radius: 9999px;
    width: 0%;
    transition: width 1s ease;
}

.nwc-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Charts Section */
.nwc-charts-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.nwc-chart-container {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    height: 300px !important; /* Fixed height for charts */
}

.nwc-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Breakdown Section */
.nwc-breakdown-section {
    margin-bottom: 2rem;
}

.nwc-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

.nwc-breakdown-table {
    width: 100%;
    min-width: 600px; /* Minimum width for horizontal scroll */
    border-collapse: collapse;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.nwc-breakdown-table th,
.nwc-breakdown-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.nwc-breakdown-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

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

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

.nwc-timeline-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.nwc-timeline-table th,
.nwc-timeline-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.nwc-timeline-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

/* Export Actions */
.nwc-export-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* ===== TABLET STYLES (481px - 768px) ===== */
@media (min-width: 481px) {
    .nwc-title {
        font-size: 2rem;
    }
    
    .nwc-input-section,
    .nwc-results-section {
        padding: 2rem;
    }
    
    .nwc-action-buttons {
        flex-direction: row;
    }
    
    .nwc-btn {
        width: auto;
        flex: 1;
    }
    
    .nwc-summary-cards {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .nwc-card {
        flex: 1;
        min-width: calc(50% - 0.5rem);
    }
    
    .nwc-export-actions {
        flex-direction: row;
    }
}

/* ===== DESKTOP STYLES (> 768px) ===== */
@media (min-width: 769px) {
    .nwc-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 1rem;
    }
    
    .nwc-title-container {
        border-radius: 0.5rem;
        margin-bottom: 2rem;
    }
    
    .nwc-grid {
        flex-direction: row;
        gap: 2rem;
    }
    
    .nwc-column {
        flex: 1;
    }
    
    .nwc-advanced-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .nwc-charts-section {
        flex-direction: row;
    }
    
    .nwc-chart-container {
        flex: 1;
    }
    
    .nwc-card {
        min-width: auto;
    }
}

/* ===== SMALL MOBILE STYLES (≤ 360px) ===== */
@media (max-width: 360px) {
    .nwc-title {
        font-size: 1.5rem;
    }
    
    .nwc-subtitle {
        font-size: 0.875rem;
    }
    
    .nwc-card-value {
        font-size: 1.5rem;
    }
    
    .nwc-chart-container {
        height: 250px !important;
    }
    
    .nwc-input,
    .nwc-btn {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .nwc-container {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
    
    .nwc-title-container {
        background-color: #000000 !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .nwc-btn,
    .nwc-toggle-btn,
    .nwc-export-actions {
        display: none !important;
    }
    
    .nwc-chart-container {
        height: 200px !important;
        page-break-inside: avoid;
    }
    
    .nwc-table-container {
        overflow-x: visible;
        min-width: 100%;
    }
    
    .nwc-breakdown-table,
    .nwc-timeline-table {
        min-width: 100%;
    }
}

/* ===== ACCESSIBILITY ===== */
.nwc-input:focus-visible,
.nwc-btn:focus-visible,
.nwc-toggle-btn:focus-visible {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

.nwc-input[aria-invalid="true"] {
    border-color: #ef4444;
}

.nwc-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

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