/* 引入 Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&display=swap');

/* 动态背景渐变动画 */
@keyframes gradientBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 粒子动画（简单的点状背景） */
@keyframes drift {
    from { transform: translate(0, 0); }
    to { transform: translate(-20px, -20px); }
}

:root {
    --primary-color: #2dd4bf; /* 新蓝绿色主色调 */
    --secondary-color: #0ea5e9; /* 亮蓝色次要色调 */
    --accent-color: #8b5cf6; /* 紫色强调色 */
    --background-start: #0f172a; /* 深蓝色背景开始 */
    --background-mid: #1e293b; /* 中等深度蓝色 */
    --background-end: #0f172a; /* 深蓝色背景结束 */
    --card-bg: rgba(15, 23, 42, 0.85); /* 更深的卡片背景 */
    --text-primary: #f1f5f9; /* 浅灰白色文本 */
    --text-secondary: #94a3b8; /* 灰蓝色次要文本 */
    --border-color: rgba(148, 163, 184, 0.1); /* 边框颜色 */
    --success-color: #10b981; /* 绿色成功 */
    --danger-color: #ef4444; /* 红色危险 */
    --warning-color: #f59e0b; /* 黄色警告 */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, var(--background-start), var(--background-mid), var(--background-end));
    background-size: 400% 400%;
    animation: gradientBackground 20s ease infinite;
    position: relative;
    min-height: 100vh;
    color: var(--text-primary);
}

/* 粒子背景层 */
.particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    animation: drift 30s linear infinite;
}

/* 预置若干粒子 */
.particle:nth-child(1) { width: 6px; height: 6px; top: 20%; left: 10%; animation-duration: 25s; }
.particle:nth-child(2) { width: 4px; height: 4px; top: 40%; left: 80%; animation-duration: 35s; }
.particle:nth-child(3) { width: 5px; height: 5px; top: 70%; left: 30%; animation-duration: 30s; }
.particle:nth-child(4) { width: 3px; height: 3px; top: 10%; left: 50%; animation-duration: 40s; }
.particle:nth-child(5) { width: 7px; height: 7px; top: 80%; left: 60%; animation-duration: 28s; }
.particle:nth-child(6) { width: 4px; height: 4px; top: 60%; left: 20%; animation-duration: 33s; }
.particle:nth-child(7) { width: 6px; height: 6px; top: 30%; left: 90%; animation-duration: 27s; }
.particle:nth-child(8) { width: 5px; height: 5px; top: 50%; left: 40%; animation-duration: 31s; }

#app {
    position: relative;
    z-index: 1;
}

.navbar-dark {
    background-color: rgba(20, 20, 20, 0.4) !important;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.8rem;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.wallet-connect #walletInfo {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-secondary);
}

#walletAddress {
    background-color: rgba(0, 210, 255, 0.15);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: inline-block;
}

#walletAddress:hover {
    background-color: rgba(0, 210, 255, 0.25);
    transform: translateY(-2px);
}

#walletBalance {
    font-weight: 600;
    color: var(--secondary-color);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(0,0,0,0.25);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.35);
    background: linear-gradient(135deg, #36e7d0, #2c9df0);
}

.btn-primary:disabled {
    background: #555;
    transform: none;
    box-shadow: none;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.exchange-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.exchange-container h1 {
    font-size: 2.4em;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.exchange-container .desc {
    font-size: 1.2em;
    margin-bottom: 25px;
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    transform: translateY(-5px);
}

.swap-card {
    margin-bottom: 30px;
}

.info-card {
    margin-top: 30px;
}

.card-header {
    background-color: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
}

.card-header h5 {
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.card-body {
    padding: 30px 20px;
}

.swap-container {
    position: relative;
}

.swap-box {
    position: relative;
    transition: all 0.3s ease;
}

.swap-box:hover {
    transform: translateY(-2px);
}

.swap-box label, .balance-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.swap-box .input-group {
    background-color: transparent;
}

.swap-box .input-group .form-control {
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 500;
    padding: 10px 0;
}

.swap-box .input-group .form-control:focus {
    box-shadow: none;
}

.swap-box .input-group .btn-outline-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 15px;
}

.swap-info {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.swap-info span:first-child {
    font-weight: 500;
}

.swap-info span:last-child {
    color: var(--text-primary);
}

.arrow-down {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--text-primary);
}

.dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}

.dropdown-item {
    color: var(--text-primary);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.dropdown-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* 代币信息样式 */
.info-item {
    margin-bottom: 20px;
}

.info-item h6 {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.token-address {
    font-family: monospace;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.token-price, .token-supply, .token-cap {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    background-color: rgba(0, 210, 255, 0.1);
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-block;
}

.pool-info {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
}

.pool-info span:first-child {
    color: var(--text-secondary);
}

.pool-tvl, .pool-volume {
    font-weight: 600;
    color: var(--primary-color);
}

/* 弹窗基础样式 */
.modal {
    z-index: 1050;
    display: none;
    overflow: hidden;
    outline: 0;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-start);
}

.modal.show {
    display: block;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    margin: 0;
    pointer-events: auto;
    height: auto;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* 进度条和成功弹窗内容样式优化 */
.modal-content {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    pointer-events: auto;
    z-index: 1060;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 特别针对iOS设备的修复 */
@supports (-webkit-touch-callout: none) {
    .modal-dialog {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) !important;
        margin: 0;
        width: 90%;
        max-width: 500px;
    }
    
    .modal-content {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
    }
}

/* 确保模态框始终在视口内 */
@media (max-height: 600px) {
    .modal-dialog {
        height: auto;
        max-height: 90vh;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* 确保底部按钮在移动设备上友好 */
.modal-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

@media (max-width: 576px) {
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* 确保背景遮罩覆盖整个屏幕且不透明 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--background-start) !important;
    z-index: 1040;
    opacity: 1 !important;
    display: block !important;
}

.modal-backdrop.show {
    opacity: 1 !important;
}

/* 交易哈希显示样式 */
.transaction-hash {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 10px;
    margin: 0 auto;
    max-width: 90%;
}

.hash-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.hash-container code {
    color: var(--text-secondary);
    word-break: break-all;
    font-size: 0.8rem;
}

.copy-btn {
    padding: 2px 6px;
    margin-left: 8px;
}

/* 成功动画 */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}

.check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid var(--success-color);
}

.check-icon::before {
    top: 3px;
    left: -2px;
    width: 30px;
    transform-origin: 100% 50%;
    border-radius: 100px 0 0 100px;
}

.check-icon::after {
    top: 0;
    left: 30px;
    width: 60px;
    transform-origin: 0 50%;
    border-radius: 0 100px 100px 0;
    animation: rotate-circle 4.25s ease-in;
}

.check-icon::before, .check-icon::after {
    content: '';
    height: 100px;
    position: absolute;
    background: var(--card-bg);
    transform: rotate(-45deg);
}

.check-icon .icon-line {
    height: 5px;
    background-color: var(--success-color);
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

.check-icon .icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
}

.check-icon .icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
}

@keyframes icon-line-tip {
    0% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    54% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    70% {
        width: 50px;
        left: -8px;
        top: 37px;
    }
    84% {
        width: 17px;
        left: 21px;
        top: 48px;
    }
    100% {
        width: 25px;
        left: 14px;
        top: 46px;
    }
}

@keyframes icon-line-long {
    0% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    65% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    84% {
        width: 55px;
        right: 0px;
        top: 35px;
    }
    100% {
        width: 47px;
        right: 8px;
        top: 38px;
    }
}

/* Spinner 加载动画 */
.spinner {
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wallet-connect #walletInfo {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    #walletAddress {
        max-width: 120px;
    }
    
    .swap-box .input-group {
        flex-direction: column;
    }
    
    .swap-box .input-group .form-control {
        text-align: center;
        margin-bottom: 10px;
    }
    
    .swap-box .input-group .btn-outline-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .exchange-container h1 {
        font-size: 2em;
    }
    
    .exchange-container .desc {
        font-size: 1em;
    }
}

/* 添加交易历史记录样式 */
.transaction-history {
    font-size: 0.9rem;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0 5px;
}

.transaction-history thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border: none;
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-secondary);
    padding: 10px 15px;
}

.transaction-history tbody tr {
    transition: all 0.3s ease;
    margin-bottom: 5px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.5), rgba(30, 41, 59, 0.5));
    backdrop-filter: blur(5px);
}

.transaction-history tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.7));
}

.transaction-history td {
    padding: 12px 15px;
    border: none;
    vertical-align: middle;
}

.transaction-history .badge {
    padding: 6px 10px;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

/* 实时更新标志 */
#realtime-badge {
    font-size: 0.8rem;
    position: relative;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

#realtime-badge::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #f1f5f9;
    border-radius: 50%;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

#realtime-badge.pulse {
    animation: badge-pulse 1s;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes badge-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 增加和减少效果 */
.increasing {
    color: #10b981 !important;
    position: relative;
    transition: color 0.3s ease;
}

.increasing::after {
    content: '↑';
    position: absolute;
    margin-left: 4px;
    font-weight: bold;
}

.decreasing {
    color: #ef4444 !important;
    position: relative;
    transition: color 0.3s ease;
}

.decreasing::after {
    content: '↓';
    position: absolute;
    margin-left: 4px;
    font-weight: bold;
}

/* 汇率显示样式 */
.rate-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    padding: 6px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.rate-display span {
    position: relative;
    transition: all 0.3s ease;
}

.rate-display-mobile {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.rate-update span {
    animation: rate-flash 1s;
}

@keyframes rate-flash {
    0% { color: var(--text-secondary); }
    50% { color: var(--primary-color); }
    100% { color: var(--text-secondary); }
}

/* 优化输入框样式 */
.input-group-enhanced {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 5px;
    transition: all 0.3s ease;
    display: flex !important; /* 确保总是flex布局 */
    flex-direction: row !important; /* 强制使用行方向 */
    align-items: center;
    width: 100%;
}

.input-group-enhanced:focus-within {
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.3);
}

.input-group-enhanced .form-control {
    background-color: transparent !important;
    border: none !important;
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 600;
    padding: 12px 15px;
    height: auto;
    width: 70% !important; /* 确保输入框宽度 */
    flex: 1; /* 让输入框占据可用空间 */
    text-align: left !important; /* 强制左对齐 */
    margin-bottom: 0 !important; /* 移除底部边距 */
}

.input-group-enhanced .btn-outline-secondary {
    background-color: rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--text-primary);
    padding: 8px 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: auto !important; /* 自动宽度 */
    margin: 0 !important; /* 移除边距 */
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* 美化交换方向按钮 */
#swapDirection {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    font-size: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    margin: 15px auto;
    z-index: 5;
    position: relative;
}

#swapDirection:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#swapDirection:active {
    transform: scale(0.95);
}

.arrow-down {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
    transition: transform 0.3s ease;
}

#swapDirection:hover .arrow-down {
    transform: rotate(180deg);
}

/* 确保交易历史表格完全显示 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none !important; /* 移除最大高度限制 */
    width: 100%;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--card-bg);
}

.transaction-history {
    width: 100%;
    table-layout: fixed; /* 使用固定表格布局 */
}

.transaction-history th,
.transaction-history td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 调整列宽 */
.transaction-history th:nth-child(1),
.transaction-history td:nth-child(1) {
    width: 20%; /* 时间列 */
}

.transaction-history th:nth-child(2),
.transaction-history td:nth-child(2) {
    width: 15%; /* 交易类型列 */
}

.transaction-history th:nth-child(3),
.transaction-history td:nth-child(3) {
    width: 20%; /* 金额列 */
}

.transaction-history th:nth-child(4),
.transaction-history td:nth-child(4) {
    width: 15%; /* 价格列 */
}

.transaction-history th:nth-child(5),
.transaction-history td:nth-child(5) {
    width: 15%; /* 地址列 */
}

.transaction-history th:nth-child(6),
.transaction-history td:nth-child(6) {
    width: 15%; /* 状态列 */
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 输入框组在移动端的特别处理 */
    .input-group-enhanced {
        display: flex !important;
        flex-wrap: nowrap !important;
        background-color: rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        padding: 3px;
        margin: 10px 0;
    }
    
    .input-group-enhanced .form-control {
        font-size: 1.2rem;
        padding: 14px 10px;
        flex: 1;
        min-width: 0;
        text-align: left !important;
        width: 60% !important;
    }
    
    .input-group-enhanced .btn-outline-secondary {
        font-size: 0.9rem;
        padding: 10px;
        width: auto !important;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* 更大更明显的交换按钮 */
    #swapDirection {
        width: 56px;
        height: 56px;
        margin: 20px auto;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    }
    
    .arrow-down {
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid white;
    }
    
    /* 交易历史表格在移动端的优化 */
    .transaction-history {
        font-size: 0.8rem;
        border-spacing: 0 8px;
    }
    
    .transaction-history th {
        padding: 10px 8px;
        font-size: 0.75rem;
    }
    
    .transaction-history td {
        padding: 12px 8px;
    }
    
    /* 在移动端自适应列宽 */
    .transaction-history th:nth-child(1),
    .transaction-history td:nth-child(1) {
        width: 22%; /* 时间列稍微宽一点 */
    }
    
    .transaction-history th:nth-child(2),
    .transaction-history td:nth-child(2) {
        width: 18%; /* 类型列 */
    }
    
    .transaction-history th:nth-child(3),
    .transaction-history td:nth-child(3) {
        width: 20%; /* 金额列 */
    }
    
    .transaction-history th:nth-child(4),
    .transaction-history td:nth-child(4) {
        width: 20%; /* 价格列 */
    }
    
    .transaction-history th:nth-child(6),
    .transaction-history td:nth-child(6) {
        width: 20%; /* 状态列 */
    }
    
    /* 地址列在移动端很小的屏幕上隐藏 */
    @media (max-width: 480px) {
        .transaction-history th:nth-child(5),
        .transaction-history td:nth-child(5) {
            display: none;
        }
    }
}

/* 专门针对iOS设备的修复 */
@supports (-webkit-touch-callout: none) {
    /* 修复iOS Safari上的底部安全区域 */
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* 修复iOS上固定定位元素的问题 */
    .modal {
        position: absolute;
    }
}

/* 给所有可交互元素添加触摸反馈 */
.clickable,
button,
.btn,
.nav-link,
.dropdown-item {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* 移除iOS上的点击高亮 */
}

/* 进度条优化 */
.progress {
    height: 10px;
    border-radius: 10px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

/* 添加汇率更新的动画效果 */
.pool-tvl, .pool-volume {
    transition: all 0.3s ease;
    position: relative;
}

/* 移动端钱包地址显示样式 */
.wallet-address-mobile {
    background-color: rgba(15, 23, 42, 0.75);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wallet-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.address-container {
    background: linear-gradient(90deg, rgba(45, 212, 191, 0.15), rgba(14, 165, 233, 0.15));
    border-radius: 8px;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    word-break: break-all;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.address-container.connected {
    background: linear-gradient(90deg, rgba(45, 212, 191, 0.25), rgba(14, 165, 233, 0.25));
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(45, 212, 191, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

/* 美化汇率显示 */
.current-rate-display {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.4));
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-left: 3px solid rgba(78, 108, 204, 0.6);
    transition: all 0.3s ease;
}

.current-rate-display span:last-child {
    font-weight: 600;
    animation: price-pulse 2s infinite;
}

.highlight-update {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
    border-left-color: rgba(78, 108, 204, 1);
    box-shadow: 0 0 15px rgba(78, 108, 204, 0.3);
}

/* 增强移动端按钮样式 */
@media (max-width: 768px) {
    .btn-token-select {
        width: 20%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .input-group-enhanced {
        flex-direction: column;
    }
    
    .input-group-enhanced .form-control {
        border-radius: 12px !important;
        margin-bottom: 5px;
    }
}

/* 交换按钮样式 */
.btn-swap {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.btn-swap:hover {
    transform: translateY(-3px) rotate(180deg);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.btn-swap:active {
    transform: translateY(0) rotate(180deg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 确保交易历史表格滚动条美观 */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--card-bg);
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 6px;
}

@media (max-width: 480px) {
    /* 超小屏幕上改进表格布局 */
    .transaction-history th,
    .transaction-history td {
        padding: 10px 5px;
        font-size: 0.75rem;
    }
    
    /* 更大的交换按钮 */
    .btn-swap {
        width: 56px;
        height: 56px;
        margin: 20px auto;
    }
}

/* 修复弹窗样式 */
.modal-backdrop {
    opacity: 0.7 !important;
    background: rgba(15, 23, 42, 0.8) !important;
    backdrop-filter: blur(5px) !important;
}

/* 增强交易弹窗可见性 */
#transactionProgressModal .modal-content,
#transactionSuccessModal .modal-content {
    background: var(--card-bg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#transactionProgressModal .modal-body,
#transactionSuccessModal .modal-body {
    padding: 1.5rem;
}

#transactionProgressModal .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
}

/* 缩小下拉菜单宽度，防止遮挡swapDirection按钮 */
.dropdown-menu.token-menu {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(78, 108, 204, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    padding: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    min-width: 90px !important;
    max-width: 90px !important;
    position: absolute;
    z-index: 1050;
    right: 0 !important;
    left: auto !important;
    margin-top: 5px;
}

/* 调整下拉菜单位置，不遮挡交换按钮 */
#fromTokenSelector + .dropdown-menu {
    transform: translateX(25px) !important;
}

/* 下拉菜单项样式调整 */
.dropdown-menu.token-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    color: #fff;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-menu.token-menu .dropdown-item img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

/* 移动端下拉菜单优化 */
@media (max-width: 576px) {
    .dropdown-menu.token-menu {
        min-width: 80px !important;
        max-width: 80px !important;
    }
    
    .dropdown-menu.token-menu .dropdown-item {
        padding: 5px 6px;
    }
    
    .dropdown-menu.token-menu .dropdown-item img {
        width: 16px;
        height: 16px;
    }
}

/* 按钮样式统一 */
.btn-token-select, .receive-token-display {
    display: flex !important;
    align-items: center !important;
    padding: 8px 15px !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    color: white !important;
    font-weight: 500 !important;
    margin-left: 8px !important;
    white-space: nowrap !important;
    transition: all 0.2s !important;
    gap: 8px !important;
    min-width: auto !important;
    position: relative !important;
    z-index: 1050 !important;
}

.btn-token-select:hover, .receive-token-display:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* 移动端下拉菜单优化 */
@media (max-width: 576px) {
    .dropdown-menu.token-menu {
        min-width: 160px !important;
        left: auto !important;
        right: 0 !important;
        top: 100% !important;
        position: absolute !important;
        max-width: 90% !important;
        transform: none !important;
    }
    
    .btn-token-select img, .receive-token-display img {
        width: 20px !important;
        height: 20px !important;
    }
    
    .input-group-enhanced {
        position: relative !important;
    }
    
    /* 确保下拉菜单内容可见 */
    .input-group-enhanced .dropdown {
        position: static !important;
    }
    
    /* 适配弹出菜单方向 */
    .dropdown-menu.token-menu.dropdown-menu-end {
        left: auto !important;
        right: 0 !important;
    }
}

/* 确保输入框和按钮在同一行 */
.input-group-enhanced {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    position: relative !important;
}

.input-group-enhanced .form-control {
    flex: 1 !important;
    border-radius: 12px !important;
    margin-right: 8px !important;
}

/* 修复接收选择按钮样式 */
.receive-token-display {
    cursor: default !important;
}

.receive-token-display.dropdown-toggle {
    cursor: pointer !important;
}

/* 添加下拉箭头样式 */
.dropdown-toggle::after {
    display: inline-block !important;
    margin-left: 0.255em !important;
    vertical-align: 0.255em !important;
    content: "" !important;
    border-top: 0.3em solid !important;
    border-right: 0.3em solid transparent !important;
    border-bottom: 0 !important;
    border-left: 0.3em solid transparent !important;
}

/* 确保toTokenSelector可点击 */
.receive-token-display.dropdown-toggle {
    position: relative !important;
    z-index: 1050 !important;
}

/* 修复弹窗样式 */
.modal-backdrop {
    display: none !important;
}

/* 修改input-group在移动端的布局，保持水平布局 */
@media (max-width: 768px) {
    .input-group-enhanced {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
    }
    
    .input-group-enhanced .form-control {
        width: 60% !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
    }
    
    .btn-token-select {
        width: auto !important;
        margin-top: 0 !important;
        white-space: nowrap !important;
    }
} 