/*
 * DirecFunds shared UI foundation.
 *
 * Product-specific styles remain in each application. This file owns the small set of
 * tokens and accessible primitives that should behave consistently across every portal.
 * Keep it dependency-free so Razor Class Library static assets can be consumed directly.
 */
:root {
    --df-color-ink: var(--primary-text-color, #18202c);
    --df-color-ink-muted: var(--text-muted, #646961);
    --df-color-surface: var(--input-background, #ffffff);
    --df-color-surface-subtle: var(--primary-background-color, #f7f8fa);
    --df-color-border: var(--input-border-color, #d8dee7);
    --df-color-brand: var(--btn-primary, #876719);
    --df-color-brand-strong: var(--navigation-link-color-hover, #624a10);
    --df-color-brand-soft: #fff6dd;
    --df-color-success: #18724a;
    --df-color-success-soft: #e9f7f0;
    --df-color-warning: #8a5a00;
    --df-color-warning-soft: #fff4d6;
    --df-color-danger: #a51d2d;
    --df-color-danger-soft: #fff0f2;
    /* Status pairs keep AA contrast independent of the surrounding brand surface. */
    --df-color-info: #124c73;
    --df-color-info-soft: #eaf4fc;
    --df-color-neutral: #384454;
    --df-color-neutral-soft: #edf0f4;
    --df-radius-sm: 0.5rem;
    --df-radius-md: 0.75rem;
    --df-radius-lg: 1rem;
    --df-shadow-sm: 0 0.25rem 0.75rem rgba(24, 32, 44, 0.08);
    --df-focus-ring: 0 0 0 0.2rem rgba(135, 103, 25, 0.28);
    --df-font-family-sans: Inter, "Segoe UI", Arial, sans-serif;
    --df-font-size-xs: 0.75rem;
    --df-font-size-sm: 0.875rem;
    --df-font-size-body: 1rem;
    --df-font-size-lg: 1.125rem;
    --df-font-size-title: clamp(1.65rem, 3vw, 2.25rem);
    --df-line-height-body: 1.5;
    --df-space-1: 0.25rem;
    --df-space-2: 0.5rem;
    --df-space-3: 0.75rem;
    --df-space-4: 1rem;
    --df-space-5: 1.5rem;
    --df-space-6: 2rem;
}

.df-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--df-space-5);
    margin-bottom: var(--df-space-5);
}

.df-page-header h1 { margin: 0; font-size: var(--df-font-size-title); }
.df-page-header, .df-surface, .df-state-card { font-family: var(--df-font-family-sans); }
.df-table-caption { color: var(--df-color-ink); }
.df-page-header p { max-width: 48rem; margin: var(--df-space-2) 0 0; color: var(--df-color-ink-muted); }

.df-surface {
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 1px solid var(--df-color-border);
    border-radius: var(--df-radius-lg);
    background: var(--df-color-surface);
    color: var(--df-color-ink);
    box-shadow: var(--df-shadow-sm);
}

.df-form-actions,
.df-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--df-space-3);
}

.df-inline-notice {
    padding: var(--df-space-3) var(--df-space-4);
    border: 1px solid var(--df-color-border);
    border-radius: var(--df-radius-md);
    background: var(--df-color-surface-subtle);
    color: var(--df-color-ink);
}

.df-inline-notice--danger { border-color: #e2a2aa; background: var(--df-color-danger-soft); }
.df-inline-notice--danger { color: var(--df-color-danger); }
.df-inline-notice--warning { border-color: var(--df-color-warning); background: var(--df-color-warning-soft); color: var(--df-color-warning); }
.df-inline-notice--info { background: var(--df-color-info-soft); color: var(--df-color-info); }
.df-inline-notice--success { background: var(--df-color-success-soft); color: var(--df-color-success); }

/* ASP.NET renders validation summaries even when they contain no errors and
   marks them with validation-summary-valid. Keep those inert containers out
   of both the visual layout and the accessibility tree until errors exist. */
.validation-summary-valid,
.df-validation-summary:empty {
    display: none;
}

.df-validation-summary {
    margin-bottom: var(--df-space-4);
    padding: var(--df-space-3) var(--df-space-4);
    border: 1px solid #e2a2aa;
    border-radius: var(--df-radius-md);
    background: var(--df-color-danger-soft);
    color: var(--df-color-danger);
}
.df-validation-summary ul { margin: var(--df-space-2) 0 0; padding-left: 1.25rem; }
.df-validation-summary a { color: inherit; }

.df-draft-status {
    margin: 0 0 var(--df-space-3);
    color: var(--df-color-ink-muted);
    font-size: var(--df-font-size-sm);
}

.df-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: var(--df-font-size-xs);
    font-weight: 700;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.df-status-pill--neutral,
.df-status-pill--stopped { color: var(--df-color-neutral); background: var(--df-color-neutral-soft); }
.df-status-pill--info,
.df-status-pill--progress { color: var(--df-color-info); background: var(--df-color-info-soft); }
.df-status-pill--success { color: var(--df-color-success); background: var(--df-color-success-soft); }
.df-status-pill--warning { color: var(--df-color-warning); background: var(--df-color-warning-soft); }
.df-status-pill--danger { color: var(--df-color-danger); background: var(--df-color-danger-soft); }

/* The class is intentionally shared even when an app supplies more specific positioning. */
.df-skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10000;
    max-width: calc(100vw - 1rem);
    padding: 0.65rem 0.9rem;
    border-radius: var(--df-radius-sm);
    background: var(--df-color-ink);
    color: #fff;
    font-weight: 600;
    transform: translateY(-150%);
}

.df-skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--df-color-brand-strong);
    outline-offset: 2px;
    box-shadow: var(--df-focus-ring);
}

.df-flow-progress {
    display: grid;
    grid-template-columns: repeat(var(--df-flow-step-count, 3), minmax(0, 1fr));
    gap: 0;
    width: min(100%, 42rem);
    margin: 1rem auto 2rem;
    padding: 0;
    list-style: none;
    counter-reset: df-flow-step;
}

.df-flow-progress__step {
    position: relative;
    min-width: 0;
    padding: 2.5rem 0.35rem 0;
    color: var(--df-color-ink-muted);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    counter-increment: df-flow-step;
}

.df-flow-progress__step::before {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 2;
    display: grid;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--df-color-border);
    border-radius: 50%;
    place-items: center;
    background: var(--df-color-surface);
    color: var(--df-color-ink-muted);
    content: counter(df-flow-step);
    transform: translateX(-50%);
}

.df-flow-progress__step:not(:first-child)::after {
    position: absolute;
    top: 0.95rem;
    right: 50%;
    left: -50%;
    z-index: 1;
    height: 2px;
    background: var(--df-color-border);
    content: "";
}

.df-flow-progress__step[data-state="current"] {
    color: var(--df-color-brand-strong);
}

.df-flow-progress__step[data-state="current"]::before {
    border-color: var(--df-color-brand);
    background: var(--df-color-brand-soft);
    color: var(--df-color-brand-strong);
}

.df-flow-progress__step[data-state="complete"] {
    color: var(--df-color-success);
}

.df-flow-progress__step[data-state="complete"]::before {
    border-color: var(--df-color-success);
    background: var(--df-color-success);
    color: #fff;
    content: "\2713";
}

.df-flow-progress__step[data-state="complete"]::after {
    background: var(--df-color-success);
}

.df-state-card {
    width: min(100%, 46rem);
    margin: 1rem auto;
    padding: clamp(1.1rem, 3vw, 1.6rem);
    border: 1px solid var(--df-color-border);
    border-radius: var(--df-radius-lg);
    background: var(--df-color-surface);
    color: var(--df-color-ink);
    box-shadow: var(--df-shadow-sm);
}

.df-state-card--warning {
    border-color: #dfbd6d;
    background: var(--df-color-warning-soft);
    color: var(--df-color-warning);
}

.df-state-card--danger {
    border-color: #e2a2aa;
    background: var(--df-color-danger-soft);
    color: var(--df-color-danger);
}

.df-state-card--warning a:not(.btn),
.df-state-card--danger a:not(.btn) { color: inherit; text-decoration: underline; }

.df-state-card--warning :is(h1, h2, h3, p),
.df-state-card--danger :is(h1, h2, h3, p) { color: inherit; }

.df-state-card .df-card-body { color: inherit; background-color: transparent; }
.df-state-card--warning .text-muted,
.df-state-card--danger .text-muted { color: inherit !important; }

.df-state-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

@media (max-width: 479.98px) {
    .df-page-header { flex-direction: column; }
    .df-page-header > :last-child { width: 100%; }
    .df-flow-progress__step {
        padding-right: 0.15rem;
        padding-left: 0.15rem;
        font-size: 0.72rem;
    }

    .df-state-card__actions > * {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Keep optional form controls comfortable to tap on smaller screens. */
@media (max-width: 767.98px) {
    form[data-df-guided-form] details > summary {
        min-height: 44px;
        padding-block: .625rem;
        cursor: pointer;
    }
    form[data-df-guided-form] [data-dd-review-edit] {
        display: inline-block;
        min-width: 44px;
        min-height: 44px;
        padding-block: .5rem;
        text-align: right;
    }
}
