/* Credit Risk & Lending Analysis Module - Professional Financial SaaS Version */

/* ===== EDITORIAL HERO HEADER ===== */
.crl-hero-header {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #283548 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--liq-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.crl-hero-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -5%;
    width: 40%;
    height: 180%;
    background: radial-gradient(ellipse at 80% 20%, rgba(74, 144, 128, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.crl-hero-header h3 {
    margin: 0 0 0.2rem 0;
    font-family: var(--liq-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.crl-hero-header p {
    margin: 0;
    opacity: 0.6;
    font-family: var(--liq-font-body);
    font-size: 0.875rem;
    position: relative;
    z-index: 1;
}

/* ===== MAIN WRAPPER ===== */
.credit-risk-lending-wrapper {
    padding: 0.625rem;
    font-family: var(--liq-font-body);
    background: var(--liq-surface);
    border-radius: 6px;
    margin: 0.5rem 0;
    border: 1px solid var(--liq-border-light);

    max-width: 1200px; /* Maximum width for readability */
    margin: 0 auto; /* Center the content */}

.credit-risk-lending-wrapper .content-section-title {
    color: var(--liq-text);
    font-size: 1.05rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== MODULE ACTIONS ===== */
.credit-risk-lending-wrapper .module-actions-container {
    background: var(--liq-bg);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.625rem;
    border: 1px solid var(--liq-border-light);
}

.credit-risk-lending-wrapper .module-action-btn {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    color: var(--liq-text);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.credit-risk-lending-wrapper .module-action-btn:hover {
    background: var(--liq-bg);
    border-color: var(--liq-border);
}

/* ===== MODULE PLACEHOLDER ===== */
.credit-risk-lending-wrapper .module-placeholder {
    background: var(--liq-bg);
    color: var(--liq-text-muted);
    border-radius: 6px;
    margin: 0.45rem 0;
    border: 1px solid var(--liq-border-light);
    padding: 0.5rem;
}

/* ===== TABS CONTAINER ===== */
.crl-tabs-container {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
}

.crl-tabs-header {
    border-bottom: 1px solid var(--liq-border-light);
    background: var(--liq-bg);
}

.crl-tab-button {
    transition: background 0.2s ease;
}

.crl-tab-button:hover {
    background: var(--liq-accent-light) !important;
    color: var(--liq-accent) !important;
}

.crl-tabs-content {
    background: var(--liq-surface);
}

/* ===== CREDIT SCORE CARD ===== */
.crl-credit-score-card {
    background: var(--liq-surface) !important;
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
}

.crl-credit-score-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* ===== METRIC CARDS ===== */
.crl-metric-card {
    background: var(--liq-surface) !important;
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
}

.crl-metric-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* ===== TAB CONTENT ===== */
.crl-tab-content > div {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
}

/* ===== LOAN TERMS INTERFACE ===== */
.loan-general-section,
.loan-covenants-section,
.debt-accounts-section {
    background: var(--liq-surface) !important;
    border: 1px solid var(--liq-border-light) !important;
    border-radius: 6px;
}

.loan-terms-interface input {
    transition: all 0.2s ease;
    background: var(--liq-surface);
    border: 1px solid var(--liq-border);
    border-radius: 4px;
}

.loan-terms-interface input:focus {
    outline: none;
    border-color: var(--liq-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.debt-rate-input,
.debt-payment-input {
    background: var(--liq-surface) !important;
    font-family: var(--liq-font-mono);
    font-variant-numeric: tabular-nums;
}

.debt-rate-input:focus,
.debt-payment-input:focus {
    border-color: var(--liq-accent) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .credit-risk-lending-wrapper {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 6px;
    }

    .credit-risk-lending-wrapper .content-section-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .crl-tabs-header {
        flex-direction: column;
    }

    .crl-tab-button {
        flex: none;
        padding: 0.75rem;
        text-align: left;
    }

    .crl-tabs-content {
        padding: 1rem;
    }

    .crl-credit-score-card {
        padding: 1rem !important;
    }

    .crl-metric-card {
        padding: 1rem !important;
    }

    .loan-general-section,
    .loan-covenants-section,
    .debt-accounts-section {
        padding: 0.75rem !important;
        margin-bottom: 1rem;
    }

    .loan-terms-interface {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
}

@media (max-width: 480px) {
    .credit-risk-lending-wrapper {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }

    .credit-risk-lending-wrapper .content-section-title {
        font-size: 0.95rem;
        flex-direction: column;
        text-align: center;
        gap: 0.375rem;
    }

    .crl-credit-score-card,
    .crl-metric-card {
        padding: 0.75rem !important;
    }

    .crl-tabs-content {
        padding: 0.75rem;
    }

    /* Stack grid columns on mobile */
    .crl-tab-content div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .loan-general-section div[style*="grid-template-columns"],
    .loan-covenants-section div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .credit-risk-lending-wrapper {
        background: white;
        border: 1px solid var(--liq-border);
        margin: 0;
        padding: 0.75rem;
    }

    .credit-risk-lending-wrapper .content-section-title {
        color: var(--liq-text);
    }

    .credit-risk-lending-wrapper .module-actions-container {
        display: none;
    }

    .crl-credit-score-card,
    .crl-metric-card,
    .crl-tab-content > div,
    .loan-general-section,
    .loan-covenants-section,
    .debt-accounts-section {
        background: white !important;
        border: 1px solid var(--liq-border) !important;
        page-break-inside: avoid;
    }

    .crl-tabs-container {
        background: transparent;
        border: none;
    }

    .crl-tabs-header {
        display: none;
    }

    .crl-tab-content {
        display: block !important;
        background: transparent;
        padding: 0;
    }
}

/* ===== COMPACT OVERRIDES (tame inline styles from JS) ===== */

/* Credit score card — reduce padding and oversized score text */
.crl-credit-score-card {
    padding: 14px !important;
    margin-bottom: 14px !important;
}

.crl-credit-score-card div[style*="font-size: 2rem"],
.crl-credit-score-card div[style*="font-size: 2.5rem"] {
    font-size: 1.15rem !important;
}

.crl-credit-score-card div[style*="font-size: 1.8rem"] {
    font-size: 1rem !important;
}

.crl-credit-score-card div[style*="margin-bottom: 16px"] {
    margin-bottom: 10px !important;
}

/* Metric cards — reduce padding, gaps, value font sizes */
.crl-metric-card {
    padding: 12px !important;
}

.crl-metric-card div[style*="gap: 12px"] {
    gap: 8px !important;
}

.crl-metric-card div[style*="margin-bottom: 12px"] {
    margin-bottom: 8px !important;
}

.crl-metric-card div[style*="font-size: 1.5rem"] {
    font-size: 1rem !important;
}

/* Metric card grids — tighter grid and gap */
.credit-risk-lending-wrapper div[style*="minmax(250px"] {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 10px !important;
}

.credit-risk-lending-wrapper div[style*="minmax(200px"] {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 10px !important;
}

/* Tabs content area — reduce padding */
.crl-tabs-content {
    padding: 14px !important;
}

/* Section cards inside tabs — reduce padding and margins */
.credit-risk-lending-wrapper .crl-tab-content > div[style*="padding: 24px"] {
    padding: 14px !important;
}

.credit-risk-lending-wrapper .crl-tab-content > div[style*="padding: 20px"],
.credit-risk-lending-wrapper div[style*="padding: 20px"] {
    padding: 12px !important;
}

.credit-risk-lending-wrapper div[style*="margin-bottom: 24px"] {
    margin-bottom: 14px !important;
}

.credit-risk-lending-wrapper div[style*="margin-bottom: 20px"] {
    margin-bottom: 12px !important;
}

/* Section title h4s inside content — tighter margins */
.credit-risk-lending-wrapper h4[style*="margin: 0 0 20px"] {
    margin: 0 0 10px 0 !important;
}

.credit-risk-lending-wrapper h4[style*="margin: 0 0 16px"] {
    margin: 0 0 8px 0 !important;
}

.credit-risk-lending-wrapper h4[style*="font-size: 1.2rem"] {
    font-size: 1rem !important;
}

/* Gap overrides for 24px and 16px inline gaps */
.credit-risk-lending-wrapper div[style*="gap: 24px"] {
    gap: 14px !important;
}

.credit-risk-lending-wrapper div[style*="gap: 16px"] {
    gap: 10px !important;
}

/* Loan capacity headline numbers */
.credit-risk-lending-wrapper div[style*="font-size: 2.5rem"] {
    font-size: 1.15rem !important;
}

.credit-risk-lending-wrapper div[style*="font-size: 1.8rem"] {
    font-size: 1rem !important;
}

.credit-risk-lending-wrapper div[style*="font-size: 1.3rem"] {
    font-size: 1.1rem !important;
}

/* Insight/capacity info boxes — tighter padding */
.credit-risk-lending-wrapper div[style*="padding: 16px; background: #f0f9ff"],
.credit-risk-lending-wrapper div[style*="padding: 16px; background: #f0fdf4"],
.credit-risk-lending-wrapper div[style*="padding: 16px; background: #fefce8"] {
    padding: 10px !important;
}

/* Covenant compliance section padding */
.credit-risk-lending-wrapper div[style*="padding: 20px"][style*="border-left: 4px"] {
    padding: 12px !important;
}

.credit-risk-lending-wrapper div[style*="margin-bottom: 12px"] {
    margin-bottom: 8px !important;
}

/* Covenant grid inner gaps */
.credit-risk-lending-wrapper div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    gap: 10px !important;
}

/* Score legend padding in credit score center box */
.credit-risk-lending-wrapper div[style*="padding: 20px; background: #f8fafc"] {
    padding: 10px !important;
}

/* Loan terms interface sections */
.loan-general-section,
.loan-covenants-section,
.debt-accounts-section {
    padding: 10px !important;
    margin-bottom: 10px !important;
}

/* Empty state padding */
.credit-risk-lending-wrapper div[style*="padding: 40px 20px"] {
    padding: 24px 14px !important;
}

/* Disclaimer/warning boxes */
.credit-risk-lending-wrapper div[style*="margin-top: 16px; padding: 12px"] {
    margin-top: 10px !important;
    padding: 8px !important;
}

/* ===== ACCESSIBILITY ===== */
.credit-risk-lending-wrapper button:focus,
.loan-terms-interface input:focus,
.debt-rate-input:focus,
.debt-payment-input:focus {
    outline: 2px solid var(--liq-accent);
    outline-offset: 2px;
}
