/* ===== CRYPTO PAYMENT SCREEN — Full-screen USDT waiting overlay ===== */

.crypto-screen-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s var(--ease-spring), transform 0.4s var(--ease-spring);
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.crypto-screen-overlay.active {
    opacity: 1;
    transform: translateY(0);
}

.crypto-screen-overlay.closing {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.25s ease, transform 0.3s ease;
}

/* ── Header / Logo section ── */
.crypto-screen-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 0;
    width: 100%;
    flex-shrink: 0;
}

.crypto-logo-ring {
    position: relative;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.crypto-orbit-track {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px dashed rgba(38, 161, 123, 0.18);
}

.crypto-orbit-dot {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    border-top-color: #26a17b;
    animation: cryptoOrbitSpin 2.2s linear infinite;
}

.crypto-orbit-dot::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #26a17b;
    box-shadow: 0 0 8px rgba(38, 161, 123, 0.5);
}

@keyframes cryptoOrbitSpin {
    to { transform: rotate(360deg); }
}

.crypto-logo-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2ecc8f, #26a17b);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 24px rgba(38, 161, 123, 0.3),
        0 2px 8px rgba(38, 161, 123, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.crypto-logo-circle img {
    width: 42px;
    height: 42px;
}

.crypto-screen-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.crypto-screen-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Animated waiting dots ── */
.crypto-wait-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 2px;
}

.crypto-wait-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: cryptoDot 1.4s ease-in-out infinite;
}

.crypto-wait-dots span:nth-child(2) { animation-delay: 0.2s; }
.crypto-wait-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cryptoDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* ── Amount display ── */
.crypto-amount-section {
    width: 100%;
    padding: 24px 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.crypto-amount-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-glass-thick);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-large);
    padding: 24px;
    text-align: center;
    box-shadow: var(--glass-highlight), var(--glass-glow), var(--glass-shadow);
}

.crypto-amount-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.crypto-amount-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
    line-height: 1.1;
}

.crypto-amount-value .crypto-currency {
    font-size: 18px;
    font-weight: 600;
    color: #26a17b;
}

.crypto-amount-rub {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.crypto-copy-amount-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.crypto-copy-amount-btn:active {
    transform: scale(0.95);
    background: var(--bg-tertiary);
}

.crypto-copy-amount-btn svg,
.crypto-copy-amount-btn i {
    width: 14px;
    height: 14px;
}

.crypto-copy-amount-btn.copied {
    border-color: rgba(38, 161, 123, 0.3);
    color: #26a17b;
    background: rgba(38, 161, 123, 0.08);
}

/* ── Wallet address card ── */
.crypto-wallet-section {
    width: 100%;
    padding: 16px 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.crypto-wallet-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.crypto-wallet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.crypto-wallet-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.crypto-wallet-label .crypto-network-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--border-radius-pill);
    background: rgba(38, 161, 123, 0.1);
    color: #26a17b;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.crypto-wallet-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    background: var(--bg-primary);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.crypto-wallet-copy-btn:active {
    transform: scale(0.95);
    background: var(--bg-tertiary);
}

.crypto-wallet-copy-btn svg,
.crypto-wallet-copy-btn i {
    width: 13px;
    height: 13px;
}

.crypto-wallet-copy-btn.copied {
    border-color: rgba(38, 161, 123, 0.3);
    color: #26a17b;
}

.crypto-wallet-address {
    padding: 14px 16px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.5;
    user-select: all;
    -webkit-user-select: all;
}

/* ── Status / timer row ── */
.crypto-status-section {
    width: 100%;
    padding: 16px 20px 0;
    display: flex;
    justify-content: center;
}

.crypto-status-row {
    width: 100%;
    max-width: 400px;
    display: flex;
    gap: 10px;
}

.crypto-status-chip {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--border-radius-small);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.crypto-status-chip svg,
.crypto-status-chip i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.crypto-status-chip.status-waiting {
    color: var(--color-primary);
}

.crypto-status-chip.status-waiting svg,
.crypto-status-chip.status-waiting i {
    color: var(--color-primary);
    animation: statusSpin 2s linear infinite;
}

@keyframes statusSpin {
    to { transform: rotate(360deg); }
}

.crypto-status-chip.status-timer svg,
.crypto-status-chip.status-timer i {
    color: var(--text-tertiary);
}

.crypto-timer-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Notices ── */
.crypto-notices {
    width: 100%;
    padding: 20px 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.crypto-notice {
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--border-radius-small);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.crypto-notice svg,
.crypto-notice i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.crypto-notice.notice-warning {
    background: rgba(255, 159, 10, 0.08);
    border: 1px solid rgba(255, 159, 10, 0.12);
}

.crypto-notice.notice-warning svg,
.crypto-notice.notice-warning i {
    color: var(--color-warning);
}

.crypto-notice.notice-info {
    background: rgba(48, 209, 88, 0.06);
    border: 1px solid rgba(48, 209, 88, 0.1);
}

.crypto-notice.notice-info svg,
.crypto-notice.notice-info i {
    color: var(--color-success);
}

/* ── Bottom action ── */
.crypto-screen-actions {
    width: 100%;
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    flex-shrink: 0;
}

.crypto-close-btn {
    width: 100%;
    max-width: 400px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.crypto-close-btn:active {
    transform: scale(0.98);
    background: var(--bg-tertiary);
}

.crypto-close-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}

/* ── Confirmed state ── */
.crypto-screen-overlay.confirmed .crypto-logo-circle {
    background: linear-gradient(145deg, #34d058, #28a745);
    animation: confirmBounce 0.5s var(--ease-spring);
}

.crypto-screen-overlay.confirmed .crypto-orbit-track {
    border-color: rgba(48, 209, 88, 0.25);
    border-style: solid;
}

.crypto-screen-overlay.confirmed .crypto-orbit-dot {
    animation: none;
    border-color: rgba(48, 209, 88, 0.4);
}

.crypto-screen-overlay.confirmed .crypto-orbit-dot::after {
    display: none;
}

@keyframes confirmBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ===== TON PAYMENT — overrides for TON-branded screen ===== */

.ton-orbit-track { border-color: rgba(0, 152, 234, 0.18) !important; }
.ton-orbit-dot { border-top-color: #0098EA !important; }
.ton-orbit-dot::after { background: #0098EA !important; box-shadow: 0 0 8px rgba(0, 152, 234, 0.5) !important; }
.ton-logo-circle {
    background: linear-gradient(145deg, #1fb5ff, #0098EA) !important;
    box-shadow: 0 8px 24px rgba(0, 152, 234, 0.3), 0 2px 8px rgba(0, 152, 234, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.ton-logo-circle img { width: 50px; height: 50px; border-radius: 50%; }
.ton-currency { color: #0098EA !important; }
.ton-badge { background: rgba(0, 152, 234, 0.1) !important; color: #0098EA !important; }

.ton-connect-section {
    width: 100%;
    padding: 20px 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.btn-ton-connect {
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--border-radius);
    border: none;
    background: linear-gradient(135deg, #0098EA, #007acc);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 152, 234, 0.3);
}

.btn-ton-connect:active { transform: scale(0.97); }
.btn-ton-connect:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn-ton-connect img { border-radius: 50%; }

.btn-ton-connect.btn-ton-sent {
    background: linear-gradient(135deg, #34d058, #28a745);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
}

.ton-connect-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
    margin: 0;
}

/* Confirmed state override for TON */
.crypto-screen-overlay.confirmed .ton-logo-circle {
    background: linear-gradient(145deg, #34d058, #28a745) !important;
}
.crypto-screen-overlay.confirmed .ton-orbit-track { border-color: rgba(48, 209, 88, 0.25) !important; border-style: solid !important; }
.crypto-screen-overlay.confirmed .ton-orbit-dot { animation: none !important; border-color: rgba(48, 209, 88, 0.4) !important; }
.crypto-screen-overlay.confirmed .ton-orbit-dot::after { display: none; }

/* ── Entrance animations ── */
.crypto-screen-overlay .crypto-screen-header {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.4s var(--ease-spring) 0.1s;
}

.crypto-screen-overlay .crypto-amount-section {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.4s var(--ease-spring) 0.2s;
}

.crypto-screen-overlay .crypto-wallet-section {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.4s var(--ease-spring) 0.3s;
}

.crypto-screen-overlay .crypto-status-section {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.4s var(--ease-spring) 0.35s;
}

.crypto-screen-overlay .crypto-notices {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.4s var(--ease-spring) 0.4s;
}

.crypto-screen-overlay .crypto-screen-actions {
    opacity: 0;
    transition: opacity 0.3s ease 0.5s;
}

.crypto-screen-overlay.active .crypto-screen-header,
.crypto-screen-overlay.active .crypto-amount-section,
.crypto-screen-overlay.active .crypto-wallet-section,
.crypto-screen-overlay.active .crypto-status-section,
.crypto-screen-overlay.active .crypto-notices,
.crypto-screen-overlay.active .crypto-screen-actions {
    opacity: 1;
    transform: translateY(0);
}
