/* Home Affordability Calculator Pro - Complete CSS */
/* Mobile First Design */

/* Reset and Base Styles */
.hac-pro-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hac-pro-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #111827;
    background-color: #ffffff;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    padding: 10px;
}

/* Title Container */
.hac-pro-title-container {
    background-color: #2CEC00;
    color: #ffffff;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
}

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

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

/* Main Card */
.hac-pro-main-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* Section Titles */
.hac-pro-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #111827;
}

/* Input Grid - Mobile First (1 column) */
.hac-pro-input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Input Groups */
.hac-pro-input-group {
    width: 100%;
}

.hac-pro-input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

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

.hac-pro-input,
.hac-pro-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #111827;
    transition: border-color 0.15s ease;
    min-height: 44px;
}

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

.hac-pro-input-desc {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Advanced Options */
.hac-pro-advanced-toggle {
    margin-bottom: 1.5rem;
}

.hac-pro-advanced-toggle-btn {
    width: 100%;
    padding: 0.875rem;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    transition: all 0.15s ease;
}

.hac-pro-advanced-toggle-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.hac-pro-toggle-icon {
    font-size: 1.25rem;
    transition: transform 0.15s ease;
}

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

/* Buttons */
.hac-pro-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

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

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

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

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

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

/* Loading Indicator */
.hac-pro-loading {
    text-align: center;
    padding: 2rem;
    margin-top: 1rem;
}

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

@keyframes hac-pro-spin {
    to { transform: rotate(360deg); }
}

.hac-pro-loading-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Error Message */
.hac-pro-error-message {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
}

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

.hac-pro-results-header {
    margin-bottom: 1.5rem;
}

.hac-pro-results-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Summary Cards */
.hac-pro-summary-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hac-pro-summary-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.hac-pro-primary-card {
    border-color: #22c55e;
    background-color: #f0fdf4;
}

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

.hac-pro-summary-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.hac-pro-summary-desc {
    font-size: 0.75rem;
    color: #6b7280;
}

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

.hac-pro-progress-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.hac-pro-progress-bar {
    height: 0.75rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

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

.hac-pro-progress-desc {
    font-size: 0.875rem;
    color: #374151;
    margin-top: 0.5rem;
}

/* Charts Container */
.hac-pro-charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.hac-pro-chart-wrapper {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.hac-pro-chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.hac-pro-chart-container {
    position: relative;
    height: 300px !important;
    width: 100% !important;
}

.hac-pro-chart-container canvas {
    width: 100% !important;
    height: 300px !important;
}

/* Details Table */
.hac-pro-details-section {
    margin-bottom: 2rem;
}

.hac-pro-details-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.hac-pro-details-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.hac-pro-details-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

.hac-pro-details-table th {
    font-weight: 600;
    color: #374151;
    background-color: #f9fafb;
}

.hac-pro-details-table td {
    color: #6b7280;
}

.hac-pro-total-row {
    background-color: #f0fdf4;
}

.hac-pro-total-row td {
    font-weight: 600;
    color: #111827;
}

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

.hac-pro-timeline-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.hac-pro-timeline-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.hac-pro-timeline-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

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

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

/* Results Actions */
.hac-pro-results-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

/* Tablet Styles (481px - 768px) */
@media (min-width: 481px) {
    .hac-pro-container {
        padding: 15px;
    }
    
    .hac-pro-title-container {
        padding: 2rem 1.5rem;
    }
    
    .hac-pro-main-title {
        font-size: 2rem;
    }
    
    .hac-pro-main-card {
        padding: 2rem;
    }
    
    .hac-pro-action-buttons {
        flex-direction: row;
    }
    
    .hac-pro-btn {
        width: auto;
        min-width: 160px;
    }
    
    .hac-pro-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hac-pro-primary-card {
        grid-column: span 2;
    }
    
    .hac-pro-results-actions {
        flex-direction: row;
        justify-content: center;
    }
}

/* Desktop Styles (> 768px) */
@media (min-width: 769px) {
    .hac-pro-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .hac-pro-title-container {
        padding: 2.5rem 2rem;
    }
    
    .hac-pro-main-title {
        font-size: 2.25rem;
    }
    
    .hac-pro-input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hac-pro-advanced-content .hac-pro-input-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hac-pro-summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hac-pro-primary-card {
        grid-column: span 1;
    }
    
    .hac-pro-charts-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hac-pro-results-actions {
        gap: 1.5rem;
    }
}

/* Small Mobile (≤ 360px) */
@media (max-width: 360px) {
    .hac-pro-container {
        padding: 5px;
    }
    
    .hac-pro-main-card {
        padding: 1rem;
    }
    
    .hac-pro-section-title {
        font-size: 1.25rem;
    }
    
    .hac-pro-summary-value {
        font-size: 1.5rem;
    }
    
    .hac-pro-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .hac-pro-title-container {
        padding: 1rem;
    }
    
    .hac-pro-main-title {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .hac-pro-action-buttons,
    .hac-pro-advanced-toggle,
    .hac-pro-advanced-content,
    .hac-pro-results-actions,
    .hac-pro-advanced-toggle-btn {
        display: none !important;
    }
    
    .hac-pro-container {
        background-color: #ffffff !important;
        padding: 0 !important;
    }
    
    .hac-pro-main-card {
        border: none !important;
        background-color: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .hac-pro-title-container {
        background-color: #ffffff !important;
        color: #000000 !important;
        border: 2px solid #000000 !important;
        margin-bottom: 20px !important;
    }
    
    .hac-pro-summary-card {
        border: 1px solid #000000 !important;
        break-inside: avoid;
        margin-bottom: 15px !important;
    }
    
    .hac-pro-chart-container canvas {
        max-height: 250px !important;
    }
}

/* Input Error Styles */
.hac-pro-input.error {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

.hac-pro-input-error-message {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Focus Styles for Accessibility */
.hac-pro-btn:focus,
.hac-pro-input:focus,
.hac-pro-select:focus,
.hac-pro-advanced-toggle-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}