/* Styles for the document-level modal overlays spawned dynamically by
   registration-form.js (camera capture, map picker, recovery-phrase grid).
   These overlays are appended to document.body — outside any shadow DOM —
   so they need document-level styling that inherits CSS variables from
   base.css. The <alert-dialog> Web Component has its own shadow-scoped
   styles in styles/alert-dialog.css and does not use this file. */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal {
    background: var(--surface-color, #ffffff);
    color: var(--text-color, #0f172a);
    border-radius: 12px;
    width: min(720px, 100%);
    height: min(640px, 90vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong-color, #0f172a);
}

.modal-hint {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted-color, #64748b);
}

.map-container {
    flex: 1;
    width: 100%;
    min-height: 0;
}

.modal-overlay .leaflet-container,
.modal-overlay .leaflet-container * {
    box-sizing: content-box;
}

.modal-overlay .leaflet-touch .leaflet-bar a,
.modal-overlay .leaflet-touch .leaflet-bar a:hover,
.modal-overlay .leaflet-touch .leaflet-bar a:focus,
.modal-overlay .leaflet-touch .leaflet-bar a:active,
.modal-overlay .leaflet-bar a,
.modal-overlay .leaflet-bar a:hover,
.modal-overlay .leaflet-bar a:focus,
.modal-overlay .leaflet-bar a:active {
    display: block;
    box-sizing: content-box;
    width: 26px;
    height: 26px;
    padding: 0;
    margin: 0;
    line-height: 26px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    color: #000;
    border-radius: 0;
}

.modal-overlay .leaflet-bar a:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.modal-overlay .leaflet-bar a:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.modal-overlay .leaflet-marker-icon,
.modal-overlay .leaflet-interactive {
    outline: none;
    box-shadow: none;
    background: none;
    border: none;
}

.modal-overlay .leaflet-marker-icon:focus,
.modal-overlay .leaflet-marker-icon:focus-visible,
.modal-overlay .leaflet-interactive:focus,
.modal-overlay .leaflet-interactive:focus-visible {
    outline: none;
    box-shadow: none;
    background: none;
}

.camera-stage {
    flex: 1;
    min-height: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}

.camera-video {
    height: 100%;
    width: auto;
    aspect-ratio: 7 / 9;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    background: #111;
    border-radius: 6px;
    outline: 2px dashed rgba(255, 255, 255, 0.7);
    outline-offset: 4px;
    display: block;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

/* Copy — and the Verify beside it, when the dialog offers one — sits left of
   the gap; the auto margin pushes Cancel and the confirm action to the right
   edge, and moves onto Verify whenever it follows Copy. */
.modal-actions .copy-button,
.modal-actions .verify-button {
    margin-inline-end: auto;
}

.modal-actions .copy-button:has(+ .verify-button) {
    margin-inline-end: 0;
}

/* The save-recovery-phrase dialog groups its four actions into two rows —
   Copy and Verify, then Cancel and "I have saved it" — because four labels
   in one line get cut on a narrow screen. The rows stack, and each row's two
   buttons share it evenly (dropping the left-alignment auto margins above). */
.modal-actions:has(.modal-actions-row) {
    flex-direction: column;
}

.modal-actions-row {
    display: flex;
    gap: 8px;
}

.modal-actions .modal-actions-row button {
    flex: 1;
    margin-inline-end: 0;
}

.mnemonic-modal {
    height: auto;
    max-height: 90vh;
}

.mnemonic-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.mnemonic-body p {
    margin: 0 0 12px;
    color: var(--text-label-color, #334155);
    font-size: 14px;
}

.mnemonic-body p.mnemonic-warning {
    background: #fef3c7;
    color: #78350f;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
}

.mnemonic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 12px;
    margin-top: 12px;
}

.mnemonic-word,
.mnemonic-word-input {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.mnemonic-word {
    padding: 6px 8px;
    background: var(--surface-muted-color, #f1f5f9);
    border-radius: 4px;
}

.mnemonic-word-number {
    color: var(--text-muted-color, #64748b);
    font-weight: 500;
    min-width: 22px;
    text-align: end;
}

.mnemonic-word-text {
    color: var(--text-strong-color, #0f172a);
    font-weight: 600;
}

.mnemonic-word-input input {
    flex: 1;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 6px 8px;
    font-size: 14px;
    line-height: 1.4;
    font-family: inherit;
    border: 1px solid var(--input-border-color, #cbd5e1);
    border-radius: 4px;
    background: var(--input-background-color, #ffffff);
    color: var(--input-text-color, #0f172a);
}

.mnemonic-word-input input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* A word outside the phrase's own dictionary (recovery-phrase.js marks them
   after a failed submit): a typo, shown as one. */
.mnemonic-word-input input.mnemonic-word-unknown {
    color: #b91c1c;
    border-color: #ef4444;
}

.mnemonic-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .mnemonic-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


