/*
 * Signature builder (create/edit) styles. Loaded panel-wide from
 * AdminPanelProvider; every rule is scoped to a sig-* class.
 * Tokens follow the CNAT Design System bright theme: navy + white do the
 * work, blue is focus, square corners on surfaces.
 */
:root {
    --sig-navy: #0d1623;
    --sig-blue: #2d7dd2;
    --sig-line: #d9d4c7;
    --sig-paper: #f4f1e9;
    --sig-muted: #5b6472;
}

/* Right column follows the form down the page on wide screens. */
@media (min-width: 1024px) {
    .sig-preview-col {
        position: sticky;
        top: 5.5rem;
    }
}

/* On phones the preview leads, so people see what they are making. */
@media (max-width: 1023px) {
    .fi-fo-component-ctn > div:has(> .sig-preview-col),
    div:has(> .sig-preview-col) {
        order: -1;
    }
}

/* Zoom a full-width signature down to whatever room it has. */
.sig-fit {
    display: block;
    overflow: hidden;
    max-width: 100%;
}
.sig-fit__inner {
    display: block;
    zoom: var(--sig-zoom, 0.5);
}

/* The preview staged as the end of an email. */
.sig-mail {
    background: #fff;
    border: 1px solid var(--sig-line);
    padding: 20px 20px 24px;
}
.sig-mail__text {
    margin: 0 0 18px;
    color: var(--sig-muted);
    font-size: 16px;
    line-height: 1.5;
}

/* Look picker. */
.sig-looks {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}
@media (min-width: 640px) {
    .sig-looks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.sig-look {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 44px;
    background: #fff;
    border: 1.5px solid var(--sig-line);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.sig-look:hover { border-color: var(--sig-navy); }
.sig-look:focus-visible {
    outline: 3px solid var(--sig-blue);
    outline-offset: 2px;
}
.sig-look.is-selected {
    border-color: var(--sig-navy);
    box-shadow: 0 0 0 1.5px var(--sig-navy);
}
.sig-look__thumb {
    flex: 1;
    padding: 14px 12px;
    pointer-events: none;
    background: #fff;
}
.sig-look__meta {
    display: block;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--sig-line);
    background: var(--sig-paper);
}
.sig-look__name {
    display: block;
    color: var(--sig-navy);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}
.sig-look__note {
    display: block;
    margin-top: 2px;
    color: var(--sig-muted);
    font-size: 14px;
    line-height: 1.4;
}
.sig-look__flag {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 10px;
    background: var(--sig-navy);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.sig-look.is-selected .sig-look__flag { display: block; }

/* Dark mode: the signature itself always sits on white, like an email. */
.dark .sig-look__meta { background: #1b2230; border-top-color: #2c3547; }
.dark .sig-look { border-color: #2c3547; }
.dark .sig-look__name { color: #fff; }
.dark .sig-look__note { color: #aab3c2; }
.dark .sig-look.is-selected { border-color: #fff; box-shadow: 0 0 0 1.5px #fff; }
.dark .sig-look__flag { background: #fff; color: var(--sig-navy); }

/*
 * Readability on the signature pages (builder + list): many of the people
 * using this are 55+, so labels and help text are 16px and every control is
 * at least 44px tall. Scoped to Filament's per-resource page class.
 */
.fi-resource-signature .fi-fo-field-wrp-label span,
.fi-resource-signature .fi-section-header-description,
.fi-resource-signature .fi-fo-field-wrp-helper-text,
.fi-resource-signature .fi-fo-placeholder,
.fi-resource-signature .fi-ta-text-item-label,
.fi-resource-signature .fi-ta-header-cell-label {
    font-size: 16px;
    line-height: 1.5;
}
.fi-resource-signature .fi-section-header-heading { font-size: 18px; }
.fi-resource-signature .fi-input,
.fi-resource-signature .fi-select-input {
    min-height: 44px;
    font-size: 16px;
}
.fi-resource-signature .fi-btn,
.fi-resource-signature .fi-link,
.fi-resource-signature .fi-ac-action { min-height: 44px; }
.fi-resource-signature .fi-btn { font-size: 16px; }

/* The preview is a picture of the signature, not a working one. */
.sig-mail .sig-fit__inner { pointer-events: none; }

/* "View as staff" bar (admins previewing the staff experience). */
.sig-viewas {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--sig-navy);
    color: #fff;
    font-size: 16px;
    line-height: 1.4;
}
.sig-viewas__btn {
    min-height: 44px;
    padding: 0 16px;
    background: #fff;
    color: var(--sig-navy);
    border: 1.5px solid #fff;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}
.sig-viewas__btn:hover { background: var(--sig-navy); color: #fff; }
.sig-viewas__btn:focus-visible { outline: 3px solid var(--sig-blue); outline-offset: 2px; }
