/* ============================================
   Swap Modal Overlay and Container
============================================ */
.swap-modall {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(to bottom, var(--background-color), var(--primary-color), var(--gradient-mid));
  backdrop-filter: blur(6px);
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
}

/* ============================================
   Close Button for Swap Modal
============================================ */
.swap-modal .close-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 28px;
  color: #ccc;
  cursor: pointer;
  transition: color 0.3s ease;
  user-select: none;
}

.close-btn:hover {
  color: #fff;
}

/* ============================================
   Swap Modal Headings
============================================ */
.swap-header {
  position: relative;
  top: -90px; /* Adjust this to move it up */
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 16px;
}

.swap-header h2 {
  margin: 0 auto;
  font-size: 24px;
  text-align: center;
  font-weight: 600;
  padding-bottom: 12px;
  width: 100%;
}

.swap-header .close-btn {
  position: absolute;
  top: 9px;
  right: 30px;
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  transition: color 0.3s;
  touch-action: manipulation;
}
.swap-header .close-btn:hover {
  color: #fff;
}

/* ============================================
   Swap Asset Lists (From and To)
============================================ */
.swap-modal #swap-asset-list-from,
.swap-modal #swap-asset-list-to {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
}

.swap-modal .asset-item {
  display: flex;
  align-items: center;
  background: rgba(31, 31, 31, 0.8);
  padding: 14px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
  user-select: none;
}
.swap-modal .asset-item:hover {
  background: rgba(51, 51, 51, 0.9);
}

.swap-modal .asset-icon {
  width: 36px;
  height: 36px;
  margin-right: 14px;
  border-radius: 50%;
  object-fit: contain;
}

.swap-modal .asset-name {
  flex-grow: 1;
  font-weight: 700;
  font-size: 19px;
  color: var(--text-color);
}

.swap-modal .asset-balance {
  font-size: 15px;
  color: #aaa;
  min-width: 70px;
  text-align: right;
  font-family: monospace;
}

/* ============================================
   Swap Form and Inputs
============================================ */
.swap-modal form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 420px;
  width: 100%;
}

.swap-modal label {
  font-weight: 600;
  font-size: 15px;
  color: var(--label-color);
}

.swap-modal input[type="text"],
.swap-modal input[type="number"] {
  width: 90%;
  padding: 14px 16px;
  font-size: 17px;
  border: 1.5px solid var(--input-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-color);
  backdrop-filter: blur(3px);
  transition: border-color 0.3s ease;
}

.swap-modal input::placeholder {
  color: var(--placeholder-color);
}

.swap-modal input:focus,
.swap-modal input:focus-visible {
  border-color: var(--accent-color);
  outline: none;
}

/* ============================================
   MAX Buttons for Swap Inputs
============================================ */
.swap-modal .max-btn {
  background: var(--button-color);
  color: #dff9ff;
  width: 80px;
  align-self: flex-start;
  margin-top: -8px;
  margin-bottom: 14px;
  padding: 10px 0;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  user-select: none;
}
.swap-modal .max-btn:hover {
  background: var(--button-hover);
}

/* ============================================
   Swap Fee and Rate Text
============================================ */
.swap-modal #swapFee,
.swap-modal #swapRate {
  font-size: 16px;
  font-style: italic;
  color: #fff;
  margin-bottom: 16px;
}

/* ============================================
   Message Area
============================================ */
.swap-modal .message {
  margin-top: 10px;
  font-size: 15px;
  color: var(--warning-color);
  min-height: 20px;
  font-weight: 700;
}

/* ============================================
   Swap Action Button
============================================ */
.swap-modal #swapBtn {
  padding: 14px 22px;
  background: var(--button-color);
  border: none;
  border-radius: 12px;
  color: #dff9ff;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.3s ease;
  user-select: none;
}
.swap-modal #swapBtn:hover {
  background: var(--button-hover);
}

/* ============================================
   Scrollbar Styling for Swap Modal Asset Lists
============================================ */
.swap-modal #swap-asset-list-from::-webkit-scrollbar,
.swap-modal #swap-asset-list-to::-webkit-scrollbar {
  width: 14px;
}
.swap-modal #swap-asset-list-from::-webkit-scrollbar-track,
.swap-modal #swap-asset-list-to::-webkit-scrollbar-track {
  background: var(--primary-color);
  border-radius: 6px;
}
.swap-modal #swap-asset-list-from::-webkit-scrollbar-thumb,
.swap-modal #swap-asset-list-to::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 6px;
}

/* ============================================
   Responsive (Mobile Devices)
============================================ */
@media (max-width: 480px) {
  .swap-modal {
    padding: 18px 14px 30px;
  }
  .swap-modal h2 {
    font-size: 20px;
  }
  .swap-modal button,
  .swap-modal input[type="text"],
  .swap-modal input[type="number"] {
    font-size: 16px;
  }
  .swap-modal form {
    max-width: 100%;
  }
  .swap-modal .max-btn {
    width: 75px;
    font-size: 14px;
  }
  .swap-modal .asset-icon {
    width: 28px;
    height: 28px;
    margin-right: 10px;
  }
  .swap-modal .asset-name {
    font-size: 16px;
  }
  .swap-modal .asset-balance {
    font-size: 13px;
    min-width: 55px;
  }
}