/* assets/css/style.css */
:root {
    --bg-main: #0B0E11;
    --bg-secondary: #181A20;
    --bg-tertiary: #2B3139;
    --text-primary: #EAECEF;
    --text-muted: #848E9C;
    --accent-green: #0ECB81;
    --accent-red: #F6465D;
    --accent-blue: #2962FF;
    --glow-cyan: rgba(14, 203, 129, 0.4);
    --glow-purple: rgba(88, 101, 242, 0.4);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

html {
    background: #0B0E11;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0B0E11;
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

/* Web App splash screen (PWA preview) */
.app-splash {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background:
        radial-gradient(circle at top, rgba(14, 203, 129, 0.25) 0%, transparent 55%),
        radial-gradient(circle at bottom, rgba(41, 98, 255, 0.25) 0%, transparent 55%),
        #05070b;
    color: #fff;
    opacity: 1;
    transition: opacity 0.45s ease-out;
    pointer-events: auto;
}

.app-splash--hidden {
    opacity: 0;
    pointer-events: none;
}

.app-splash-logo {
    font-family: var(--font-heading);
    font-size: 34px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.app-splash-logo span {
    background: linear-gradient(135deg, #0ECB81 0%, #2AF598 40%, #08AEEA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-splash-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 26px;
}

.app-splash-orbit {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 40px rgba(14, 203, 129, 0.32);
}

.app-splash-orbit::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0ECB81;
    box-shadow: 0 0 18px rgba(14, 203, 129, 0.9);
    animation: appSplashOrbit 1.6s linear infinite;
}

.app-splash-orbit-core {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: radial-gradient(circle at 30% 0%, #16FFAA 0%, #0ECB81 35%, #00664A 100%);
}

@keyframes appSplashOrbit {
    0% { transform: translate(46px, 0); }
    25% { transform: translate(0, 46px); }
    50% { transform: translate(-46px, 0); }
    75% { transform: translate(0, -46px); }
    100% { transform: translate(46px, 0); }
}

* {
    box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    margin: 0 0 16px 0;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: 0.2s ease;
}

a:hover {
    color: #5a7fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-green) 0%, #0BA165 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(14, 203, 129, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(14, 203, 129, 0.6);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red) 0%, #C43B4E 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(246, 70, 93, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(246, 70, 93, 0.6);
    transform: translateY(-2px);
}

.btn-hollow {
    background: transparent;
    border: 1px solid var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-hollow:hover {
    background: var(--bg-tertiary);
}

/* Sign Up в шапке — просто зелёная текстовая ссылка, без зелёного блока */
.nav-btn-signup {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    color: var(--accent-green) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.nav-btn-signup:hover {
    background: transparent !important;
    color: #32ffb0 !important;
}

/* Log Out в шапке — как ссылка рядом с Trade/Wallet, без кнопки */
.nav-link-logout {
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}
.nav-link-logout:hover {
    color: var(--text-muted);
}

/* Base Layout Container */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Glassmorphic Navbar */
.header-fixed-wrap {
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

header {
    background: rgba(11, 14, 17, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-install-app {
    font-size: 12px;
    color: var(--text-muted) !important;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.nav-install-app:hover {
    color: var(--accent-green) !important;
    background: rgba(14, 203, 129, 0.08);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #fff;
}

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

.nav-links a {
    color: var(--text-primary);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent-green);
}

/* Mobile / iPhone: фиксированная шапка без зазора (viewport-fit=cover в meta) */
@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-padding-top: 0;
        background: #0B0E11;
        font-size: 15px;
    }

    body {
        max-width: 100vw;
        overflow-x: hidden;
        padding-top: 0 !important;
        margin: 0 !important;
        background: #0B0E11 !important;
    }

    /* Обёртка шапки: фиксированная высота, чтобы при логине (Log Out) шапка не росла */
    .header-fixed-wrap {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: calc(116px + env(safe-area-inset-top, 0px)) !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #0B0E11 !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        box-shadow: 0 1px 0 rgba(255,255,255,0.05);
        overflow: hidden;
    }

    /* Заливка зоны «чёлки» / safe area сверху тем же цветом — убирает зазор на iPhone */
    .header-fixed-wrap::before {
        content: '';
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: env(safe-area-inset-top, 0px);
        min-height: env(safe-area-inset-top, 0px);
        background: #0B0E11;
        pointer-events: none;
    }

    .header-fixed-wrap header {
        margin: 0;
        padding: 0;
        border-radius: 0;
        background: #0B0E11;
        position: relative;
        height: 100%;
        box-sizing: border-box;
    }

    /* Контент шапки: отступ под чёлку + одна высота с/без Log Out; нав в одну строку, скролл по горизонтали */
    .header-fixed-wrap .nav-inner {
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        min-height: 0;
        height: 100%;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 16px;
        padding-left: max(16px, env(safe-area-inset-left, 16px));
        padding-right: max(16px, env(safe-area-inset-right, 16px));
        box-sizing: border-box;
    }

    /* Единая высота шапки = safe-area + 116px. main и sticky тикер — то же значение */
    main {
        padding-top: calc(116px + env(safe-area-inset-top, 0px)) !important;
        min-height: 100vh;
    }

    /* Одна строка: Install, EN, Trade, Wallet, Admin, Log Out — не переносятся, скролл по горизонтали */
    .nav-links {
        gap: 8px;
        font-size: 13px;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        padding-bottom: 2px;
    }
    .nav-links a, .nav-links select { flex-shrink: 0; }

    .nav-brand {
        font-size: 22px;
    }

    .nav-install-app {
        font-size: 11px;
    }
}


/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-control {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    color: #fff;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: 0.2s;
}

.form-control::-webkit-outer-spin-button,
.form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-control[type="number"] {
    -moz-appearance: textfield;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(14, 203, 129, 0.2);
}

/* Alert Boxes */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.alert-error {
    background: rgba(246, 70, 93, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(246, 70, 93, 0.2);
}

.alert-success {
    background: rgba(14, 203, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(14, 203, 129, 0.2);
}

main {
    flex: 1;
}

/* Utils */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 32px;
}

.mt-5 {
    margin-top: 48px;
}

.glass-box {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Wallet KYC header */
.wallet-kyc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.wallet-kyc-pill {
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-width: 1px;
    border-style: solid;
}
.wallet-kyc-pill--verified {
    background: rgba(14, 203, 129, 0.1);
    color: var(--accent-green);
    border-color: rgba(14, 203, 129, 0.2);
}
.wallet-kyc-pill--unverified {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-color: rgba(255, 255, 255, 0.1);
}
.wallet-kyc-cta {
    margin-left: auto;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--accent-green) 0%, #0BA165 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(14, 203, 129, 0.45);
}
@media (max-width: 768px) {
    .wallet-kyc-cta {
        padding: 6px 10px;
        font-size: 12px;
    }
}
/* ——— Global page layout (Index, Wallet, Admin, etc.) ——— */
.page-wrap {
    padding: 32px 0 48px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}
.page-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 24px 0;
    letter-spacing: -0.02em;
}
.page-section {
    margin-bottom: 32px;
}
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-tertiary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.card-body {
    padding: 20px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--bg-tertiary);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; }
.stat-card .value { font-size: 22px; font-weight: 700; }
.badge-green { color: var(--accent-green); }
.badge-red { color: var(--accent-red); }
.badge-yellow { color: #facc15; }
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.data-table td.empty-state {
    padding: 24px 16px;
}
@media (max-width: 768px) {
    .page-wrap { padding: 20px 0 32px; }
    .page-title { font-size: 22px; }
    .data-table { font-size: 13px; }
    .data-table th, .data-table td { padding: 10px 12px; }
}

/* ——— Admin: web app & mobile ——— */
body.admin-page {
    overflow-x: hidden;
    max-width: 100vw;
}
.admin-page .container {
    max-width: 100%;
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
}
.admin-page main.container {
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
}
.admin-modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top, 20px)) max(20px, env(safe-area-inset-right, 20px)) max(20px, env(safe-area-inset-bottom, 20px)) max(20px, env(safe-area-inset-left, 20px)) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-modal-box {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.admin-modal-feedback {
    word-break: break-word;
}

.admin-tx-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    margin: 0 -8px;
}
.admin-tx-table {
    min-width: 560px;
}
@media (max-width: 768px) {
    .admin-page .page-wrap { padding: 20px 0 32px !important; }
    .admin-page .admin-tx-table-wrap .btn,
    .admin-page .admin-tx-table .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
    .admin-page .page-title { font-size: 20px; margin-bottom: 12px; }
    .admin-page .stat-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
    }
    .admin-page .stat-card {
        padding: 12px;
        min-height: 0;
    }
    .admin-page .stat-card .label { font-size: 11px; }
    .admin-page .stat-card .value { font-size: 16px; }
    .admin-page .card { border-radius: 10px; }
    .admin-page .card-header { padding: 12px 16px; font-size: 12px; }
    .admin-page .card-body {
        padding: 12px 16px;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
    }
    .admin-page .card-body[style*="padding: 0"] {
        padding: 0 !important;
        overflow-x: auto;
    }
    .admin-page .card-body[style*="padding: 0"] .data-table {
        min-width: 600px;
    }
    .admin-page .data-table { font-size: 12px; }
    .admin-page .data-table th,
    .admin-page .data-table td { padding: 10px 8px; }
    .admin-page .data-table .btn { padding: 6px 8px !important; font-size: 11px !important; white-space: nowrap; }
    .admin-search-form {
        flex-wrap: wrap;
        max-width: 100% !important;
        width: 100%;
        gap: 8px;
    }
    .admin-search-form .form-control { flex: 1 1 100%; min-width: 0; min-height: 44px; }
    .admin-page #settingsForm .form-group label { font-size: 13px; }
    .admin-page #settingsForm input[type="text"],
    .admin-page #settingsForm input[type="number"] { min-height: 44px; font-size: 16px; }
    .admin-page #settingsForm .btn { min-height: 44px; }
    .admin-page #settingsForm > div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .admin-page .glass-box { padding: 16px !important; }
    .admin-page .glass-box h3 { font-size: 16px; }
}

@media (max-width: 480px) {
    .admin-page .stat-grid { grid-template-columns: 1fr; }
    .admin-page .stat-card .value { font-size: 20px; }
}

/* ——— Responsive & mobile (iPhone / touch) ——— */
@supports (padding: env(safe-area-inset-bottom)) {
    body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    main { padding-bottom: env(safe-area-inset-bottom); }
    header .container { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
}
@media (max-width: 900px) {
    .container { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 600px) {
    html { font-size: 14px; }
    .container { padding-left: 12px; padding-right: 12px; }
}
@media (pointer: coarse) {
    .btn { min-height: 44px; padding: 12px 20px; }
    .form-control { min-height: 44px; font-size: 16px; }
    a, .nav-links a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Footer responsive */
footer { padding: 20px 16px !important; }
@media (max-width: 600px) {
    footer .container { flex-direction: column; text-align: center !important; }
    footer .container > div:first-child { min-width: auto; }
}