/* Dear DigitalTree — Legal & Trust sections (light + dark) */

.dt-legal-section {
    background: var(--dt-legal-section-bg, #f8fafc);
    border-top: 1px solid var(--dt-legal-border, #e2e8f0);
    border-bottom: 1px solid var(--dt-legal-border, #e2e8f0);
}

[data-bs-theme="dark"] .dt-legal-section {
    --dt-legal-section-bg: #141416;
    --dt-legal-border: #3f3f46;
}

[data-bs-theme="dark"] .dt-legal-section .text-secondary-emphasis {
    color: #a1a1aa !important;
}

[data-bs-theme="dark"] .dt-legal-section h2 {
    color: #fafafa;
}

.dt-legal-card {
    background: var(--dt-legal-card-bg, #ffffff);
    border: 1px solid var(--dt-legal-border, #e2e8f0) !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

[data-bs-theme="dark"] .dt-legal-card {
    --dt-legal-card-bg: #1c1c1f;
    --dt-legal-border: #3f3f46;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.dt-legal-card:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

[data-bs-theme="dark"] .dt-legal-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    border-color: #52525b !important;
}

.dt-legal-card .dt-legal-card__title {
    color: var(--bs-emphasis-color);
}

.dt-legal-card .dt-legal-card__desc {
    color: var(--bs-secondary-color);
}

.dt-legal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.dt-legal-icon--primary {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.dt-legal-icon--success {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.dt-legal-icon--warning {
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
}

[data-bs-theme="dark"] .dt-legal-icon--primary {
    background: rgba(129, 140, 248, 0.18);
    color: #a5b4fc;
}

[data-bs-theme="dark"] .dt-legal-icon--success {
    background: rgba(74, 222, 128, 0.14);
    color: #86efac;
}

[data-bs-theme="dark"] .dt-legal-icon--warning {
    background: rgba(251, 191, 36, 0.14);
    color: #fcd34d;
}

.dt-legal-pan-frame,
.dt-legal-doc-preview {
    display: block;
    position: relative;
    background: var(--dt-legal-pan-bg, #f1f5f9);
    border: 1px solid var(--dt-legal-border, #e2e8f0) !important;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dt-legal-doc-preview:hover {
    border-color: rgba(99, 102, 241, 0.45) !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

[data-bs-theme="dark"] .dt-legal-doc-preview:hover {
    border-color: rgba(129, 140, 248, 0.5) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dt-legal-doc-preview__img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    object-position: center top;
    background: #fff;
}

[data-bs-theme="dark"] .dt-legal-doc-preview__img {
    background: #fafafa;
}

.dt-legal-doc-preview__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dt-legal-doc-preview__overlay i {
    font-size: 1.35rem;
}

.dt-legal-doc-preview:hover .dt-legal-doc-preview__overlay,
.dt-legal-doc-preview:focus-visible .dt-legal-doc-preview__overlay {
    opacity: 1;
}

[data-bs-theme="dark"] .dt-legal-pan-frame,
[data-bs-theme="dark"] .dt-legal-doc-preview {
    --dt-legal-pan-bg: #27272a;
    --dt-legal-border: #52525b;
}

.dt-legal-cta-card {
    background: var(--dt-legal-cta-bg, #f1f5f9);
    border: 1px solid var(--dt-legal-border, #e2e8f0) !important;
}

[data-bs-theme="dark"] .dt-legal-cta-card {
    --dt-legal-cta-bg: #1f1f23;
    --dt-legal-border: #3f3f46;
}

.dt-legal-cta-card .dt-legal-card__title {
    color: var(--bs-emphasis-color);
}

.dt-legal-cta-card .dt-legal-card__desc {
    color: var(--bs-secondary-color);
}

/* Callout / notice banners */
.dt-legal-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.55;
    border: 1px solid var(--dt-legal-callout-border, #c7d2fe);
    background: var(--dt-legal-callout-bg, #eef2ff);
    color: var(--dt-legal-callout-text, #1e293b);
}

[data-bs-theme="dark"] .dt-legal-callout {
    --dt-legal-callout-border: rgba(129, 140, 248, 0.35);
    --dt-legal-callout-bg: rgba(99, 102, 241, 0.1);
    --dt-legal-callout-text: #e4e4e7;
}

.dt-legal-callout__icon {
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1.4;
    color: var(--dt-legal-callout-icon, #4f46e5);
}

[data-bs-theme="dark"] .dt-legal-callout__icon {
    --dt-legal-callout-icon: #a5b4fc;
}

.dt-legal-callout--success {
    --dt-legal-callout-border: #bbf7d0;
    --dt-legal-callout-bg: #f0fdf4;
    --dt-legal-callout-text: #14532d;
    --dt-legal-callout-icon: #16a34a;
}

[data-bs-theme="dark"] .dt-legal-callout--success {
    --dt-legal-callout-border: rgba(74, 222, 128, 0.3);
    --dt-legal-callout-bg: rgba(34, 197, 94, 0.1);
    --dt-legal-callout-text: #d4d4d8;
    --dt-legal-callout-icon: #86efac;
}

.dt-legal-callout--info {
    --dt-legal-callout-border: #bae6fd;
    --dt-legal-callout-bg: #f0f9ff;
    --dt-legal-callout-text: #0c4a6e;
    --dt-legal-callout-icon: #0284c7;
}

[data-bs-theme="dark"] .dt-legal-callout--info {
    --dt-legal-callout-border: rgba(56, 189, 248, 0.3);
    --dt-legal-callout-bg: rgba(14, 165, 233, 0.1);
    --dt-legal-callout-text: #d4d4d8;
    --dt-legal-callout-icon: #7dd3fc;
}

.dt-legal-callout__body {
    flex: 1 1 12rem;
    min-width: 0;
}

.dt-legal-callout__body strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--bs-emphasis-color);
    font-weight: 700;
}

.dt-legal-callout a {
    color: var(--dt-legal-callout-link, #4338ca);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

[data-bs-theme="dark"] .dt-legal-callout a {
    --dt-legal-callout-link: #c7d2fe;
}

.dt-legal-callout a:hover {
    color: var(--bs-primary);
}

/* Policy tab checklist */
.dt-legal-checklist li {
    color: var(--bs-body-color);
    font-size: 0.8125rem;
}

.dt-legal-checklist .bi-check-circle {
    color: #16a34a;
}

[data-bs-theme="dark"] .dt-legal-checklist .bi-check-circle {
    color: #4ade80;
}

/* Outline buttons on dark — better contrast */
[data-bs-theme="dark"] .dt-legal-card .btn-outline-warning {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.55);
}

[data-bs-theme="dark"] .dt-legal-card .btn-outline-warning:hover {
    background: rgba(251, 191, 36, 0.12);
    color: #fde68a;
}

[data-bs-theme="dark"] .dt-legal-section .btn-outline-primary {
    color: #a5b4fc;
    border-color: rgba(129, 140, 248, 0.5);
}

[data-bs-theme="dark"] .dt-legal-section .btn-outline-primary:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #e0e7ff;
}

[data-bs-theme="dark"] .dt-legal-section .btn-outline-success {
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.45);
}

[data-bs-theme="dark"] .dt-legal-section .btn-outline-success:hover {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

[data-bs-theme="dark"] .dt-legal-callout .btn-primary {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .ref-hub .dt-legal-policy-card .text-primary {
    color: #a5b4fc !important;
}

/* Sidebar legal links — readable in both themes */
.fi-sidebar-item[href*="company-credentials"],
.fi-sidebar-item[href*="affiliate-code-of-conduct"] {
    color: #4b5563;
}

[data-bs-theme="dark"] .fi-sidebar-item[href*="company-credentials"],
[data-bs-theme="dark"] .fi-sidebar-item[href*="affiliate-code-of-conduct"] {
    color: #d4d4d8;
}

[data-bs-theme="dark"] .fi-sidebar-item[href*="company-credentials"]:hover,
[data-bs-theme="dark"] .fi-sidebar-item[href*="affiliate-code-of-conduct"]:hover {
    color: #fafafa;
    background-color: #27272a;
}

[data-bs-theme="dark"] .fi-sidebar-item[href*="company-credentials"] i,
[data-bs-theme="dark"] .fi-sidebar-item[href*="affiliate-code-of-conduct"] i {
    color: #a5b4fc;
}

/* Referral hub scoped overrides */
.ref-hub .dt-legal-callout {
    margin-bottom: 0.75rem;
}

.ref-hub .dt-legal-policy-card h6 {
    color: var(--ref-text);
}

.ref-hub .dt-legal-policy-card .dt-legal-checklist li {
    color: var(--ref-text);
}

.ref-hub .dt-legal-policy-card .btn-outline-secondary {
    border-color: var(--ref-border);
    color: var(--ref-text);
}

[data-bs-theme="dark"] .ref-hub .dt-legal-policy-card .btn-outline-secondary {
    border-color: #52525b;
    color: #e4e4e7;
}

[data-bs-theme="dark"] .ref-hub .dt-legal-policy-card .btn-outline-secondary:hover {
    background: var(--ref-surface-3);
    color: #fafafa;
}
