/* Telegram theme tokens */
:root {
    --color-bg: var(--tg-theme-bg-color, #ffffff);
    --color-text: var(--tg-theme-text-color, #000000);
    --color-hint: var(--tg-theme-hint-color, #999999);
    --color-accent: var(--tg-theme-button-color, #3390ec);
    --color-accent-text: var(--tg-theme-button-text-color, #ffffff);
    --color-surface: var(--tg-theme-secondary-bg-color, #f4f4f5);
    --color-error: #e53935;

    /* Spacing scale: 8px base */
    --s1: 8px;
    --s2: 16px;
    --s3: 24px;
    --s4: 32px;
    --s6: 48px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    padding: var(--s2);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    padding: var(--s3) 0 var(--s2);
}

.method-label {
    font-size: 13px;
    color: var(--color-hint);
    margin-bottom: var(--s1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.amount {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
}

/* States */
.state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    padding: var(--s3) 0;
}

.hidden {
    display: none !important;
}

/* Status indicators */
.status-icon {
    margin-bottom: var(--s1);
}

.status-text {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.status-hint {
    font-size: 14px;
    color: var(--color-hint);
    text-align: center;
    max-width: 280px;
}

/* Pulse animation — CSS only */
.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Success animation */
.success-icon {
    animation: scaleIn 200ms ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Buttons */
.action-area {
    width: 100%;
    margin-top: auto;
    padding-top: var(--s3);
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}

.btn-primary {
    width: 100%;
    padding: var(--s2);
    border: none;
    border-radius: 12px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 150ms;
}

.btn-primary:active {
    opacity: 0.8;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: var(--s2);
    border: none;
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 16px;
    cursor: pointer;
}

/* QR code container */
.qr-container {
    background: white;
    padding: var(--s2);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 343px;
    aspect-ratio: 1;
    margin: 0 auto;
}

.qr-container img,
.qr-container canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Wallet address */
.address-field {
    background: var(--color-surface);
    border-radius: 12px;
    padding: var(--s2);
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--s1);
}

.address-text {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
}

.address-truncated {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.btn-copy {
    flex-shrink: 0;
    padding: var(--s1) var(--s2);
    border: none;
    border-radius: 8px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 150ms;
}

/* SBP link button */
.btn-sbp-link {
    width: 100%;
    padding: var(--s2);
    border: none;
    border-radius: 12px;
    background: #7b1fa2;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: block;
    text-align: center;
}

/* Card — iframe/redirect container */
.card-frame {
    width: 100%;
    flex: 1;
    min-height: 400px;
    border: none;
    border-radius: 12px;
}

/* Crypto amount info */
.crypto-info {
    text-align: center;
    padding: var(--s2) 0;
}

.crypto-amount {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--s1);
}

.crypto-currency {
    font-size: 14px;
    color: var(--color-hint);
}

/* Amount input */
.input-label {
    font-size: 14px;
    color: var(--color-hint);
    margin-bottom: var(--s1);
}

.amount-input-row {
    display: flex;
    align-items: center;
    gap: var(--s1);
    background: var(--color-surface);
    border-radius: 12px;
    padding: var(--s2);
}

.amount-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    outline: none;
    width: 100%;
    -moz-appearance: textfield;
}

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

.amount-input::placeholder {
    color: var(--color-hint);
    font-weight: 400;
    font-size: 18px;
}

.amount-input.input-error {
    color: var(--color-error);
}

.amount-currency {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-hint);
}

.quick-amounts {
    display: flex;
    gap: var(--s1);
    margin-top: var(--s2);
    flex-wrap: wrap;
}

.btn-quick {
    flex: 1;
    min-width: 60px;
    padding: var(--s1) var(--s2);
    border: 1px solid var(--color-surface);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.btn-quick:active {
    background: var(--color-surface);
}

/* Method selection buttons */
.btn-method {
    width: 100%;
    padding: var(--s2);
    border: 1px solid var(--color-surface);
    border-radius: 12px;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--s2);
    text-align: left;
    transition: background 150ms;
}

.btn-method:active {
    background: var(--color-surface);
}

.btn-method-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.btn-method-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-method-title {
    font-size: 16px;
    font-weight: 600;
}

.btn-method-desc {
    font-size: 13px;
    color: var(--color-hint);
}

/* Dismiss hint for long waits */
.dismiss-hint {
    font-size: 13px;
    color: var(--color-hint);
    text-align: center;
    padding: var(--s2);
    line-height: 1.4;
}
