/* =============================
   TokenForge — Unified Dark Theme
   ============================= */

/* THEME TOKENS */
:root {
    --bg: #0c0813;
    --bg-2: #110a1f;
    --surface: #16102b;
    --card: #171232;
    --card-2: #120e27;
    --border: #2a1e59;
    --dash: #3a2d74;
    --text: #efeaff;
    --muted: #bfb4ee;
    --primary: #c07cff;
    --primary-2: #8f5bff;
    --accent: #ff7cd3;
    --ok: #78ffa0;
    --warn: #ffd36e;
    --danger: #ff6b88;
    --code-bg: #0e0a1c;
    --r: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);

    /* hover glow colors */
    --glow-green: #52ffa6;
    --glow-red: #ff3b53;
    --glow-violet: #b98cff;

    /* global spacing scale */
    --space-1: 6px;
    --space-2: 8px;
    --space-3: 10px;
    --space-4: 12px;
    --space-5: 16px;
    --space-6: 20px;
    --space-7: 22px;
    --space-8: 24px;

    /* nav height */
    --nav-height: 60px;
}

/* RESET & BASE */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: #0b1030;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* kill any ambient/mist layers if present */
body::before,
body.mist-on::after {
    opacity: 0 !important;
    animation: none !important;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* LAYOUT */
.wrap {
    max-width: 1360px;
    margin: 28px auto;
    padding: 0 12px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

@media (max-width:1080px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

section.col-left,
section.col-right {
    display: flex;
    flex-direction: column;
    gap: var(--space-7);
}

/* ROWS */
.row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.row2.align-start {
    align-items: start;
}

.row2.align-end {
    align-items: end;
}

@media (max-width:780px) {
    .row2 {
        grid-template-columns: 1fr;
    }
}

.row3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width:980px) {
    .row3 {
        grid-template-columns: 1fr;
    }
}

/* === NAV (canonique, identique sur toutes les pages) === */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(18, 12, 33, .85), rgba(12, 8, 19, .85));
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1360px;
    margin: 0 auto;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--nav-height);
}

/* NAV brand : texte dégradé + logo inline visible (pas d’injection ni d’animation) */
.nav .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-weight: 800;
    letter-spacing: .3px;

    /* fallback blanc si pas de clip supporté */
    color: #ffffff;

    /* dégradé vert → orange → bleu */
    background: linear-gradient(90deg, #78FFA0 0%, #FFB33F 50%, #4FD3FF 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    /* visible sur Chrome/Safari/Edge récents */
}

.nav .brand .dot {
    display: none !important;
}

/* évite la pastille doublon */

/* logo inline (svg/img) dimension */
.nav .brand svg,
.nav .brand img {
    display: inline;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Liens de nav */
.nav a.link {
    color: #efeaff;
    padding: 8px 10px;
    border-radius: 10px;
}

.nav a.link:hover,
.nav a.link.active {
    background: #1b1336;
    text-decoration: none;
}

.nav .spacer {
    flex: 1;
}

/* Cache le badge MAINNET dans la nav (si présent dans le HTML) */
.nav .badge {
    display: none !important;
}

/* CARDS */
.card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: var(--space-6);
    box-shadow: var(--shadow);
    transition: border-color .16s ease, box-shadow .16s ease;
}

/* reusable card glow variants */
.card.glow-green:hover,
.card.glow-green:focus-within {
    border-color: var(--glow-green);
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--glow-green) 35%, transparent), 0 0 24px color-mix(in oklab, var(--glow-green) 40%, transparent);
}

.card.glow-red:hover,
.card.glow-red:focus-within {
    border-color: var(--glow-red);
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--glow-red) 35%, transparent), 0 0 24px color-mix(in oklab, var(--glow-red) 40%, transparent);
}

.card.glow-violet:hover,
.card.glow-violet:focus-within {
    border-color: var(--glow-violet);
    box-shadow: 0 0 0 2px color-mix(in oklab, var(--glow-violet) 35%, transparent), 0 0 24px color-mix(in oklab, var(--glow-violet) 45%, transparent);
}

/* convenience */
.swap-card:hover,
.swap-card:focus-within {
    border-color: var(--glow-green);
    box-shadow: 0 0 0 2px rgba(82, 255, 166, .25), 0 0 24px rgba(82, 255, 166, .35);
}

/* TITLES & TEXT */
.title {
    margin: 0 0 var(--space-3);
}

.subtitle {
    margin: 0 0 var(--space-2);
    color: var(--muted);
    font-size: 13px;
}

.center {
    text-align: center;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.hint {
    font-size: 12px;
    color: #cdbfff;
}

.muted {
    font-size: 14px;
    color: var(--muted);
}

.ok {
    color: var(--ok);
}

.err {
    color: var(--danger);
}

.warn {
    color: var(--warn);
}

/* FORMS & BUTTONS */
label {
    display: block;
    font-size: 14px;
    color: #e0d6ff;
    margin-bottom: var(--space-2);
}

input,
select,
button,
textarea {
    width: 100%;
    font-size: 16px;
    background: #130e27;
    color: var(--text);
    border: 1px solid #3a2b77;
    border-radius: 12px;
    padding: 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, filter .15s, transform .04s;
}

input::placeholder,
textarea::placeholder {
    color: #b7a9ff99;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 2px rgba(143, 91, 255, .22);
}

button {
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    filter: saturate(1.06);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* button variants */
.btn-primary {
    border: none;
    color: #140d2a;
    background: linear-gradient(180deg, var(--primary), var(--primary-2));
}

.btn-ghost,
.btn-like-ghost {
    background: linear-gradient(180deg, #1c143c, #120e27);
    border: 1px solid #3a2b77;
    color: #efeaff;
}

.btn-danger {
    background: #2a1020;
    border: 1px solid #6a2649;
    color: #ffc9d4;
}

/* icon-only */
.btn-icon {
    width: 44px;
    min-width: 44px;
    aspect-ratio: 1 / 1;
    display: inline-grid;
    place-items: center;
    font-size: 18px;
}

/* action glows */
.btn-add:hover,
.btn-add:focus-visible {
    border-color: var(--glow-green);
    box-shadow: 0 0 0 2px rgba(82, 255, 166, .25), 0 0 22px rgba(82, 255, 166, .35);
}

.btn-remove:hover,
.btn-remove:focus-visible {
    border-color: var(--glow-red);
    box-shadow: 0 0 0 2px rgba(255, 59, 83, .25), 0 0 22px rgba(255, 59, 83, .35);
}

.btn-burn:hover,
.btn-burn:focus-visible {
    border-color: var(--glow-violet);
    box-shadow: 0 0 0 2px rgba(185, 140, 255, .25), 0 0 22px rgba(185, 140, 255, .38);
}

/* rows of buttons */
.btn-row,
.btns-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

/* UTIL MARGINS */
.mt-6 {
    margin-top: var(--space-1);
}

.mt-8 {
    margin-top: var(--space-2);
}

.mt-10 {
    margin-top: var(--space-3);
}

.mt-12 {
    margin-top: var(--space-4);
}

.mt-16 {
    margin-top: var(--space-5);
}

.mt-20 {
    margin-top: var(--space-6);
}

/* LOGS */
#out {
    background: var(--code-bg);
    border: 1px dashed var(--dash);
    padding: 12px;
    max-height: 60vh;
    overflow: auto;
    border-radius: 12px;
    white-space: pre-wrap;
    font-size: 14px;
}

/* MODALS */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
}

.modal.show {
    display: flex;
    animation: fadeIn .12s ease-out;
}

.modal .box {
    width: min(560px, 92vw);
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    box-shadow: var(--shadow);
}

.modal .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    gap: 12px;
}

.modal .actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loud success modal */
.modal.modal-loud .box {
    width: min(680px, 94vw);
    background: radial-gradient(160% 120% at 10% 0%, rgba(255, 255, 255, .06), transparent), linear-gradient(180deg, #14102a, #0f0b21);
    border: 1px solid #d7d9e6;
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(130, 100, 255, .25), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.success-hero {
    font-family: "Baloo 2", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 20px;
    line-height: 1.3;
    color: #f7f2ff;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e6e8f2;
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(255, 255, 255, .55), transparent 60%),
        linear-gradient(180deg, #b88cff, #7a5cff 60%, #6248ff);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 10px 26px rgba(122, 92, 255, .35), 0 0 0 6px rgba(122, 92, 255, .12);
}

.success-icon svg {
    width: 30px;
    height: 30px;
    color: #150f2e;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .4));
}

/* DEX SELECTOR */
.dex-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

.dex {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(180deg, #1d153f, #140f2b);
    border: 1px solid #3a2b77;
    transition: box-shadow .2s, border-color .2s, transform .04s;
}

.dex:hover {
    border-color: var(--primary-2);
}

.dex:active {
    transform: translateY(1px);
}

.dex.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(192, 124, 255, .22);
}

.dex svg {
    width: 20px;
    height: 20px;
}

/* POOL PREVIEW (XYK) */
.pool-card .meter-wrap {
    margin-top: 12px;
}

.pool-card .meter {
    position: relative;
    height: 18px;
    border-radius: 999px;
    border: 1px solid #3a2b77;
    overflow: hidden;
    background: linear-gradient(180deg, #1c143c, #120e27);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.pool-card .meter .left,
.pool-card .meter .right {
    height: 100%;
}

.pool-card .meter .left {
    background: linear-gradient(180deg, #c07cff, #8f5bff);
}

.pool-card .meter .right {
    background: linear-gradient(180deg, #80e9ff, #4fd3ff);
}

.pool-card .stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #120e27;
    border: 1px solid #3a2b77;
    border-radius: 10px;
    padding: 10px;
}

.pool-card .stat b {
    font-size: 14px;
}

.pool-card .muted-sm {
    font-size: 12px;
    color: #cdbfff;
}

.pool-card .delta-pos {
    color: #78ffa0;
}

.pool-card .delta-neg {
    color: #ff6b88;
}

.pool-card .row2.stats {
    margin-top: 10px;
}

/* KPI PILLS (Dashboard & reuse) */
.kpi {
    background: #120e27;
    border: 1px solid #3a2b77;
    border-radius: 10px;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi b {
    font-size: 13px;
    color: #e0d6ff;
}

.kpi .val {
    font-size: 18px;
}

.kpi .sub {
    font-size: 12px;
    color: #cdbfff;
}

/* MINI ACTION BLOCKS (Dashboard) */
.mini-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 12px;
}

.action-block {
    background: #120e27;
    border: 1px solid #3a2b77;
    border-radius: 12px;
    padding: 12px;
    transition: box-shadow .16s ease, border-color .16s ease;
}

.action-block.danger {
    border-color: #6a2649;
}

.action-block.danger:hover,
.action-block.danger:focus-within {
    border-color: var(--glow-red);
    box-shadow: 0 0 0 2px rgba(255, 59, 83, .25), 0 0 28px rgba(255, 59, 83, .35);
}

/* Remove gauge */
.gauge {
    height: 14px;
    border-radius: 999px;
    background: #1c143c;
    border: 1px solid #3a2b77;
    overflow: hidden;
    transition: box-shadow .16s ease, border-color .16s ease;
}

.gauge-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, #b08bff, #7a5cff);
    box-shadow: inset 0 0 12px rgba(160, 120, 255, .45);
    transition: width .15s ease;
}

/* SWAP bits */
.pill {
    background: #120e27;
    border: 1px solid #3a2b77;
    border-radius: 12px;
    padding: 12px;
}

.pair {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.pair>div {
    flex: 1;
}

/* HOVER LINK COLORS (for text links styled as .btn-ghost) */
a.btn-ghost.link-blue:hover {
    border-color: #4da3ff;
    box-shadow: 0 0 0 2px rgba(77, 163, 255, .22), 0 0 18px rgba(77, 163, 255, .28);
}

a.btn-ghost.link-pink:hover {
    border-color: #ff7cd3;
    box-shadow: 0 0 0 2px rgba(255, 124, 211, .22), 0 0 18px rgba(255, 124, 211, .30);
}

a.btn-ghost.link-orange:hover {
    border-color: #f4c542;
    box-shadow: 0 0 0 2px rgba(244, 197, 66, .22), 0 0 18px rgba(244, 197, 66, .30);
}

/* ACCESSIBILITY */
:focus-visible {
    outline: 2px solid var(--primary-2);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ——— GUIDE button: eye-catching glow + shimmer ——— */
.btn-guide {
    position: relative;
    border-color: #f3ba2f;
    background: linear-gradient(180deg, #1c143c, #120e27);
    box-shadow: 0 0 0 2px rgba(243, 186, 47, .25), 0 8px 22px rgba(243, 186, 47, .15);
    overflow: hidden;
    isolation: isolate;
}

.btn-guide:hover {
    text-decoration: none;
    filter: saturate(1.1);
}

.btn-guide::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from 0deg, #f3ba2f, #ffd36e, #f3ba2f);
    filter: blur(8px);
    opacity: .45;
    z-index: -1;
    animation: guideSpin 3.2s linear infinite;
}

.btn-guide::after {
    content: "";
    position: absolute;
    top: -120%;
    left: -30%;
    width: 60%;
    height: 300%;
    transform: rotate(20deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
    mix-blend-mode: screen;
    animation: guideSheen 2.2s ease-in-out infinite;
}

@keyframes guideSpin {
    to {
        transform: rotate(1turn);
    }
}

@keyframes guideSheen {
    0% {
        left: -30%;
        opacity: 0;
    }

    25% {
        left: 20%;
        opacity: .45;
    }

    50% {
        left: 70%;
        opacity: 0;
    }

    100% {
        left: 130%;
        opacity: 0;
    }
}

/* LOG FLOTTANT — override final */
#outCT {
    position: fixed !important;
    right: 16px;
    bottom: 16px;
    width: 480px;
    max-width: calc(100vw - 32px);
    max-height: 46vh;
    margin: 0 !important;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .05) inset;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 980px) {
    #outCT {
        left: 12px;
        right: 12px;
        width: auto;
        max-height: 48vh;
    }
}