.exchange-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.exchange-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  padding: 25px;
  width: 100%;
  max-width: 500px;
  border: 1px solid #eaeaea;
}

.exchange-card h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #2c3e50;
  display: flex;
  align-items: center;
}

.exchange-card p {
  color: #666;
  margin-bottom: 20px;
}

.card-header-with-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.card-header-with-btn h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: #2c3e50;
}

.btn-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 6px 14px;
  font-size: 0.85em;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.btn-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-info:active {
  transform: translateY(0);
}

.exchange-divider {
  display: flex;
  align-items: center;
  margin: 10px 0;
  width: 100%;
  max-width: 500px;
}

.exchange-divider::before,
.exchange-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.exchange-divider span {
  padding: 0 15px;
  color: #7f8c8d;
  font-weight: 500;
}

.exchange-hint {
  margin-top: 15px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #6c757d;
}

.exchange-hint p {
  margin: 0;
  color: #6c757d;
  font-size: 0.9rem;
}

.exchange-result {
  margin-top: 15px;
  padding: 0;
  min-height: 0;
  display: none;
}

.exchange-result.show {
  display: block;
  animation: slideDown 0.3s ease;
}

.exchange-result.success {
  color: #155724;
  padding: 12px 15px;
  background: #d4edda;
  border-radius: 6px;
  border: 1px solid #c3e6cb;
  border-left: 4px solid #28a745;
  font-size: 0.95rem;
}

.exchange-result.error {
  color: #721c24;
  padding: 12px 15px;
  background: #f8d7da;
  border-radius: 6px;
  border: 1px solid #f5c6cb;
  border-left: 4px solid #dc3545;
  font-size: 0.95rem;
}

.exchange-result.info {
  color: #004085;
  padding: 12px 15px;
  background: #d1ecf1;
  border-radius: 6px;
  border: 1px solid #bee5eb;
  border-left: 4px solid #17a2b8;
  font-size: 0.95rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-group {
  display: flex;
  width: 100%;
  margin-bottom: 15px;
  gap: 10px;
}

.input-group .form-control {
  flex: 1;
  min-width: 0;
  border-radius: 6px;
  border: 1px solid #ddd;
  padding: 10px 15px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-group .form-control:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group .form-control::placeholder {
  color: #999;
  font-size: 0.95rem;
}

.input-group .btn {
  white-space: nowrap;
  border-radius: 6px;
  padding: 10px 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.input-group .btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.input-group .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .exchange-container {
    padding: 15px;
    gap: 20px;
  }
  
  .exchange-card {
    padding: 20px;
  }
  
  .exchange-card h3 {
    font-size: 1.2rem;
  }
  
  .card-header-with-btn {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .card-header-with-btn .btn-info {
    align-self: stretch;
    text-align: center;
    padding: 8px 14px;
  }
  
  .input-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .input-group .form-control {
    width: 100%;
    min-width: auto;
  }
  
  .input-group .btn {
    width: 100%;
    padding: 12px 20px;
  }
  
  .exchange-result {
    font-size: 0.9rem;
  }
  
  .exchange-result.success,
  .exchange-result.error,
  .exchange-result.info {
    padding: 10px 12px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .exchange-container {
    max-width: 600px;
  }
  
  .exchange-card {
    max-width: 100%;
  }
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 1000px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
  overflow: hidden;
  position: relative;
}

.modal-content.large-modal {
  max-width: 1200px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 2px solid #f0f0f0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 28px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-weight: 300;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
  border-color: rgba(255, 255, 255, 0.5);
}

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

.modal-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0 0 16px 16px;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  font-size: 0.95rem;
}

.modal-body::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b4298 100%);
}

.history-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8f9fa;
}

.history-table thead tr {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.history-table thead th {
  padding: 15px 20px;
  text-align: left;
  font-weight: 600;
  color: #2c3e50;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
  min-width: 120px;
}

.history-table thead th:first-child {
  min-width: 180px;
  border-radius: 0;
}

.history-table thead th:last-child {
  min-width: 150px;
  border-radius: 0;
}

.history-table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.history-table tbody tr:hover {
  background-color: #f8f9fa;
  transform: translateX(2px);
}

.history-table tbody td {
  padding: 14px 20px;
  color: #495057;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
  position: relative;
}

.history-table tbody td[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 100;
  background: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: normal;
  max-width: 300px;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.85rem;
}

.loading-cell {
  text-align: center;
  padding: 40px !important;
  color: #667eea;
  font-size: 1.1rem;
}

.loading-cell i {
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

.error-cell {
  text-align: center;
  padding: 30px !important;
  color: #dc3545;
  background: #fff5f5;
  font-weight: 500;
}

.empty-cell {
  text-align: center;
  padding: 40px !important;
  color: #6c757d;
  font-size: 1rem;
  background: #f8f9fa;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }
  
  .modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    margin: auto;
  }
  
  .modal-header {
    border-radius: 12px 12px 0 0;
    padding: 15px 20px;
  }
  
  .modal-header h3 {
    font-size: 1.2rem;
  }
  
  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 24px;
  }
  
  .modal-body {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    overflow-x: auto;
  }
  
  .history-table {
    font-size: 0.85rem;
  }
  
  .history-table thead th {
    padding: 12px 15px;
    min-width: 100px;
    font-size: 0.85rem;
  }
  
  .history-table thead th:first-child {
    min-width: 150px;
  }
  
  .history-table tbody td {
    padding: 10px 15px;
    max-width: 250px;
  }

  .exchange-history-modal .modal-body::after,
  .redemption-history-modal .modal-body::after,
  .orders-history-modal .modal-body::after {
    content: '← 左右滑动查看更多 →';
    position: sticky;
    left: 50%;
    transform: translateX(-50%);
    bottom: 10px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    z-index: 100;
    pointer-events: none;
    animation: fadeInOut 3s ease;
  }
  
  @keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
  }
}

@media (max-width: 480px) {
  .modal-content {
    max-height: 85vh;
  }
  
  .modal-body {
    max-height: calc(85vh - 100px);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .modal-content {
    max-width: 90%;
    max-height: 90vh;
  }
  
  .history-table thead th {
    min-width: 110px;
  }
  
  .history-table tbody td {
    max-width: 300px;
  }
}

@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    .modal-content {
      margin-bottom: max(10px, env(safe-area-inset-bottom));
      max-height: calc(90vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
  }
}