/* Loan Assessment Page Styles */

/* Search Section */
.search-section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.search-section h2 {
    color: #2B3C6B;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.search-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: 500px;
}

.search-input-group .form-control {
    font-size: 1.1rem;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
}

.search-input-group .form-control:focus {
    border-color: #445082;
    box-shadow: 0 0 0 0.2rem rgba(68, 80, 130, 0.15);
}

.search-input-group .btn-primary {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    background-color: #445082;
    border-color: #445082;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-input-group .btn-primary:hover {
    background-color: #3a4370;
    border-color: #3a4370;
}

/* Loading State */
.assessment-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #6c757d;
}

.assessment-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 16px;
}

/* Results Container */
.assessment-results {
    display: none;
}

/* Hero Card - Risk Summary */
.hero-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.hero-title {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-title h3 {
    color: #2B3C6B;
    font-weight: 600;
    margin: 0;
    font-size: 1.3rem;
}

.hero-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Risk Tier Badges */
.risk-tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-tier-badge.very-high {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.risk-tier-badge.high {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.risk-tier-badge.medium {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
    border: 2px solid #fcd34d;
}

.risk-tier-badge.low {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
    border: 2px solid #6ee7b7;
}

/* Recommended Action Badge */
.action-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.action-badge i {
    margin-right: 8px;
}

.action-badge.refer {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.action-badge.approve {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.action-badge.decline {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* Confidence Badge */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #f3f4f6;
    color: #6b7280;
}

/* Summary Section */
.hero-summary {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 16px;
    border-left: 4px solid #445082;
}

.hero-summary p {
    margin: 0;
    color: #495057;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Section Cards */
.section-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.section-header h4 {
    margin: 0;
    color: #2B3C6B;
    font-weight: 600;
    font-size: 1.1rem;
}

.section-header .badge {
    font-size: 0.75rem;
}

/* Risk Flags Accordion */
.risk-flags-container {
    padding: 0;
}

.risk-flag-item {
    border-bottom: 1px solid #e5e7eb;
}

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

.risk-flag-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    gap: 12px;
}

.risk-flag-header:hover {
    background-color: #f8f9fa;
}

.risk-flag-header.collapsed .expand-icon {
    transform: rotate(0deg);
}

.expand-icon {
    color: #6c757d;
    transition: transform 0.2s ease;
    transform: rotate(90deg);
    flex-shrink: 0;
}

.severity-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.severity-badge.high {
    background: #fee2e2;
    color: #991b1b;
}

.severity-badge.medium {
    background: #fef3c7;
    color: #92400e;
}

.severity-badge.low {
    background: #d1fae5;
    color: #065f46;
}

.risk-flag-title {
    flex: 1;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.flag-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #e5e7eb;
    color: #6b7280;
    flex-shrink: 0;
}

/* Risk Flag Details */
.risk-flag-details {
    padding: 0 20px 20px 20px;
    background: #fafbfc;
    border-top: 1px solid #e5e7eb;
}

.evidence-section {
    margin-top: 16px;
}

.evidence-section h6 {
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Evidence Table */
.evidence-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.evidence-table th {
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.evidence-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    vertical-align: top;
}

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

.evidence-table .metric-name {
    font-weight: 500;
    color: #2B3C6B;
}

.evidence-table .metric-value {
    font-weight: 600;
}

.evidence-table .metric-value.negative {
    color: #dc2626;
}

.evidence-table .metric-value.positive {
    color: #059669;
}

.evidence-table .delta-negative {
    color: #dc2626;
    font-weight: 500;
}

.evidence-table .delta-positive {
    color: #059669;
    font-weight: 500;
}

.evidence-table .notes-cell {
    color: #6b7280;
    font-size: 0.8rem;
    font-style: italic;
}

/* Interpretation Box */
.interpretation-box {
    background: white;
    border-radius: 6px;
    padding: 14px 16px;
    margin-top: 16px;
    border-left: 3px solid #445082;
}

.interpretation-box p {
    margin: 0;
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Verification Checklist */
.verification-section {
    margin-top: 16px;
}

.verification-section h6 {
    color: #059669;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.verification-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.verification-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    color: #374151;
    font-size: 0.9rem;
}

.verification-list li i {
    color: #10b981;
    margin-top: 3px;
    flex-shrink: 0;
}

/* Dealer Context Card */
.dealer-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.dealer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.dealer-header h4 {
    margin: 0;
    color: #2B3C6B;
    font-weight: 600;
    font-size: 1rem;
}

.dealer-classification {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.dealer-classification.positive {
    background: #d1fae5;
    color: #065f46;
}

.dealer-classification.neutral {
    background: #f3f4f6;
    color: #6b7280;
}

.dealer-classification.negative {
    background: #fee2e2;
    color: #991b1b;
}

.dealer-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 20px;
}

.dealer-metric {
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.dealer-metric .metric-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.dealer-metric .metric-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2B3C6B;
}

.dealer-metric .metric-delta {
    font-size: 0.8rem;
    margin-top: 4px;
}

.dealer-metric .metric-delta.positive {
    color: #059669;
}

.dealer-metric .metric-delta.negative {
    color: #dc2626;
}

/* Conditions Panel */
.conditions-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    border-left: 4px solid #f59e0b;
}

.conditions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #fffbeb;
    border-bottom: 1px solid #fcd34d;
}

.conditions-header i {
    color: #f59e0b;
}

.conditions-header h4 {
    margin: 0;
    color: #92400e;
    font-weight: 600;
    font-size: 1rem;
}

.conditions-list {
    list-style: none;
    padding: 20px;
    margin: 0;
}

.conditions-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    font-size: 0.9rem;
}

.conditions-list li:last-child {
    border-bottom: none;
}

.conditions-list li i {
    color: #f59e0b;
    margin-top: 3px;
    flex-shrink: 0;
}

.conditions-rationale {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
}

.conditions-rationale p {
    margin: 0;
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Data Gaps Alert */
.data-gaps-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    border-left: 4px solid #ef4444;
}

.data-gaps-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
}

.data-gaps-header i {
    color: #ef4444;
}

.data-gaps-header h4 {
    margin: 0;
    color: #991b1b;
    font-weight: 600;
    font-size: 1rem;
}

.data-gaps-list {
    padding: 16px 20px;
}

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

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

.data-gap-item .gap-name {
    color: #374151;
    font-size: 0.9rem;
}

.data-gap-item .gap-impact {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.data-gap-item .gap-impact.high {
    background: #fee2e2;
    color: #991b1b;
}

.data-gap-item .gap-impact.medium {
    background: #fef3c7;
    color: #92400e;
}

.data-gap-item .gap-impact.low {
    background: #f3f4f6;
    color: #6b7280;
}

/* Segment Matches Section */
.segment-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.segment-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.segment-header h4 {
    margin: 0;
    color: #2B3C6B;
    font-weight: 600;
    font-size: 1rem;
}

.segment-content {
    padding: 20px;
}

.segment-key {
    font-family: monospace;
    background: #f3f4f6;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 16px;
    display: inline-block;
}

.segment-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.segment-kpi {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
}

.segment-kpi .kpi-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.segment-kpi .kpi-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.segment-kpi .kpi-value.negative {
    color: #dc2626;
}

.segment-kpi .kpi-value.positive {
    color: #059669;
}

.segment-kpi .kpi-value.neutral {
    color: #2B3C6B;
}

/* Two Column Layout for Context */
.context-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

/* Error State */
.error-container {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: #991b1b;
}

.error-container i {
    font-size: 2rem;
    margin-bottom: 12px;
}

.error-container h5 {
    margin-bottom: 8px;
}

.error-container p {
    margin: 0;
    color: #b91c1c;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 8px;
}

/* Decisioning Status Banner */
.decisioning-status-banner {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fca5a5;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.status-banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-banner-icon {
    font-size: 1.5rem;
    color: #dc2626;
}

.status-banner-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-banner-text strong {
    color: #991b1b;
    font-size: 1rem;
}

.status-banner-text span {
    color: #b91c1c;
    font-size: 0.9rem;
}

/* Loan Snapshot Card */
.loan-snapshot-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

.snapshot-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.snapshot-header h4 {
    margin: 0;
    color: #2B3C6B;
    font-weight: 600;
    font-size: 1rem;
}

.snapshot-content {
    padding: 20px;
}

.snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.snapshot-section h6 {
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
}

.snapshot-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.snapshot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.snapshot-label {
    color: #6b7280;
    font-size: 0.85rem;
}

.snapshot-value {
    color: #2B3C6B;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Top Drivers */
.top-drivers-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.top-drivers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top-driver-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.driver-severity {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.driver-severity.high {
    background: #fee2e2;
    color: #991b1b;
}

.driver-severity.medium {
    background: #fef3c7;
    color: #92400e;
}

.driver-severity.low {
    background: #d1fae5;
    color: #065f46;
}

.driver-text {
    color: #374151;
    font-size: 0.9rem;
}

/* Action Type Badges */
.action-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 8px;
    flex-shrink: 0;
}

.action-type-badge.stipulation {
    background: #dbeafe;
    color: #1e40af;
}

.action-type-badge.verification {
    background: #f3e8ff;
    color: #7c3aed;
}

.action-type-badge.refer {
    background: #fef3c7;
    color: #92400e;
}

/* What Would Change Section */
.what-would-change-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e5e7eb;
}

.what-would-change-section h6 {
    color: #2563eb;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.change-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.change-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    color: #374151;
    font-size: 0.85rem;
}

.change-list li i {
    color: #2563eb;
    margin-top: 3px;
    flex-shrink: 0;
}

/* Baseline Type Styling */
.baseline-type {
    font-size: 0.7rem;
    color: #9ca3af;
    font-weight: normal;
}

/* No Cards/Metrics Messages */
.no-cards-message,
.no-metrics {
    padding: 24px;
    text-align: center;
    color: #9ca3af;
    font-style: italic;
}

/* Risk tier badge for moderate */
.risk-tier-badge.moderate {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
    border: 2px solid #fcd34d;
}

/* Unknown risk tier */
.risk-tier-badge.unknown {
    background: #f3f4f6;
    color: #6b7280;
    border: 2px solid #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-header {
        flex-direction: column;
    }

    .hero-badges {
        width: 100%;
    }

    .search-input-group {
        flex-direction: column;
        max-width: 100%;
    }

    .search-input-group .btn-primary {
        width: 100%;
    }

    .context-row {
        grid-template-columns: 1fr;
    }

    .dealer-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .evidence-table {
        display: block;
        overflow-x: auto;
    }

    .snapshot-grid {
        grid-template-columns: 1fr;
    }

    .status-banner-content {
        flex-direction: column;
        text-align: center;
    }
}
