* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 20px;
    text-align: center;
    border-radius: 0 0 24px 24px;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
}

.main {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Выбор операции */
.operation-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 16px;
    padding: 6px;
    gap: 6px;
    margin-bottom: 20px;
}

.operation-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: none;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.operation-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.tab-icon {
    font-size: 20px;
}

/* Сумма обмена */
.amount-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.amount-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.amount-input-container {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 4px;
    transition: border-color 0.3s ease;
}

.amount-input-container:focus-within {
    border-color: #667eea;
}

#amountInput {
    width: 100%;
    border: none;
    background: transparent;
    padding: 16px;
    font-size: 20px;
    font-weight: 600;
    outline: none;
    color: #333;
}


/* Секции */
.crypto-section, .payment-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.crypto-section h3, .payment-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

/* Сетка криптовалют */
.crypto-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.crypto-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.crypto-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.crypto-card.selected {
    border-color: #667eea;
    background: #e8f2ff;
    color: #667eea;
}

.crypto-icon {
    font-size: 24px;
    font-weight: bold;
}

.crypto-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.crypto-symbol {
    font-size: 10px;
    color: #666;
    font-weight: 500;
}

.crypto-price {
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
}

.crypto-change {
    font-size: 10px;
    font-weight: 500;
}

.crypto-change.positive {
    color: #10b981;
}

.crypto-change.negative {
    color: #ef4444;
}

/* Сетка банков */
.payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.payment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.payment-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.payment-card.selected {
    border-color: #667eea;
    background: #e8f2ff;
    color: #667eea;
}

.bank-icon {
    font-size: 24px;
}

.bank-name {
    font-size: 12px;
    font-weight: 600;
}

/* Результат обмена */
.result-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.result-card {
    background: linear-gradient(135deg, #f0f8ff 0%, #e8f2ff 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 20px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.result-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.result-amount {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.result-currency {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
}

.result-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.rate-info {
    font-weight: 500;
}

.commission-info {
    font-weight: 500;
}

#commission {
    color: #667eea;
    font-weight: 600;
}

/* Кнопка создания заявки */
.create-order-btn {
    width: 100%;
    padding: 18px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.create-order-btn:not(:disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.create-order-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.create-order-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-icon {
    font-size: 18px;
}

/* Форма заявки - Popup */
.order-form {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.order-form-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: popupSlideIn 0.3s ease;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popupSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

.order-form.closing .order-form-content {
    animation: popupSlideOut 0.2s ease;
}

.order-form h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    margin-top: 0;
}

.close-popup {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
    transition: all 0.3s ease;
}

.close-popup:hover {
    background: #e0e0e0;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Экран успеха */
.success-screen {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.success-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.success-screen h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #10b981;
    font-weight: 700;
}

.success-screen p {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

.success-screen strong {
    color: #333;
    font-weight: 600;
}

/* Загрузка */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* Ошибки */
.error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }
    
    .main {
        padding: 20px 16px;
        gap: 20px;
    }
    
    .crypto-grid,
    .payment-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .crypto-card,
    .payment-card {
        padding: 12px 8px;
    }
}