/* ── Shared Page Layout ── */
.page-main {
    position: relative;
    z-index: 2;
    padding-top: 100px;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 30px;
    padding-right: 30px;
    padding-bottom: 60px;
}

.page-hero {
    text-align: center;
    padding: 50px 20px 30px;
}

/* ── Swap Layout ── */
.swap-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* ── Swap Card ── */
.swap-card {
    flex: 0 0 420px;
    background: rgba(20,20,40,0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(147,51,234,0.4);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 0 60px rgba(147,51,234,0.15);
}

.swap-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #a78bfa;
}

.settings-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.settings-btn:hover { opacity: 1; }

/* ── Settings Panel ── */
.settings-panel {
    background: rgba(147,51,234,0.08);
    border: 1px solid rgba(147,51,234,0.2);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
    color: #d0d0ff;
}

.slippage-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.slip-btn {
    padding: 6px 14px;
    background: rgba(147,51,234,0.15);
    border: 1px solid rgba(147,51,234,0.3);
    border-radius: 10px;
    color: #d0d0ff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.slip-btn.active, .slip-btn:hover {
    background: rgba(147,51,234,0.35);
    border-color: #a78bfa;
    color: #fff;
}

.slip-input {
    width: 90px;
    background: rgba(10,10,30,0.7);
    border: 1px solid rgba(147,51,234,0.3);
    border-radius: 10px;
    padding: 6px 10px;
    color: #e0e0ff;
    font-size: 13px;
    outline: none;
}

/* ── Token Box ── */
.token-box {
    background: rgba(10,10,30,0.5);
    border: 1px solid rgba(147,51,234,0.3);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.token-box:focus-within { border-color: #a78bfa; }

.token-box-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(200,200,255,0.5);
    margin-bottom: 10px;
}

.token-box-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.token-select-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(147,51,234,0.2);
    border: 1px solid rgba(147,51,234,0.4);
    border-radius: 12px;
    padding: 8px 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.token-select-btn:hover {
    background: rgba(147,51,234,0.35);
    border-color: #a78bfa;
}

.token-amount-input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    outline: none;
    text-align: right;
    min-width: 0;
}

.token-amount-input::placeholder { color: rgba(255,255,255,0.2); }

.token-box-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.token-balance { color: rgba(200,200,255,0.5); }
.token-usd { color: rgba(200,200,255,0.5); }

.max-btn {
    background: rgba(147,51,234,0.2);
    border: 1px solid rgba(147,51,234,0.4);
    border-radius: 6px;
    color: #a78bfa;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    cursor: pointer;
    margin-left: 6px;
    transition: all 0.2s;
}
.max-btn:hover { background: rgba(147,51,234,0.4); }

/* ── Flip ── */
.flip-row {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

.flip-btn {
    width: 38px;
    height: 38px;
    background: rgba(147,51,234,0.2);
    border: 2px solid rgba(147,51,234,0.4);
    border-radius: 50%;
    color: #a78bfa;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-btn:hover {
    background: rgba(147,51,234,0.4);
    transform: rotate(180deg);
    border-color: #a78bfa;
}

/* ── Route Info ── */
.route-info {
    background: rgba(147,51,234,0.06);
    border: 1px solid rgba(147,51,234,0.2);
    border-radius: 14px;
    padding: 14px;
    margin: 12px 0;
}

.route-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #d0d0ff;
    padding: 5px 0;
    border-bottom: 1px solid rgba(147,51,234,0.1);
}

.route-row:last-child { border-bottom: none; }
.route-row span:first-child { color: rgba(200,200,255,0.55); }

.impact-low  { color: #22c55e; }
.impact-mid  { color: #f59e0b; }
.impact-high { color: #ef4444; }

/* ── Swap Action Button ── */
.swap-action-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #9333ea, #06b6d4);
    border: none;
    border-radius: 16px;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
    box-shadow: 0 0 30px rgba(147,51,234,0.4);
}

.swap-action-btn:hover {
    box-shadow: 0 0 50px rgba(147,51,234,0.7);
    transform: translateY(-2px);
}

.swap-powered {
    text-align: center;
    font-size: 11px;
    color: rgba(200,200,255,0.4);
    margin-top: 12px;
}

/* ── Info Panel ── */
.swap-info-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 280px;
}

.sip-card {
    background: rgba(20,20,40,0.55);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(147,51,234,0.3);
    border-radius: 18px;
    padding: 22px;
    transition: all 0.3s;
}

.sip-card:hover {
    border-color: rgba(147,51,234,0.55);
    box-shadow: 0 0 25px rgba(147,51,234,0.15);
}

.sip-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #a78bfa;
    margin-bottom: 14px;
}

.sip-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sip-list li {
    font-size: 13px;
    color: #d0d0ff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}

.market-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #d0d0ff;
    padding: 7px 0;
    border-bottom: 1px solid rgba(147,51,234,0.1);
}

.market-row:last-child { border-bottom: none; }
.market-row span:first-child { color: rgba(200,200,255,0.55); }
.market-val { font-weight: 600; color: #a78bfa; }
.market-val.green { color: #22c55e; }

.chain-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chain-pill {
    background: rgba(147,51,234,0.12);
    border: 1px solid rgba(147,51,234,0.3);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    color: #d0d0ff;
    transition: all 0.2s;
}

.chain-pill:hover {
    background: rgba(147,51,234,0.25);
    border-color: #a78bfa;
}

/* ── Token Modal ── */
.token-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,5,20,0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.token-modal {
    background: rgba(20,20,45,0.98);
    border: 1px solid rgba(147,51,234,0.5);
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 80px rgba(147,51,234,0.4);
}

.token-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(147,51,234,0.2);
    font-family: 'Orbitron', sans-serif;
    font-size: 15px;
    color: #a78bfa;
}

.token-modal-header button {
    background: none;
    border: none;
    color: rgba(200,200,255,0.6);
    font-size: 18px;
    cursor: pointer;
}

.token-search {
    margin: 12px 16px;
    background: rgba(10,10,30,0.7);
    border: 1px solid rgba(147,51,234,0.3);
    border-radius: 12px;
    padding: 12px 16px;
    color: #e0e0ff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.token-search:focus { border-color: #a78bfa; }

.token-list {
    overflow-y: auto;
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.token-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.token-list-item:hover {
    background: rgba(147,51,234,0.12);
    border-color: rgba(147,51,234,0.25);
}

.tli-icon {
    width: 36px;
    height: 36px;
    background: rgba(147,51,234,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.tli-info { flex: 1; }
.tli-name { font-weight: 700; font-size: 14px; color: #e0e0ff; }
.tli-ticker { font-size: 12px; color: rgba(200,200,255,0.5); }
.tli-price { font-size: 13px; color: #a78bfa; font-weight: 600; text-align: right; }

/* ── Connect Wallet Button ── */
.connect-wallet-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(147,51,234,0.3), rgba(6,182,212,0.2));
    border: 1px solid rgba(147,51,234,0.5);
    border-radius: 12px;
    color: #a78bfa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.connect-wallet-btn:hover {
    background: rgba(147,51,234,0.4);
    box-shadow: 0 0 20px rgba(147,51,234,0.4);
}

/* ── Responsive ── */
@media (max-width: 800px) {
    .swap-layout { flex-direction: column; }
    .swap-card { flex: none; width: 100%; }
}

@media (max-width: 480px) {
    .page-main { padding-left: 16px; padding-right: 16px; }
    .token-amount-input { font-size: 18px; }
}

/* ── V5 utility fixes: status area, review modal, disabled states, toast ── */
.swap-action-btn:disabled,
.swap-action-btn:disabled:hover {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.swap-tx-status {
    margin: 12px 0 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(147,51,234,0.3);
    background: rgba(147,51,234,0.08);
    font-size: 12px;
    line-height: 1.5;
    color: #d0d0ff;
    overflow-wrap: anywhere;
}
.swap-tx-status[hidden] { display: none; }
.swap-tx-status .sts-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #a78bfa;
    margin-bottom: 4px;
}
.swap-tx-status a { display: inline-block; margin-top: 6px; color: #06b6d4; font-weight: 600; text-decoration: none; }
.swap-tx-status a:hover { text-decoration: underline; }
.swap-tx-status.is-pending,
.swap-tx-status.is-submitted { border-color: rgba(6,182,212,0.45); background: rgba(6,182,212,0.08); }
.swap-tx-status.is-pending .sts-title,
.swap-tx-status.is-submitted .sts-title { color: #06b6d4; }
.swap-tx-status.is-success { border-color: rgba(34,197,94,0.45); background: rgba(34,197,94,0.08); }
.swap-tx-status.is-success .sts-title { color: #22c55e; }
.swap-tx-status.is-failed { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.07); }
.swap-tx-status.is-failed .sts-title { color: #f87171; }

.route-row span:last-child { text-align: right; max-width: 64%; overflow-wrap: anywhere; }
.market-val.red { color: #ef4444; }
.route-row[hidden] { display: none; }

button.token-list-item {
    width: 100%;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}
button.token-list-item:disabled { opacity: 0.5; cursor: progress; }

.review-modal { max-height: 90vh; }
.review-body { padding: 16px 20px 20px; overflow-y: auto; }
.review-rows { margin-top: 0; }
.review-note {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(200,200,255,0.6);
    margin-top: 4px;
}

.slip-input[aria-invalid="true"] { border-color: #ef4444; }

#swapToast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 10000;
    width: max-content;
    max-width: min(92vw, 520px);
    margin: 0;
    background: rgba(20,20,45,0.97);
    border-color: rgba(147,51,234,0.5);
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    text-align: center;
}

@media (max-width: 480px) {
    .swap-card { padding: 18px; }
    .review-body { padding: 14px 14px 16px; }
    .token-modal-header { padding: 16px 18px; }
    .token-box-inner { gap: 8px; }
    .token-select-btn { padding: 8px 10px; font-size: 13px; }
}
