@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&display=swap");

:root {
    --bg: #05080e;
    --bg-layer: #0a0f19;
    --card: #0d131d;
    --card-soft: #121b29;
    --text: #ecf2ff;
    --muted: #94a4bf;
    --border: #1d293b;
    --accent: #2ea043;
    --accent-dark: #238636;
    --accent-soft: rgba(46, 160, 67, 0.18);
    --danger: #e24f5f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 14% -10%, #1d2d42 0%, rgba(29, 45, 66, 0) 55%),
        radial-gradient(circle at 86% -20%, #17341f 0%, rgba(23, 52, 31, 0) 48%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(8, 12, 19, 0.88);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    max-width: 1220px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.brand-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.online-pill {
    display: inline-flex;
    width: fit-content;
    padding: 4px 10px;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 999px;
    color: #9ed6aa;
    background: rgba(46, 160, 67, 0.18);
    border: 1px solid rgba(46, 160, 67, 0.45);
}

.brand {
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 1.1rem;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--muted);
    font-size: 0.92rem;
}

.top-nav a:hover {
    color: var(--text);
}

.lang-toggle {
    width: auto;
    min-width: 58px;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid #2f4464;
    background: #111f35;
    color: #d0e2ff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.lang-toggle:hover {
    border-color: #4e74ad;
    color: #ffffff;
}

.layout {
    max-width: 1220px;
    margin: 0 auto;
    padding: 22px 20px 36px;
}

.notice {
    background: linear-gradient(140deg, #1f6d2f, #2b8d3f);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 12px 16px;
    color: #d8ffe1;
    margin-bottom: 14px;
    animation: fade-in 0.45s ease;
}

.notice p {
    margin: 0;
    font-size: 0.88rem;
}

.exchange-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 0.95fr;
    gap: 14px;
}

.card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(18, 27, 41, 0.78), rgba(10, 15, 24, 0.96));
    padding: 16px;
    box-shadow: 0 18px 34px rgba(1, 6, 12, 0.38);
    animation: fade-up 0.42s ease;
}

.card h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.providers-card {
    display: flex;
    flex-direction: column;
}

.amount-row {
    display: grid;
    grid-template-columns: 1fr 130px;
    gap: 8px;
}

.row {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

label {
    font-size: 0.84rem;
    color: var(--muted);
}

input,
select,
button {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0d1422;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 11px 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(90, 152, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(90, 152, 255, 0.16);
}

#amount_from,
#amount_to_preview,
#amount_to_target {
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding-top: 14px;
    padding-bottom: 14px;
}

#amount_from::-webkit-outer-spin-button,
#amount_from::-webkit-inner-spin-button,
#amount_to_target::-webkit-outer-spin-button,
#amount_to_target::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#amount_from,
#amount_to_target {
    appearance: textfield;
    -moz-appearance: textfield;
}

#amount_to_preview {
    color: #8df19f;
}

.helper {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.providers {
    margin-top: 12px;
    display: grid;
    gap: 8px;
    flex: 1;
    min-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.provider-item {
    text-align: left;
    font-weight: 600;
    background: #0b121e;
    border-color: #1a2638;
    color: #dce8ff;
}

.provider-item:hover {
    border-color: #2f4464;
}

.provider-item.is-active {
    border-color: rgba(46, 160, 67, 0.85);
    background: linear-gradient(130deg, rgba(46, 160, 67, 0.26), rgba(15, 26, 18, 0.98));
    box-shadow: 0 0 0 2px rgba(46, 160, 67, 0.14);
}

.rate {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #284774;
    background: rgba(23, 45, 74, 0.45);
    color: #b7d6ff;
    font-weight: 600;
    font-size: 0.87rem;
}

.provider-current {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #0b121d;
    color: #c7d8f6;
    font-weight: 600;
}

.terms-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0 4px;
    color: #cfdbf3;
    cursor: pointer;
}

.terms-row input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

.terms-row span {
    font-size: 0.82rem;
    line-height: 1.35;
}

.terms-link {
    color: #9ac8ff;
    text-decoration: underline;
}

.terms-link:hover {
    color: #c2deff;
}

#submit-button {
    margin-top: 4px;
    border: none;
    background: linear-gradient(140deg, var(--accent), var(--accent-dark));
    color: #eaffe9;
    font-weight: 800;
    letter-spacing: 0.01em;
}

#submit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 83, 29, 0.35);
}

#submit-button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.orders-panel {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(13, 19, 29, 0.85), rgba(9, 14, 21, 0.95));
    padding: 16px;
}

.orders-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.orders-head h3 {
    margin: 0;
}

.secondary {
    width: auto;
    padding-left: 14px;
    padding-right: 14px;
    border-color: #264770;
    background: #0e1f37;
    color: #bfd7ff;
}

.secondary:hover {
    border-color: #3a659a;
}

#orders {
    display: grid;
    gap: 10px;
}

.order-item {
    border: 1px solid #1c2c42;
    border-radius: 12px;
    background: #0b121d;
    padding: 12px;
    display: grid;
    gap: 6px;
}

.order-id {
    font-size: 0.84rem;
    color: #b7c7e6;
    font-weight: 700;
}

.order-main {
    font-size: 0.95rem;
}

.order-meta {
    color: var(--muted);
    font-size: 0.84rem;
}

.status {
    display: inline-flex;
    width: fit-content;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-new,
.status-pending_payment {
    color: #b7d6ff;
    background: rgba(41, 91, 168, 0.2);
    border-color: rgba(59, 121, 214, 0.4);
}

.status-processing {
    color: #ffe08d;
    background: rgba(173, 129, 17, 0.24);
    border-color: rgba(173, 129, 17, 0.5);
}

.status-completed {
    color: #9fe9a8;
    background: var(--accent-soft);
    border-color: rgba(46, 160, 67, 0.5);
}

.status-cancelled {
    color: #ffd0d6;
    background: rgba(183, 44, 63, 0.2);
    border-color: rgba(183, 44, 63, 0.5);
}

.empty {
    color: var(--muted);
    margin: 8px 0;
}

.error {
    color: #ffb4bf;
}

.chat-toggle {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(140deg, #2ea043, #238636);
    color: #effff2;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(8, 49, 17, 0.42);
    z-index: 45;
}

.support-chat {
    position: fixed;
    right: 18px;
    bottom: 80px;
    width: min(360px, calc(100vw - 24px));
    border-radius: 14px;
    border: 1px solid #22403a;
    background: linear-gradient(180deg, rgba(13, 22, 24, 0.97), rgba(8, 13, 17, 0.97));
    box-shadow: 0 20px 40px rgba(1, 9, 5, 0.45);
    overflow: hidden;
    z-index: 45;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.support-chat.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #1f322f;
    background: #0f1f1d;
}

.chat-title {
    font-weight: 700;
    color: #e5fff0;
}

.chat-close {
    width: auto;
    border: none;
    background: transparent;
    color: #b7c9bf;
    font-size: 1.3rem;
    line-height: 1;
    padding: 2px 4px;
}

.chat-close:hover {
    color: #ffffff;
}

.chat-messages {
    min-height: 220px;
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.chat-msg {
    max-width: 88%;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.4;
}

.chat-msg.user {
    margin-left: auto;
    background: #1d5b2a;
    color: #e8ffe8;
}

.chat-msg.support {
    background: #172333;
    color: #cce0ff;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #1f322f;
}

.chat-form input {
    margin: 0;
}

.chat-form button {
    width: auto;
    border: none;
    background: var(--accent);
    color: #ecffef;
    font-weight: 700;
}

.rules-layout,
.payment-layout {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 90px);
}

.rules-card,
.payment-card {
    width: min(760px, 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(13, 19, 29, 0.85), rgba(9, 14, 21, 0.95));
    padding: 22px;
}

.rules-card h1,
.payment-card h1 {
    margin: 0 0 12px;
}

.rules-list {
    margin: 14px 0;
    padding-left: 18px;
    color: #ccdaee;
}

.rules-subtitle {
    margin: 16px 0 10px;
    font-size: 1.05rem;
}

.rules-block {
    margin-top: 14px;
    border: 1px solid #1d2c42;
    border-radius: 12px;
    background: #0b121d;
    padding: 12px 14px;
}

.rules-block h3 {
    margin: 0 0 8px;
    font-size: 0.97rem;
}

.rules-block p {
    margin: 0;
    color: #ccdaee;
}

.secondary-link {
    display: inline-flex;
    margin-top: 12px;
    color: #9ac8ff;
    text-decoration: underline;
}

.info-panel {
    margin-top: 14px;
}

.faq-list {
    display: grid;
    gap: 8px;
}

.faq-item {
    border: 1px solid #1c2c42;
    border-radius: 10px;
    background: #0b121d;
    padding: 10px 12px;
}

.faq-item summary {
    cursor: pointer;
    font-weight: 700;
    color: #dce8ff;
}

.faq-item p {
    margin: 8px 0 0;
    color: #ccdaee;
    font-size: 0.9rem;
}

.contacts-placeholder {
    margin: 0;
    font-size: 0.9rem;
}

.payment-loading {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 14px;
    padding: 16px 0;
}

.loader {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 4px solid rgba(46, 160, 67, 0.28);
    border-top-color: #42bf5d;
    animation: spin 1s linear infinite;
}

.payment-details h2 {
    margin: 0 0 12px;
}

.payment-fields {
    display: grid;
    gap: 8px;
}

.payment-field {
    border: 1px solid #1d2c42;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #0b121d;
}

.payment-field span {
    color: var(--muted);
    font-size: 0.84rem;
}

.payment-field strong {
    font-size: 0.9rem;
    text-align: right;
}

.payment-error {
    margin-top: 6px;
    color: #ffb4bf;
}

.receipt-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #1d2c42;
}

.receipt-section h3 {
    margin: 0 0 10px;
    font-size: 0.96rem;
}

.receipt-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.receipt-form button {
    width: auto;
    border: none;
    background: var(--accent);
    color: #ecffef;
    font-weight: 700;
}

.receipt-status {
    min-height: 20px;
    margin: 8px 0 0;
    color: #b9d3ff;
    font-size: 0.84rem;
}

.hidden {
    display: none !important;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .exchange-grid {
        grid-template-columns: repeat(2, minmax(280px, 1fr));
    }

    .exchange-grid .card:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .top-nav {
        flex-wrap: wrap;
        gap: 12px;
    }

    .layout {
        padding: 16px 14px 28px;
    }

    .exchange-grid {
        grid-template-columns: 1fr;
    }

    .amount-row {
        grid-template-columns: 1fr;
    }

    #amount_from,
    #amount_to_preview,
    #amount_to_target {
        font-size: 1.45rem;
    }

    .support-chat {
        right: 12px;
        bottom: 74px;
        width: calc(100vw - 24px);
    }

    .chat-toggle {
        right: 12px;
        bottom: 12px;
    }

    .receipt-form {
        grid-template-columns: 1fr;
    }
}
