/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* Copyright (C) 2026 Tech1k */
/* TestnetSwap stylesheet — the shared, token-driven design system from the
   testnet suite (CypherFaucet / TestnetPool / TestnetWallet), reused verbatim
   so the look matches, plus a "TestnetSwap additions" block at the bottom for
   the swap-specific components. Dark by default; light auto-applies via
   prefers-color-scheme, no JS toggle. */

:root {
    color-scheme: dark;

    --bg:        #14161b;
    --surface:   #232730;
    --card:      #1c1f27;
    --border:    #2a2e37;
    --border2:   #353b46;
    --text:      #e6e8ec;
    --muted:     #9aa0ab;

    --accent:     #6b86ff;
    --accent-soft:#9db2ff;
    --accent-bg:  rgba(107, 134, 255, 0.13);
    --btn:        #5066d6;
    --on-accent:  #ffffff;

    --ok:   #4fbf75; --ok-bg:   rgba(79, 191, 117, 0.13);
    --bad:  #ef6b6b; --bad-bg:  rgba(239, 107, 107, 0.13);
    --warn: #e0894f; --warn-bg: rgba(224, 137, 79, 0.13);

    --nav-bg: rgba(20, 22, 27, 0.86);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'DejaVu Sans Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    --r: 10px;
    --r-sm: 7px;
    --pill: 999px;
    --maxw: 760px;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;

        --bg:        #f7f7f7;
        --surface:   #f4f5f7;
        --card:      #ffffff;
        --border:    #e5e5e5;
        --border2:   #d8dbe0;
        --text:      #1b1d23;
        --muted:     #6b6b6b;

        --accent:     #4561eb;
        --accent-soft:#2f49c9;
        --accent-bg:  rgba(69, 97, 235, 0.10);
        --btn:        #3f57e0;

        --ok:   #1f6b38; --ok-bg:   rgba(31, 107, 56, 0.12);
        --bad:  #b52a2a; --bad-bg:  rgba(181, 42, 42, 0.10);
        --warn: #a04a25; --warn-bg: rgba(160, 74, 37, 0.10);

        --nav-bg: rgba(255, 255, 255, 0.85);
    }
}

/* ---- Base -------------------------------------------------------------- */
* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

a, a:visited { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site_link { color: var(--accent); }
.site_link:hover { text-decoration: underline; }

code, pre, .mono { font-family: var(--mono); }
.mono { word-break: break-word; }

/* ---- Layout ------------------------------------------------------------ */
#main {
    width: 90%;
    max-width: var(--maxw);
    align-self: center;
    margin: 24px 0 0;
    flex: 1 0 auto;
}

/* Short pages (e.g. the homepage): pin the footer to the bottom of the viewport
   via flexbox instead of padding it down with empty <br> tags. */
#main.filled { display: flex; flex-direction: column; }
#main.filled footer { margin-top: auto; }

/* ---- Nav (frosted, sticky, full-bleed; content capped to --maxw) ------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 12px max(20px, calc((100% - var(--maxw)) / 2));
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.navbar a { text-decoration: none; font-weight: 600; }
.navbar img { max-height: 38px; display: block; }

/* Brand wordmark: live "CypherFaucet" text in the nav (replaces the baked banner) */
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: 0.2px; }

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.nav-links a {
    color: var(--muted);
    font-size: 15px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

#curpage {
    color: var(--accent) !important;
    background: var(--accent-bg);
}

/* CSS-only hamburger (mobile) */
.menu-toggle { display: none; }
.hamburger { display: none; flex-direction: column; cursor: pointer; gap: 5px; }
.hamburger div { width: 25px; height: 3px; background: var(--text); border-radius: 2px; }

@media (max-width: 620px) {
    .hamburger { display: flex; }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        margin-top: 6px;
    }
    .nav-links a { width: 100%; }
    .menu-toggle:checked + .hamburger + .nav-links { display: flex; }
}

/* ---- Cards ------------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    margin: 16px 0;
    width: 100%;
}

.card-header {
    background: var(--surface);
    padding: 13px 18px;
    font-weight: 700;
    font-size: 1em;
    border-bottom: 1px solid var(--border);
}

.card-body { padding: 16px 18px; }

/* Status cards: soft tinted header + matching border, via the role tokens.
   .success / .alert land on the card-header; the *border classes on the card. */
.success { background: var(--ok-bg) !important; color: var(--ok); border-bottom-color: var(--ok); }
.successborder { border-color: var(--ok); }
.alert { background: var(--bad-bg) !important; color: var(--bad); border-bottom-color: var(--bad); }
.alertborder { border-color: var(--bad); }

/* ---- Forms ------------------------------------------------------------- */
.forminput-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    font-size: 0.875rem;
}

.forminput {
    width: 100%;
    padding: 0.7em 0.75em 0.7em 2.4em;
    border: 1px solid var(--border2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.forminput::placeholder { color: var(--muted); }
.forminput:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.icon-left {
    position: absolute;
    left: 0.6em;
    top: 50%;
    transform: translateY(-50%);
    height: 1.5em;
    width: 1.5em;
    pointer-events: none;
}
.icon-left img { height: 100%; width: auto; display: block; }

.formbtn {
    width: 100%;
    padding: 0.7em 1em;
    background: var(--btn);
    border: 1px solid var(--btn);
    color: var(--on-accent);
    font-family: inherit;
    font-size: 1.02rem;
    font-weight: 600;
    border-radius: var(--pill);
    cursor: pointer;
    transition: filter 0.15s ease;
}
.formbtn:hover { filter: brightness(1.08); }
.formbtn:disabled { opacity: 0.5; cursor: default; }

/* ---- Copy buttons (used inline throughout for addresses, txids, etc.) --- */
.copybtn {
    font-size: 12px;
    padding: 3px 10px;
    margin-left: 6px;
    vertical-align: middle;
    cursor: pointer;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: var(--pill);
    font-family: inherit;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.copybtn:hover { background: var(--accent-bg); border-color: var(--accent); text-decoration: none; }

/* ---- Status badge + dots (node sync line) ------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--pill);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.9em;
    font-weight: 600;
}

.dot { font-size: 0.85em; line-height: 1; }
.dot-ok { color: var(--ok); }
.dot-warn { color: var(--warn); }
.dot-off { color: var(--muted); }

/* ---- QR swatch (donation codes; white so they scan in both themes) ----- */
.qr {
    display: inline-block;
    margin-top: 8px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    line-height: 0;
}
.qr img { display: block; width: 180px; max-width: 100%; height: auto; }

/* ---- Footer ------------------------------------------------------------ */
footer { margin-top: 40px; padding-bottom: 28px; }
footer hr { border: none; border-top: 1px solid var(--border); margin: 0 auto; }
footer p { color: var(--muted); }
footer a, footer a:visited { color: var(--accent); }
footer a:hover { text-decoration: underline; }

/* ===================================================================== */
/* TestnetSwap additions — swap-specific components, built on the tokens  */
/* above so they inherit the suite's dark/light theming automatically.    */
/* ===================================================================== */

/* Two-tone wordmark, matching TestnetWallet ("Testnet" + accent second word) */
.brand-name b { color: var(--accent); font-weight: 700; }

/* External-link marker */
.ext::after { content: "\2197"; font-size: .72em; opacity: .55; margin-left: 2px; vertical-align: 1px; }

/* Generic helpers */
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.addr { font-family: var(--mono); font-size: 13px; word-break: break-all; }
h1, h2, h3 { line-height: 1.25; }
.lede { font-size: 1.08rem; color: var(--muted); margin: 6px 0 0; }

/* Hero */
.hero { background: var(--accent-bg); border-color: var(--border2); }
.hero .card-body { padding: 22px 18px; }
.hero h1 { margin: 0 0 6px; font-size: 1.7rem; }

/* Live maker status pill */
.statusline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* Stat tiles (liquidity / rate / uptime) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.25rem; font-weight: 700; margin-top: 2px; }
.stat .v small { font-size: .6em; font-weight: 600; color: var(--muted); }

/* Swap widget */
.swapbox { display: flex; flex-direction: column; gap: 12px; }
.legrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.leg label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.amount-in { display: flex; align-items: stretch; border: 1px solid var(--border2); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.amount-in input { flex: 1; border: 0; background: transparent; color: var(--text); padding: .7em .75em; font: inherit; font-size: 1.05rem; min-width: 0; }
.amount-in input:focus { outline: none; }
.amount-in .coin { display: flex; align-items: center; padding: 0 .8em; background: var(--card); border-left: 1px solid var(--border); font-weight: 700; }
.recv { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .7em .75em; font-size: 1.05rem; }
.recv b { font-weight: 700; }

/* Direction flip button */
.flip { align-self: center; }
.flipbtn { width: 38px; height: 38px; border-radius: var(--pill); border: 1px solid var(--border2); background: var(--surface); color: var(--text); cursor: pointer; font-size: 16px; transition: transform .2s ease, background-color .15s ease; }
.flipbtn:hover { background: var(--accent-bg); border-color: var(--accent); transform: rotate(180deg); }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; padding: 3px 0; }
.kv .muted { color: var(--muted); }

/* Buttons (reuse .formbtn from canonical; add a ghost/secondary variant) */
.btn-secondary { display: inline-block; text-align: center; padding: .6em 1.1em; border-radius: var(--pill); border: 1px solid var(--border2); background: transparent; color: var(--text); font-weight: 600; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-bg); text-decoration: none; }
a.formbtn { display: inline-block; text-align: center; text-decoration: none; }
a.formbtn:hover { text-decoration: none; }

/* Steps (how it works) */
.steps { display: grid; gap: 12px; counter-reset: step; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.step .n { counter-increment: step; width: 30px; height: 30px; border-radius: var(--pill); background: var(--accent-bg); color: var(--accent); border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.step .n::before { content: counter(step); }
.step h3 { margin: 2px 0 2px; font-size: 1rem; }
.step p { margin: 0; color: var(--muted); font-size: .94rem; }

/* Definition-style feature list */
.feature { margin: 0 0 12px; }
.feature h3 { margin: 0 0 2px; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); }

/* Code block for API docs */
pre.code { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; font-size: 13px; }

/* Tiny inline pair badge */
.pairbadge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--pill); background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: .9em; }

/* ---- TestnetSwap in-browser swap page additions ---- */
.card-sub { font-weight: 700; margin: 0 0 .4em; }
.formbtn.ghost { background: transparent; border: 1px solid var(--border2); color: var(--text); }
.formbtn.ghost:hover { border-color: var(--accent); background: var(--accent-bg); filter: none; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#flow:empty { display: none; }
#flow { margin-top: 14px; }
.deposit .addrbox, .addrbox { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r-sm); padding: .6em .7em; }
.addrbox .mono { font-family: var(--mono); font-size: 13px; word-break: break-all; flex: 1; min-width: 0; }
.copy { cursor: pointer; background: var(--card); border: 1px solid var(--border); color: var(--accent); border-radius: var(--r-sm); padding: .25em .6em; font-size: 12px; font-weight: 600; }
.copy:hover { border-color: var(--accent); }
.mono-link { display: block; font-family: var(--mono); font-size: 12px; word-break: break-all; margin-top: 6px; }
.swap-line { font-size: 14px; color: var(--text); padding: 3px 0; }
.swap-line.wait { color: var(--muted); }
.pbar { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; margin: 10px 0; }
.pbar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.pbar.indet > span { width: 40%; animation: pslide 1.15s ease-in-out infinite; }
@keyframes pslide { 0% { transform: translateX(-110%); } 100% { transform: translateX(275%); } }
@media (prefers-reduced-motion: reduce) { .pbar.indet > span { animation: none; width: 100%; } }
