/* Shared CSS for both mobile and desktop interfaces */

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body, "Outfit", "Segoe UI", sans-serif);
    line-height: 1.6;
    color: var(--ink, #132019);
}

/* Basel III Credit Score Display Styles */
.basel-metrics-display {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.basel-metric {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.basel-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.basel-value {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
}

.score-number {
    font-size: 3em;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin-top: 70px;
    margin-bottom: 10px;
}

.score-status {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
}

.credit-score-display {
    text-align: center;
    margin: 40px 0 40px 0;
    padding: 40px 20px 30px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.score-breakdown {
    margin: 10px 0;
}

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

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

.breakdown-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.breakdown-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
}

/* Common button styles */
.btn {
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

/* Common form styles */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.form-input, .form-select {
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.3s ease;
    font-size: 14px;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Loading states */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Workflow status indicators */
.workflow-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ddd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.workflow-status.active {
    background: #1976D2;
}

.workflow-status.completed {
    background: #4CAF50;
}

/* Credit score display */
.credit-score {
    font-size: 48px;
    font-weight: 700;
    color: #4CAF50;
}

.credit-rating {
    font-size: 18px;
    color: #666;
}

/* Results grid */
.results-grid {
    display: grid;
    gap: 15px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.result-label {
    font-weight: 600;
    color: #333;
}

.result-value {
    font-weight: 700;
    color: #4CAF50;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-15 {
    margin-bottom: 15px;
}

.mt-20 {
    margin-top: 20px;
}

/* Animation helpers */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===== FARMER EXPLANATION COMPONENT STYLES ===== */

.farmer-explanation-wrapper {
    margin-top: 25px;
}

.farmer-explanation-panel {
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #ddd;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.farmer-explanation-header {
    background: #4CAF50;
    color: white;
    padding: 20px;
    position: relative;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.farmer-explanation-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.header-subtitle {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
    font-style: italic;
}

.language-toggle {
    display: flex;
    gap: 5px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #4CAF50;
    font-weight: 600;
}

.farmer-explanation-content {
    padding: 0;
}

.farmer-section {
    border-bottom: 1px solid #e0e0e0;
    padding: 20px;
}

.farmer-section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.section-icon {
    font-size: 1.2em;
}

.section-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #2E7D32;
}

/* Credit Summary Section */
.credit-summary {
    background: #fff;
}

.credit-display {
    text-align: center;
    padding: 15px;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 8px;
    border: 2px solid rgba(76, 175, 80, 0.2);
}

.credit-score-large {
    font-size: 2.2em;
    font-weight: 700;
    color: #2E7D32;
    margin-bottom: 8px;
}

.credit-description {
    font-size: 1em;
    color: #555;
    font-weight: 500;
    line-height: 1.4;
}

/* Conditions Section */
.conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.condition-icon {
    font-size: 1.1em;
}

.condition-text {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.condition-status {
    font-size: 1.1em;
}

/* Recommendations Section */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recommendation-item {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    padding: 15px;
    transition: all 0.3s ease;
}

.recommendation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rec-icon {
    font-size: 1.2em;
}

.rec-title {
    flex: 1;
    font-weight: 600;
    color: #2E7D32;
    font-size: 1em;
}

.rec-priority {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

.rec-priority.high {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.rec-priority.medium {
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffecb3;
}

.rec-priority.low {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.rec-description {
    color: #555;
    font-size: 0.95em;
    line-height: 1.4;
    margin-bottom: 8px;
}

.rec-timeline {
    color: #777;
    font-size: 0.85em;
    font-style: italic;
}

/* Waiting/Loading State */
.waiting-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: #666;
    font-size: 1em;
}

.loading-icon {
    font-size: 1.2em;
    animation: spin 2s linear infinite;
}

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

/* Error State */
.error-message {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
    background: #ffebee;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
    font-weight: 500;
    margin: 15px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .farmer-explanation-header {
        padding: 15px;
    }
    
    .header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .language-toggle {
        align-self: flex-end;
    }
    
    .farmer-section {
        padding: 15px;
    }
    
    .conditions-grid {
        grid-template-columns: 1fr;
    }
    
    .condition-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }
    
    .rec-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .rec-priority {
        align-self: flex-start;
    }
    
    .credit-score-large {
        font-size: 1.8em;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .farmer-explanation-panel {
        border-width: 3px;
    }
    
    .condition-item, .recommendation-item {
        border-width: 2px;
    }
    
    .lang-btn {
        border-width: 2px;
    }
}