/* Risk Intelligence Module CSS */

.risk-intel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    /* Enable scrolling for the whole view */
    padding-bottom: 40px;
    position: relative;
}

/* Header / Search Area */
.risk-search-card {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.risk-search-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

#risk-intel-query {
    flex: 1;
    width: auto;
    background: var(--bg-surface);
    border: 1px solid var(--line-subtle);
    color: var(--text-display);
    outline: none;
    font-size: 1rem;
    padding: 12px 16px;
    border-radius: 8px;
    transition: border-color 0.2s;
}

#risk-intel-query:focus {
    border-color: var(--primary);
}

.risk-grounding-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Results Area */
#risk-intel-main {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.risk-empty-state {
    text-align: center;
    padding: 80px 40px;
    opacity: 0.6;
    border: 1px dashed var(--line-stark);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
}

/* Result Card */
.risk-result-card {
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--primary);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border-top: 1px solid var(--line-subtle);
    border-right: 1px solid var(--line-subtle);
    border-bottom: 1px solid var(--line-subtle);
}

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

.subject-name {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-display);
    letter-spacing: -0.02em;
}

.timestamp {
    font-size: 0.75rem;
    opacity: 0.6;
    color: var(--text-muted);
}

.risk-score-badge {
    background: var(--bg-elevated);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--primary);
}

/* Sections */
.risk-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 8px;
    opacity: 0.6;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-subtle);
}

.risk-summary-box p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-body);
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* PEP & Sanctions */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.sanction-item {
    font-size: 0.85rem;
    padding: 12px;
    background: rgba(255, 68, 68, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 68, 68, 0.1);
}

/* Network Map */
.network-card {
    padding: 12px;
    min-width: 140px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid var(--line-subtle);
    flex: 1;
    max-width: calc(100% - 20px);
}

/* History Grid */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line-subtle);
    padding-bottom: 16px;
    position: sticky;
    top: 0;
    background: var(--bg-color);
    /* Match app bg */
    z-index: 10;
    padding-top: 10px;
    /* For sticky overlap */
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.history-card {
    padding: 24px;
    border: 1px solid var(--line-stark);
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.history-card:hover {
    transform: translateY(-2px);
    background: var(--bg-elevated);
    border-color: var(--primary);
    box-shadow: var(--shadow-stark);
}

.history-card .card-score {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2.5rem;
    /* Larger */
    position: absolute;
    bottom: 16px;
    right: 20px;
    opacity: 0.2;
    transition: all 0.3s;
}

.history-card:hover .card-score {
    opacity: 1;
    transform: scale(1.1);
}

/* Sources */
.source-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--line-subtle);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.source-card:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
}

/* ========================================
 * MOBILE RESPONSIVE OVERRIDES
 * Prevents content clipping on narrow viewports.
 * ======================================== */
@media (max-width: 768px) {
    .risk-intel-container {
        padding-bottom: 24px;
    }

    .risk-search-row {
        flex-direction: column;
    }

    .risk-search-row button {
        width: 100%;
    }

    .risk-result-card {
        padding: 16px;
    }

    .subject-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .details-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

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

    .risk-sources {
        grid-template-columns: 1fr !important;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .risk-action-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .risk-empty-state {
        padding: 40px 16px;
    }
}