/*
 * The header's wallet control and its dialog (wallet-ui.js). Colours come
 * from app.css's theme tokens, so light, dark and auto follow the page.
 */

.wallet-slot {
    position: relative;
    display: flex;
    align-items: center;
    flex: none;
}

.wallet-connect {
    height: 30px;
    padding: 0 12px;
    border-color: var(--ink);
    background: var(--ink);
    color: var(--surface);
    font-size: 13px;
    font-weight: 600;
}

.wallet-connect:hover {
    background: color-mix(in srgb, var(--ink) 84%, var(--surface));
}

.wallet-icon,
.wallet-chevron,
.wallet-close-icon,
.wallet-mark-glyph {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn .wallet-icon path,
.btn .wallet-chevron path,
.btn .wallet-close-icon path,
.btn .wallet-mark-glyph path {
    fill: none;
}

.wallet-chevron {
    width: 12px;
    height: 12px;
    color: var(--ink-2);
}

/* A neutral monogram tile per wallet (not the wallets' logos). */
.wallet-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: var(--ink);
    color: var(--surface);
}

.wallet-mark--unisat {
    border-radius: 50%;
}

.wallet-mark .wallet-mark-glyph {
    width: 13px;
    height: 13px;
    stroke-width: 2;
}

.wallet-account-wrap {
    position: relative;
}

.wallet-account {
    height: 30px;
    padding: 0 8px 0 6px;
    gap: 7px;
    font-size: 13px;
}

.wallet-account[aria-expanded="true"] {
    background: var(--chip);
}

.wallet-account-dot {
    display: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--good);
}

/* --------------------------------------------------------------- menu */

.wallet-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    width: 280px;
    max-width: calc(100vw - 24px);
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.wallet-menu-head {
    padding: 6px 8px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--grid);
}

.wallet-menu-wallet {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    font-size: 12.5px;
}

.wallet-menu-wallet .wallet-mark {
    width: 18px;
    height: 18px;
}

.wallet-menu-address {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.wallet-menu-payment {
    margin-top: 4px;
    color: var(--ink-2);
    font-size: 12px;
}

.wallet-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.wallet-menu-item:hover,
.wallet-menu-item:focus-visible {
    background: var(--hover);
}

.wallet-menu-item:focus-visible {
    outline-offset: -2px;
}

.wallet-menu-item--quiet {
    color: var(--ink-2);
}

.wallet-menu-sep {
    height: 1px;
    margin: 4px 0;
    background: var(--grid);
}

/* A note under the control when the wallet drops the session. */
.wallet-note {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 29;
    width: 280px;
    max-width: calc(100vw - 24px);
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--warning) 55%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--warning) 14%, var(--surface));
    box-shadow: var(--shadow);
    font-size: 12.5px;
}

/* ------------------------------------------------------------- dialog */

dialog.wallet-dialog {
    width: min(400px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
    overflow: auto;
}

dialog.wallet-dialog::backdrop {
    background: var(--backdrop);
}

.wallet-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 10px 4px 20px;
}

.wallet-dialog-title {
    font-size: 17px;
    font-weight: 650;
}

.wallet-dialog-close .wallet-close-icon {
    width: 16px;
    height: 16px;
}

.wallet-dialog-lede {
    padding: 0 20px 14px;
    color: var(--ink-2);
    font-size: 13px;
}

.wallet-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0 16px;
    list-style: none;
}

.wallet-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    border: 1px solid var(--grid);
    border-radius: 10px;
}

.wallet-option.is-missing {
    padding: 0 12px;
    color: var(--ink-2);
}

.wallet-option .wallet-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
}

.wallet-option .wallet-mark--unisat {
    border-radius: 50%;
}

.wallet-option .wallet-mark .wallet-mark-glyph {
    width: 17px;
    height: 17px;
}

.wallet-option.is-missing .wallet-mark {
    background: var(--chip);
    color: var(--ink-2);
}

.wallet-option-button {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wallet-option-button:hover:not([disabled]) {
    background: var(--hover);
}

.wallet-option-button[disabled] {
    cursor: default;
}

.wallet-option-button[disabled]:not(.is-busy) {
    opacity: 0.55;
}

.wallet-option-name {
    flex: 1 1 auto;
    font-size: 15px;
    font-weight: 600;
}

.wallet-option.is-missing .wallet-option-name {
    font-weight: 500;
}

.wallet-option-state {
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--good) 12%, var(--surface));
    color: var(--ink);
    font-size: 12px;
}

.wallet-option-button.is-busy .wallet-option-state {
    background: var(--chip);
}

.wallet-option-install {
    padding: 4px 10px;
    border: 1px solid var(--control-border);
    border-radius: 6px;
    color: var(--ink);
    font-size: 13px;
    text-decoration: none;
}

.wallet-option-install:hover {
    background: var(--hover);
}

.wallet-dialog-status {
    margin: 12px 16px 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--wash);
    font-size: 13px;
}

.wallet-dialog-status.is-error {
    background: color-mix(in srgb, var(--critical) 10%, var(--surface));
}

.wallet-dialog-foot {
    padding: 14px 20px 18px;
    color: var(--ink-2);
    font-size: 12px;
}

/* ------------------------------------------------------------- phones */

/* The control's sizes at each width: header.css. */
@media (max-width: 719.98px) {
    dialog.wallet-dialog {
        margin: auto auto 12px;
    }
}

@media (forced-colors: active) {
    .wallet-connect,
    .wallet-mark {
        border: 1px solid ButtonText;
    }

    .wallet-account-dot {
        background: Highlight;
    }
}
