/* ====================================================================
   Signature A4 practice-sheet modal — self-contained styles.
   © onlinesignatures.net — All rights reserved.

   Used by <x-signature-a4-modal/> (the generator + any page that drops it).
   Fully self-contained: it declares its own tokens on .ms-a4 and scopes the
   button styles inside the modal, so it needs NO page CSS and never touches
   a global `.ms-btn`. The /my-signatures page keeps its own copy of these
   rules in my-signatures-v2.css (that page is intentionally left untouched).
   Fully responsive: two columns → one on tablets, full-screen on phones.
   ==================================================================== */
.ms-a4 {
    --ms-accent: var(--color-main, #4f46e5);
    --ms-ink: var(--color-text, #1f2d3d);
    --ms-muted: #8a93a5;
    --ms-border: rgba(31, 45, 61, 0.10);
    --ms-radius: 16px;
    --ms-radius-sm: 10px;
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ms-a4[hidden] { display: none; }
.ms-a4__backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, 0.55); backdrop-filter: blur(2px); }
.ms-a4__dialog {
    position: relative;
    width: min(860px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--ms-radius);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.30);
    overflow: hidden;
    color: var(--ms-ink);
    font-family: inherit;
}
.ms-a4__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--ms-border);
}
.ms-a4__title { margin: 0; font-size: 19px; }
.ms-a4__x {
    width: 36px; height: 36px;
    border: none; background: transparent; cursor: pointer;
    color: var(--ms-muted); border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
}
.ms-a4__x:hover { background: rgba(0, 0, 0, 0.05); color: var(--ms-ink); }
.ms-a4__x svg { width: 22px; height: 22px; display: block; }
.ms-a4__body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 22px;
    padding: 22px;
    overflow: auto;
}
.ms-a4__controls { display: flex; flex-direction: column; gap: 20px; }
.ms-a4__group { display: flex; flex-direction: column; gap: 8px; }
.ms-a4__label { font-weight: 600; font-size: 14px; color: var(--ms-ink); }
.ms-a4__hint { color: var(--ms-muted); font-size: 12px; }
.ms-a4__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ms-a4__chip {
    width: 46px; height: 42px;
    border: 1px solid var(--ms-border);
    border-radius: var(--ms-radius-sm);
    background: #fff; color: var(--ms-ink);
    font-weight: 700; font-size: 15px; cursor: pointer;
    transition: all .15s ease;
}
.ms-a4__chip:hover { border-color: var(--ms-accent); }
.ms-a4__chip.is-on { background: var(--ms-accent); color: #fff; border-color: var(--ms-accent); }
.ms-a4__group input[type="range"] { width: 100%; accent-color: var(--ms-accent); }
.ms-a4__toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; color: var(--ms-ink); }
.ms-a4__toggle input { width: 18px; height: 18px; accent-color: var(--ms-accent); }
.ms-a4__preview {
    display: flex; align-items: flex-start; justify-content: center;
    background: #f3f4f9; border-radius: var(--ms-radius-sm); padding: 14px;
}
#sigA4Canvas {
    width: 100%;
    max-width: 372px;
    height: auto;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    border-radius: 4px;
}
.ms-a4__foot {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    padding: 16px 22px; border-top: 1px solid var(--ms-border);
}


.ms-a4 .ms-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border-radius: var(--ms-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.ms-a4 .ms-btn svg { width: 18px; height: 18px; display: block; }
.ms-a4 .ms-btn--primary { background: var(--ms-accent); color: #fff; flex: 1 1 auto; }
.ms-a4 .ms-btn--primary:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.30); filter: brightness(1.03); }
.ms-a4 .ms-btn--ghost {
    background: #fff;
    color: var(--ms-ink);
    border-color: var(--ms-border);
    position: relative;
    flex: 1 1 auto;
}
.ms-a4 .ms-btn--ghost:hover { border-color: var(--ms-accent); color: var(--ms-accent); transform: translateY(-1px); }


@media (max-width: 991.98px) {
    .ms-a4__body { grid-template-columns: 1fr; }
    .ms-a4__preview { order: -1; }
    #sigA4Canvas { max-width: 300px; }
}
@media (max-width: 575.98px) {
    .ms-a4 { padding: 0; align-items: stretch; }
    .ms-a4__dialog { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
    .ms-a4__foot { flex-wrap: wrap; }
    .ms-a4__foot .ms-btn { flex: 1 1 100%; }
}
