/* AI icon on deal-alert notifications + the AI summary drawer body */

/* Pin the AI button strictly to the bottom-right of each notification row. */
#notificationList .list-group-item {
    position: relative;
}

.notif-ai-btn {
    position: absolute;
    right: .75rem;
    bottom: .5rem;
    line-height: 0;
    color: var(--bs-primary, #556ee6);
    cursor: pointer;
}

.notif-ai-btn:hover {
    opacity: .75;
}

.notif-ai-svg {
    display: block;
}

/* Custom deal-alert toast (built from scratch) — duplicates toastr's exact info-toast styling.
   Uses the theme's --info-rgb so the colour matches toastr in both light and dark. */
#finkit-deal-toast-container {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 999999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    max-width: 92vw;
}

.finkit-deal-toast {
    position: relative;
    pointer-events: auto;
    overflow: hidden;
    margin: 0 0 6px;
    padding: 15px 15px 15px 50px;
    width: 300px;
    max-width: 92vw;
    border-radius: 3px;
    background-color: rgb(var(--info-rgb));
    color: #fff;
    box-shadow: 0 0 12px #999;
    cursor: pointer;
    opacity: 0;
    transform: translateX(12px);
    transition: opacity .3s ease, transform .3s ease;
}

.finkit-deal-toast.show {
    opacity: .8;
    transform: none;
}

.finkit-deal-toast:hover {
    box-shadow: 0 0 12px #000;
    opacity: 1;
}

.finkit-deal-toast-ico {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    color: #fff;
}

.finkit-deal-toast-title {
    font-weight: 700;
}

.finkit-deal-toast-msg {
    word-wrap: break-word;
}

.finkit-deal-toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 0 #fff;
    opacity: .8;
    cursor: pointer;
}

.finkit-deal-toast-close:hover {
    color: #000;
    opacity: .4;
}

/* Top banner: centered, reasonable width, fixed minimal-but-reasonable height, body scrolls for long summaries. */
.deal-ai-offcanvas.offcanvas-top {
    left: 0;
    right: 0;
    margin-inline: auto;
    width: min(700px, 92vw);
    height: auto;
    min-height: 100px;
    max-height: 34vh;
    border-bottom-left-radius: .5rem;
    border-bottom-right-radius: .5rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .15);
}

/* Header stays pinned; only the body scrolls. */
.deal-ai-offcanvas .offcanvas-header {
    padding-top: .6rem;
    padding-bottom: .6rem;
}

.deal-ai-offcanvas .offcanvas-body {
    overflow-y: auto;
}

.deal-ai-body {
    text-align: left;
    font-size: .9rem;
}

/* Verdict header */
.deal-ai-verdict {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .6rem;
}

.deal-ai-risk {
    font-size: 1rem;
    padding: .4rem .55rem;
}

.deal-ai-risk small {
    font-weight: 400;
    opacity: .75;
}

.deal-ai-status {
    font-weight: 600;
    font-size: .85rem;
}

/* Tags */
.deal-ai-badges {
    margin-bottom: .6rem;
}

.deal-ai-badges .badge {
    margin-right: .25rem;
    margin-bottom: .25rem;
}

.deal-ai-summary {
    margin-bottom: .75rem;
    line-height: 1.45;
}

/* Metric snapshot */
.deal-ai-metrics {
    margin: 0 0 .75rem;
    padding: .4rem .65rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-radius: .4rem;
}

.deal-ai-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    padding: .22rem 0;
    font-size: .85rem;
}

.deal-ai-metric + .deal-ai-metric {
    border-top: 1px solid var(--bs-border-color, #eff2f7);
}

.deal-ai-metric-name {
    color: var(--bs-secondary-color, #6c757d);
}

.deal-ai-metric-val {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
}

.deal-ai-pct {
    color: var(--bs-secondary-color, #6c757d);
    font-size: .78rem;
    margin-left: .25rem;
}

/* Reasoning */
.deal-ai-cat {
    border-top: 1px solid var(--bs-border-color, #eff2f7);
    padding-top: .5rem;
    margin-top: .5rem;
    line-height: 1.4;
}

.deal-ai-cat-head {
    margin-bottom: .15rem;
}

.deal-ai-disclaimer {
    margin-top: .9rem;
    padding-top: .5rem;
    border-top: 1px solid var(--bs-border-color, #eff2f7);
    font-size: .72rem;
    font-style: italic;
    color: var(--bs-secondary-color, #6c757d);
}

.deal-ai-md {
    white-space: pre-wrap;
    text-align: left;
    font-size: .8rem;
    max-height: 50vh;
    overflow: auto;
}

/* Dark mode. Most surfaces use Bootstrap theme vars (auto-adapt under data-bs-theme); these cover the
   light fallbacks. The toast icon is white on the blue toast, so it already works in both themes. */
[data-bs-theme="dark"] .deal-ai-metrics {
    background: rgba(255, 255, 255, .06);
}

[data-bs-theme="dark"] .deal-ai-metric + .deal-ai-metric,
[data-bs-theme="dark"] .deal-ai-cat,
[data-bs-theme="dark"] .deal-ai-disclaimer {
    border-color: rgba(255, 255, 255, .14);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme="light"]) .deal-ai-metrics {
        background: rgba(255, 255, 255, .06);
    }

    :root:not([data-bs-theme="light"]) .deal-ai-metric + .deal-ai-metric,
    :root:not([data-bs-theme="light"]) .deal-ai-cat,
    :root:not([data-bs-theme="light"]) .deal-ai-disclaimer {
        border-color: rgba(255, 255, 255, .14);
    }
}
