/**
 * FNB Revenue Forecaster v2 - Frontend Styles
 * Modern, responsive design for the forecast form
 */

/* Reset and Base Styles */
.fnb-forecast-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Header Styles */
.fnb-forecast-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.fnb-forecast-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.fnb-forecast-description {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 300;
}

/* Form Section Styles */
.fnb-form-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.fnb-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

.fnb-section-description {
    color: #7f8c8d;
    margin: 0 0 25px 0;
    font-size: 0.95rem;
}

/* Form Row and Group Styles */
.fnb-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.fnb-form-group {
    flex: 1;
    position: relative;
}

.fnb-form-group.fnb-full-width {
    flex: 1 1 100%;
}

/* Form Label Styles */
.fnb-form-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

/* Form Input Styles */
.fnb-form-input,
.fnb-form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.fnb-form-input:focus,
.fnb-form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.fnb-form-input:hover,
.fnb-form-select:hover {
    border-color: #bdc3c7;
}

/* Radio Button Styles */
.fnb-radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.fnb-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #2c3e50;
}

.fnb-radio-label input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.2);
    accent-color: #3498db;
}

.fnb-radio-text {
    font-size: 0.95rem;
}

/* Revenue Grid Styles */
.fnb-revenue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.fnb-revenue-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.fnb-revenue-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.fnb-revenue-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.fnb-revenue-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.fnb-revenue-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Button Styles */
.fnb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 50px;
}

.fnb-btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.fnb-btn-primary:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f5f8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.fnb-btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.fnb-btn-secondary:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #6c7b7d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.fnb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Button Loading State */
.fnb-btn-loading {
    display: none;
}

.fnb-btn.loading .fnb-btn-text {
    display: none;
}

.fnb-btn.loading .fnb-btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fnb-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Fallback Link Styles */
.fnb-fallback-link {
    margin-top: 15px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
}

.fnb-fallback-link .fnb-form-label {
    color: #856404;
    margin-bottom: 10px;
}

/* Error Message Styles */
.fnb-error-message {
    display: none;
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 5px;
    font-weight: 500;
}

.fnb-form-input.error,
.fnb-form-select.error,
.fnb-revenue-input.error {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.fnb-form-input.error + .fnb-error-message,
.fnb-form-select.error + .fnb-error-message,
.fnb-revenue-input.error + .fnb-error-message {
    display: block;
}

/* Results Section Styles */
.fnb-forecast-results {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-top: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fnb-results-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #27ae60;
    margin: 0 0 25px 0;
    text-align: center;
}

/* Results Table Styles */
.fnb-results-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.fnb-results-summary p {
    margin: 0 0 10px 0;
    font-weight: 600;
    color: #2c3e50;
}

.fnb-results-summary ul {
    margin: 0;
    padding-left: 20px;
}

.fnb-results-summary li {
    margin-bottom: 5px;
    color: #7f8c8d;
}

.fnb-forecast-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.fnb-forecast-table th {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.fnb-forecast-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    color: #2c3e50;
}

.fnb-forecast-table tr:hover {
    background: #f8f9fa;
}

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

/* Change Percentage Styles */
.change-positive {
    color: #27ae60;
    font-weight: 600;
}

.change-negative {
    color: #e74c3c;
    font-weight: 600;
}

/* Error Display Styles */
.fnb-error-display {
    background: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.fnb-error-content h4 {
    color: #dc2626;
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.fnb-error-content p {
    color: #7f1d1d;
    margin: 0;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fnb-forecast-container {
        padding: 15px;
    }
    
    .fnb-forecast-title {
        font-size: 2rem;
    }
    
    .fnb-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .fnb-form-section {
        padding: 20px;
    }
    
    .fnb-revenue-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .fnb-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .fnb-radio-group {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .fnb-forecast-header {
        padding: 20px 15px;
    }
    
    .fnb-forecast-title {
        font-size: 1.8rem;
    }
    
    .fnb-forecast-description {
        font-size: 1rem;
    }
    
    .fnb-form-section {
        padding: 15px;
    }
    
    .fnb-forecast-table {
        font-size: 0.9rem;
    }
    
    .fnb-forecast-table th,
    .fnb-forecast-table td {
        padding: 8px 6px;
    }
}

/* Loading and Success States */
.fnb-form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.fnb-form-success {
    border-color: #27ae60;
    background: #f0f9ff;
}

/* Accessibility Improvements */
.fnb-form-input:focus,
.fnb-form-select:focus,
.fnb-revenue-input:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.fnb-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .fnb-forecast-container {
        border: 2px solid #000;
    }
    
    .fnb-form-input,
    .fnb-form-select,
    .fnb-revenue-input {
        border-width: 2px;
    }
}

/* Print Styles */
@media print {
    .fnb-forecast-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .fnb-btn {
        display: none;
    }
    
    .fnb-forecast-results {
        break-inside: avoid;
    }
}

/* Chart Container Styles */
.fnb-chart-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.fnb-chart-container h3 {
    color: #2c3e50;
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
}

#fnb-revenue-chart {
    max-height: 400px;
    margin: 0 auto;
    display: block;
}

/* Enhanced Table Styles */
.fnb-forecast-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
}

.fnb-forecast-table th {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.fnb-forecast-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    color: #2c3e50;
    vertical-align: middle;
}

.fnb-forecast-table tr:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

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

/* Weather and Confidence Column Styles */
.fnb-forecast-table td:nth-child(3) {
    font-style: italic;
    color: #7f8c8d;
    line-height: 1.4;
    vertical-align: top;
    padding: 15px 12px;
}

.fnb-forecast-table td:nth-child(3) br {
    margin: 5px 0;
}

.fnb-forecast-table td:nth-child(4) {
    font-weight: 600;
    color: #27ae60;
}

.fnb-forecast-table td:nth-child(5) {
    text-align: center;
    font-weight: 500;
    color: #f39c12;
}

/* Responsive Chart */
@media (max-width: 768px) {
    .fnb-chart-container {
        padding: 20px 15px;
    }
    
    #fnb-revenue-chart {
        max-height: 300px;
    }
    
    .fnb-forecast-table {
        font-size: 0.85rem;
    }
    
    .fnb-forecast-table th,
    .fnb-forecast-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .fnb-chart-container {
        padding: 15px 10px;
    }
    
    #fnb-revenue-chart {
        max-height: 250px;
    }
    
    .fnb-forecast-table {
        font-size: 0.8rem;
    }
    
    .fnb-forecast-table th,
    .fnb-forecast-table td {
        padding: 8px 6px;
    }
}
