/*
 * Script faces for typed signatures. Self-hosted rather than pulled from Google Fonts so the
 * capture UI has no third-party runtime dependency and no FOUT mid-signing.
 *
 * All three are SIL OFL 1.1 and self-hosted from wwwroot/fonts/, license text alongside each.
 * The filenames below are literal — read wwwroot/fonts/README.md before renaming or updating one.
 *
 * Every stack ends in a generic fallback on purpose: if a .woff2 is missing, the live preview
 * and the rendered PNG both degrade to the system cursive face instead of breaking. Nothing
 * here is required for the app to function.
 */

@font-face {
    font-family: 'Dancing Script';
    src: url('../fonts/DancingScript-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Great Vibes';
    src: url('../fonts/GreatVibes-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Caveat';
    src: url('../fonts/Caveat-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* --- Capture surface (Shared/SignatureCapture.razor) --- */

/* Mirrors the legacy #signature-control box so the pad keeps the size it has today. */
.signature-pad-host {
    height: 300px;
    width: 100%;
    margin: 0;
}

.signature-capture .signdescription {
    font-size: 14px;
    padding-bottom: 10px;
}

/* The Clear button floats right inside the heading; without clearing it the pad can ride up
   under it. */
.signature-capture .e-sign-heading::after {
    content: "";
    display: table;
    clear: both;
}

/* Own class rather than restyling the shared .user-settings-actions, which also lays out the
   Profile and Roles sections. */
.signature-card-actions {
    margin-top: 20px;
}

/* Previously lived in PopupDialog's inline <style>. Moved here because the capture component
   is now also used by the form Signature question and the profile page, neither of which
   render PopupDialog. */
.signature-capture .e-btn-options {
    float: right;
    margin-bottom: 10px;
}

.signature-capture .e-sign-clear {
    margin-left: 5px;
}

/* Collapsed, not unmounted: keeping the pad in the DOM preserves drawn strokes across a tab
   switch and keeps the canvas measurable by the typed renderer.
   Height-only clip on the wrapper, deliberately: shrinking the width (or display:none) makes
   Syncfusion's resize handling re-init the canvas, which blanks whatever was drawn. The pad
   inside keeps its full box and is simply cropped away. */
.signature-hidden {
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.signature-type-section {
    padding-top: 4px;
}

.signature-type-field {
    margin-bottom: 14px;
}

.signature-type-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.signature-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.signature-adopt {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 4px 0 16px 0;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

/* Preview of the saved signature offered for reuse. It sits beside the checkbox rather than in
   the pad: the pad must stay empty until the user opts in, both so reuse is an affirmative act
   and because Syncfusion composites new strokes over existing canvas content. */
.signature-saved-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    min-width: 120px;
    max-width: 260px;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.signature-saved-thumb img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

/* Hand-rolled dialog footer (see PopupDialog.razor for why it is not <DialogButtons>). */
.signature-dialog-footer {
    gap: 8px;
}

.signature-dialog-footer .e-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Preview chips in the style picker. */
.signature-style-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 62px;
    padding: 6px 14px;
    border: 1.5px solid #d7dde5;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.signature-style-option:hover {
    border-color: #22A6DE;
}

.signature-style-option.selected {
    border-color: #22A6DE;
    box-shadow: 0 0 0 2px rgba(34, 166, 222, 0.25);
}

/* No ellipsis and no fixed size: the component computes a font-size that fits the text, so a
   long name shrinks to fit rather than truncating to "dwidenh...". */
.signature-style-preview {
    line-height: 1.3;
    color: #000;
    white-space: nowrap;
    max-width: 100%;
}

.signature-style-placeholder {
    font-size: 14px;
    color: #8a94a3;
    font-style: italic;
}

.signature-typed-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    border: 1px dashed #c9d2dc;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    overflow: hidden;
}

.signature-tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.signature-tab {
    padding: 7px 20px;
    border: 1.5px solid #d7dde5;
    border-bottom-color: #d7dde5;
    border-radius: 8px 8px 0 0;
    background: #f5f7fa;
    cursor: pointer;
    font-size: 14px;
    color: #4a5568;
}

.signature-tab.active {
    background: #fff;
    border-color: #22A6DE;
    color: #164769;
    font-weight: 600;
}

.signature-saved-hint {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 8px;
}
