/* Keep in step with the FONTS array in sirona-signature.ts - a face used there but not
   fetched here silently falls back to the generic cursive and every option looks alike. */
@import url('https://fonts.googleapis.com/css2?family=Alex+Brush&family=Birthstone&family=Caveat:wght@400..700&family=Dancing+Script:wght@400..700&family=Ephesis&family=Great+Vibes&family=Kalam:wght@300;400;700&family=Marck+Script&family=MonteCarlo&family=Satisfy&family=Whisper&display=swap');

/* ── sirona-signature ─────────────────────────────────────────────────────── */

/* The ink is dark and the exported PNG is transparent, so every surface that shows a
   signature keeps a light plate behind it in all three themes. */

sirona-signature {
    display: block;
}

.ss-wrapper {
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--bg-secondary, #fff);
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */

.ss-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    background: var(--bg-tertiary, #f8f9fa);
}

.ss-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.ss-tab:hover {
    color: var(--blueteq-blue, #186fb5);
    background: var(--bg-secondary, #fff);
}

.ss-tab--active {
    color: var(--blueteq-blue, #186fb5);
    border-bottom-color: var(--blueteq-blue, #186fb5);
    background: var(--bg-secondary, #fff);
    font-weight: 500;
}

.ss-tab:focus-visible {
    outline: 2px solid var(--blueteq-blue, #186fb5);
    outline-offset: -2px;
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */

.ss-panel {
    padding: 1rem;
}

/* ── Canvas (draw + write modes) ───────────────────────────────────────────── */

.ss-canvas {
    display: block;
    width: 100%;
    height: 200px;
    border: 1.5px dashed var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    /* Deliberately not tokenised - the ink is dark, so this plate stays light in
       every theme or the signature disappears. */
    background: #fff;
    touch-action: none;
    cursor: crosshair;
}

.ss-write-canvas {
    margin-top: 0.75rem;
    cursor: default;
}

.ss-wrapper--readonly .ss-canvas {
    cursor: default;
    border-style: solid;
}

/* ── Toolbar ───────────────────────────────────────────────────────────────── */

.ss-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ss-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    background: none;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-secondary, #6b7280);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.ss-btn:hover {
    background: var(--hover-bg, #f3f4f6);
    color: var(--text-primary, #1f2937);
    border-color: var(--blueteq-blue, #186fb5);
}

/* ── Write mode ────────────────────────────────────────────────────────────── */

.ss-text-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-primary, #1f2937);
    background: var(--input-bg, #fff);
    border: 1px solid var(--input-border, #e5e7eb);
    border-radius: 0.375rem;
}

.ss-text-input:focus {
    outline: none;
    border-color: var(--blueteq-blue, #186fb5);
    box-shadow: 0 0 0 3px rgba(var(--blueteq-blue-rgb, 24, 111, 181), 0.15);
}

.ss-font-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    /* Capped so a long list of faces cannot push the canvas off the bottom of the tab. */
    max-height: 11rem;
    overflow-y: auto;
}

.ss-font-option {
    flex: 1 1 auto;
    min-width: 7rem;
    max-width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 1.25rem;
    line-height: 1.4;
    text-align: center;
    /* The label is the user's own name once typed, so it has to be allowed to run out. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary, #1f2937);
    background: var(--bg-secondary, #fff);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ss-font-option:hover {
    border-color: var(--blueteq-blue, #186fb5);
}

.ss-font-option--active {
    border-color: var(--blueteq-blue, #186fb5);
    background: rgba(var(--blueteq-blue-rgb, 24, 111, 181), 0.08);
    color: var(--blueteq-blue, #186fb5);
}

/* ── Upload area ───────────────────────────────────────────────────────────── */

.ss-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 160px;
    border: 1.5px dashed var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    cursor: pointer;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary, #6b7280);
    font-size: 0.875rem;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ss-upload-label i {
    font-size: 2rem;
    color: var(--text-tertiary, #9ca3af);
    transition: color 0.15s;
}

.ss-upload-label:hover,
.ss-upload-label.ss-dragover {
    border-color: var(--blueteq-blue, #186fb5);
    background: rgba(var(--blueteq-blue-rgb, 24, 111, 181), 0.08);
    color: var(--blueteq-blue, #186fb5);
}

.ss-upload-label:hover i,
.ss-upload-label.ss-dragover i {
    color: var(--blueteq-blue, #186fb5);
}

.ss-upload-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary, #9ca3af);
}

.ss-file-input {
    display: none;
}

/* ── Upload preview ────────────────────────────────────────────────────────── */

.ss-upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.ss-upload-preview[hidden] {
    display: none;
}

.ss-preview-img {
    max-width: 100%;
    max-height: 200px;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    object-fit: contain;
    background: #fff;
}

/* ── Error ─────────────────────────────────────────────────────────────────── */

.ss-error {
    padding: 0 1rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--danger-red, #d40000);
}

.ss-error[hidden] {
    display: none;
}

/* ── View mode (existing signature / ViewSubmission) ───────────────────────── */

.ss-view {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
}

.ss-view-img {
    max-width: 100%;
    max-height: 200px;
    padding: 0.5rem;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    object-fit: contain;
    background: #fff;
}

.ss-view-actions {
    display: flex;
    gap: 0.5rem;
}

.ss-view-empty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary, #6b7280);
    font-size: 0.875rem;
    padding: 0.25rem 0;
}
