/* COIN CHOICE: the "which coins do I get paid in" picker (coin-choice.js).
   Every class starts with cc-. Colours come from the market.css tokens; the
   fallbacks after the commas only matter if a page forgot to load market.css.
   Used in the Seller Dashboard ("Coins I accept") and sell wizard step 4. */

.cc {
    position: relative;
    min-width: 0;
}

.cc *,
.cc *::before,
.cc *::after {
    box-sizing: border-box;
}

/* Screen-reader-only text (announcements, "why is this box disabled"). */
.cc-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- top row: how many are ticked + tick-all ---------- */

.cc-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    min-height: 28px;
    margin-bottom: 12px;
}

.cc-count {
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-dim, #aab4bf);
}

/* A text-style button: "Change", "Tick all", "Cancel". */
.cc-link {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: #7db0ff;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.cc-link:hover { color: #a9c9ff; }

.cc-link:focus-visible {
    border-radius: 3px;
    outline: 2px solid #7db0ff;
    outline-offset: 2px;
}

/* ---------- tiles ---------- */

.cc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 12px;
    align-items: start;
}

.cc-tile {
    min-width: 0;
    background: var(--bg-2, #171f27);
    border: 1px solid var(--border, #232d37);
    border-radius: 10px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cc-tile:hover { border-color: #34424e; }

/* Ticked: blue border and tint, plus the filled box below, so it is not only colour. */
.cc-tile.is-on {
    border-color: var(--accent, #3b82f6);
    background:
        linear-gradient(var(--accent-soft, rgba(59, 130, 246, 0.14)), var(--accent-soft, rgba(59, 130, 246, 0.14))),
        var(--bg-2, #171f27);
}

/* No payout address yet: dashed edge, box is locked until an address is saved. */
.cc-tile.is-needs {
    border-style: dashed;
    border-color: #3a4652;
}

.cc-tile.is-needs:hover { border-color: #3a4652; }

.cc-main {
    position: relative;
    display: grid;
    grid-template-columns: 22px 36px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cc-tile.is-needs .cc-main { cursor: default; }

/* The real checkbox sits invisibly on top of the drawn box, so it stays
   focusable, clickable and announced as a checkbox. */
.cc-check {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 22px;
    height: 22px;
    margin: -11px 0 0;
    opacity: 0;
    cursor: pointer;
}

.cc-check:disabled { cursor: not-allowed; }

.cc-box {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 2px solid var(--text-muted, #6b7684);
    border-radius: 6px;
    background: var(--bg-1, #10161c);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cc-box::after {
    content: "";
    width: 6px;
    height: 11px;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.cc-check:checked + .cc-box {
    background: var(--accent, #3b82f6);
    border-color: var(--accent, #3b82f6);
}

.cc-check:checked + .cc-box::after { opacity: 1; }

.cc-check:disabled + .cc-box {
    border-style: dashed;
    border-color: #3a4652;
    background: transparent;
}

.cc-check:focus-visible + .cc-box {
    outline: 2px solid #7db0ff;
    outline-offset: 2px;
}

.cc-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--bg-3, #1e2830);
}

.cc-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.cc-letter {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-dim, #aab4bf);
}

.cc-tile.is-needs .cc-icon { opacity: 0.7; }

.cc-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cc-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    min-width: 0;
}

.cc-name {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text, #fff);
    overflow-wrap: anywhere;
}

.cc-sym {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-dim, #aab4bf);
    overflow-wrap: anywhere;
}

.cc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    min-width: 0;
}

.cc-chip {
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-dim, #aab4bf);
    overflow-wrap: anywhere;
}

.cc-chip-stable {
    background: rgba(31, 191, 107, 0.14);
    color: var(--green, #1fbf6b);
}

.cc-chip-warn {
    background: rgba(245, 166, 35, 0.14);
    color: var(--orange, #f5a623);
}

.cc-fee {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-dim, #aab4bf);
    overflow-wrap: anywhere;
}

/* ---------- address part of a tile ---------- */

.cc-addr {
    padding: 10px 14px 14px;
    border-top: 1px solid var(--border, #232d37);
}

.cc-tile.is-needs .cc-addr { border-top-style: dashed; }

.cc-addr-saved {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2px 10px;
}

.cc-ok {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--green, #1fbf6b);
}

.cc-tick {
    flex-shrink: 0;
}

.cc-addr-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text, #fff);
    overflow-wrap: anywhere;
}

.cc-addr-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cc-addr-input {
    flex: 4 1 150px;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #5a6675;
    border-radius: 7px;
    background: var(--bg-1, #10161c);
    color: var(--text, #fff);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    text-overflow: ellipsis;
}

.cc-addr-input::placeholder {
    font-family: "Inter", sans-serif;
    color: #8593a3;
}

.cc-addr-input:focus-visible {
    border-color: var(--accent, #3b82f6);
    outline: 2px solid #7db0ff;
    outline-offset: 1px;
}

.cc-addr-input[aria-invalid="true"] { border-color: rgba(239, 68, 68, 0.7); }

.cc-addr .btn {
    flex: 1 0 auto;
    height: 40px;
    padding: 0 16px;
}

.cc-addr .btn:focus-visible {
    outline: 2px solid #7db0ff;
    outline-offset: 2px;
}

.cc-addr-cancel {
    margin-top: 6px;
}

.cc-addr-hint {
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-dim, #aab4bf);
}

.cc-addr-err {
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.45;
    color: #f87171;
    overflow-wrap: anywhere;
}

.cc-addr-err[hidden] { display: none; }

/* ---------- save row + notes ---------- */

.cc-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 16px;
}

.cc-foot .btn {
    flex: 0 0 auto;
    min-height: 40px;
}

.cc-foot .btn:focus-visible {
    outline: 2px solid #7db0ff;
    outline-offset: 2px;
}

.cc-status {
    flex: 1 1 200px;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-dim, #aab4bf);
    overflow-wrap: anywhere;
}

.cc-status:empty { display: none; }
.cc-status.is-ok { color: var(--green, #1fbf6b); }
.cc-status.is-warn { color: var(--orange, #f5a623); }
.cc-status.is-err { color: #f87171; }

.cc-note {
    margin-top: 12px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-dim, #aab4bf);
}

/* ---------- loading / empty / failed / signed-out ---------- */

.cc-skel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 12px;
}

.cc-skel-tile {
    height: 74px;
    border: 1px solid var(--border, #232d37);
    border-radius: 10px;
    background: linear-gradient(90deg, var(--bg-2, #171f27) 0%, var(--bg-3, #1e2830) 50%, var(--bg-2, #171f27) 100%);
    background-size: 200% 100%;
    animation: cc-shimmer 1.4s linear infinite;
}

@keyframes cc-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.cc-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 16px;
    border: 1px solid var(--border, #232d37);
    border-radius: 10px;
    background: var(--bg-2, #171f27);
}

.cc-panel.is-error { border-color: rgba(239, 68, 68, 0.45); }

.cc-panel-text {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cc-panel-text strong {
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--text, #fff);
}

.cc-panel.is-error .cc-panel-text strong { color: #f87171; }

.cc-panel-text span {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-dim, #aab4bf);
}

.cc-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cc-panel .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    text-align: center;
}

/* ---------- blocks that hold the picker on host pages ---------- */

/* Sell wizard step 4 ("Get paid in"). */
.cc-block {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border, #232d37);
}

.cc-block-title {
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text, #fff);
}

.cc-block .settings-hint { margin-bottom: 14px; }

.cc-notice {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(245, 166, 35, 0.45);
    border-radius: var(--radius, 8px);
    background: rgba(245, 166, 35, 0.08);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--orange, #f5a623);
    overflow-wrap: anywhere;
}

.cc-notice[hidden] { display: none; }

/* ---------- small screens ---------- */

@media (max-width: 480px) {
    .cc-main {
        grid-template-columns: 22px 32px minmax(0, 1fr);
        gap: 10px;
        padding: 11px 12px;
    }

    .cc-check { left: 12px; }
    .cc-icon { width: 32px; height: 32px; }
    .cc-letter { font-size: 13px; }
    .cc-addr { padding: 10px 12px 12px; }

    /* 16px keeps iPhones from zooming into the box when it is tapped. */
    .cc-addr-input { font-size: 16px; }

    .cc-foot .btn,
    .cc-panel-actions,
    .cc-panel-actions .btn { width: 100%; }
}

/* ---------- accessibility preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    .cc-skel-tile { animation: none; }

    .cc-tile,
    .cc-box { transition: none; }
}

@media (forced-colors: active) {
    /* The site's .btn has no border, so without this a button reads as plain text. */
    .cc .btn { border: 1px solid ButtonText; }
    .cc-tile.is-on { border-color: Highlight; }
    .cc-check:checked + .cc-box { background: Highlight; border-color: Highlight; }
    .cc-box::after { border-color: HighlightText; }
    .cc-check:focus-visible + .cc-box,
    .cc-addr-input:focus-visible { outline-color: CanvasText; }
}
