/* Exchange Page - iOS Optimized */

.exchange-section {
    padding: calc(100px + var(--safe-area-top)) 0 80px;
    min-height: 100vh;
    background: #fafafa;
}

.exchange-header {
    text-align: center;
    margin-bottom: 32px;
}

.exchange-header h1 {
    font-size: clamp(32px, 8vw, 48px);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.exchange-header p {
    font-size: 17px;
    color: var(--gray);
    line-height: 1.5;
}

/* iOS-style Wallet Card */
.wallet-section {
    margin-bottom: 32px;
}

.wallet-card {
    background: white;
    padding: 32px 24px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.wallet-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.wallet-card h3 {
    font-size: 24px;
    margin-bottom: 12px;
    font-weight: 700;
}

.wallet-card p {
    color: var(--gray);
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.6;
}

.wallet-info {
    margin-top: 20px;
    padding: 16px;
    background: var(--gray-light);
    border-radius: 12px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 14px;
}

.wallet-info p {
    margin: 0;
    word-break: break-all;
    color: var(--dark);
}

/* iOS-style Markets Grid */
.markets-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.market-card {
    background: white;
    padding: 24px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.market-card:active {
    transform: scale(0.98);
}

.market-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-light);
}

.market-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.market-icon {
    font-size: 48px;
}

.market-info h3 {
    font-size: 22px;
    margin-bottom: 4px;
    font-weight: 700;
}

.market-info p {
    color: var(--gray);
    font-size: 14px;
}

.market-price {
    text-align: right;
}

.price {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.change {
    font-weight: 600;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

.change.positive {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

.change.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.market-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.market-stats .stat {
    padding: 16px 12px;
    background: var(--gray-light);
    border-radius: 12px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

/* iOS-style Info Banner */
.info-banner {
    background: var(--gradient);
    padding: 32px 24px;
    border-radius: 24px;
    margin-bottom: 32px;
    color: white;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.info-content h3 {
    font-size: 22px;
    margin-bottom: 12px;
    font-weight: 700;
}

.info-content p {
    font-size: 16px;
    line-height: 1.6;
    opacity: 0.95;
}

.info-content a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

.info-content a:active {
    opacity: 0.8;
}

/* iOS-style Trade Guide */
.trade-guide {
    background: white;
    padding: 32px 24px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.trade-guide h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 32px;
    font-weight: 800;
}

.guide-steps {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.guide-step {
    background: var(--gray-light);
    padding: 24px;
    border-radius: 16px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.guide-number {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.guide-step-content {
    flex: 1;
}

.guide-step h4 {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 700;
}

.guide-step p {
    color: var(--gray);
    line-height: 1.6;
    font-size: 15px;
}

.guide-step a {
    color: var(--primary);
    font-weight: 600;
}

/* Tablet and up */
@media (min-width: 640px) {
    .markets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .market-stats {
        gap: 16px;
    }
}

/* Desktop */
@media (min-width: 968px) {
    .markets-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .guide-steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .guide-step {
        flex-direction: column;
        text-align: center;
    }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .market-header {
        flex-direction: column;
        gap: 16px;
    }

    .market-price {
        text-align: left;
        width: 100%;
    }

    .market-stats {
        grid-template-columns: 1fr;
    }

    .wallet-card {
        padding: 24px 20px;
    }

    .info-banner {
        padding: 24px 20px;
    }
}

/* Markets Header */
.markets-header {
    text-align: center;
    margin: 32px 0;
}

.markets-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.markets-header p {
    color: var(--gray);
    font-size: 16px;
}

/* Market Actions */
.market-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

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

.btn-trade:not(:disabled) {
    opacity: 1;
    cursor: pointer;
}

.token-issuer {
    color: var(--gray);
    font-size: 11px;
    font-family: monospace;
    display: block;
    margin-top: 4px;
}

.wallet-hint {
    font-size: 13px;
    color: var(--gray);
    margin-top: 8px;
}

/* Trading Modal */
.trade-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s var(--transition);
}

.trade-modal.active {
    opacity: 1;
}

.trade-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.trade-modal-content {
    position: relative;
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s var(--transition);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.trade-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--gray-light);
}

.trade-modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--gray);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-light);
    color: var(--dark);
}

.modal-close:active {
    transform: scale(0.9);
}

.trade-modal-body {
    padding: 24px;
}

.token-info-display {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--gray-light);
    border-radius: 16px;
    margin-bottom: 24px;
}

.token-icon-large {
    font-size: 48px;
}

.token-name-large {
    font-size: 20px;
    font-weight: 700;
}

.token-code-small {
    font-size: 14px;
    color: var(--gray);
}

.trade-input-group {
    margin-bottom: 20px;
}

.trade-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.trade-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s;
}

.trade-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.trade-summary {
    background: var(--gray-light);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 15px;
}

.summary-row:last-child {
    margin-bottom: 0;
    font-weight: 600;
    font-size: 16px;
}

.trade-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.trade-actions .btn {
    flex: 1;
}

.trade-info {
    background: rgba(59, 130, 246, 0.1);
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid var(--secondary);
}

.trade-info p {
    margin: 0;
    font-size: 13px;
    color: var(--dark);
    line-height: 1.6;
}

.trade-info p + p {
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 640px) {
    .market-actions {
        gap: 10px;
    }

    .trade-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .trade-modal-header {
        padding: 20px;
    }

    .trade-modal-body {
        padding: 20px;
    }

    .trade-actions {
        flex-direction: column;
    }
}