/* Contrast Finance - Swap Widget Styles */

/* Token Selector Modal */
.token-selector-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

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

.token-selector-container {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

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

.token-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-primary);
}

.token-selector-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.token-selector-header .close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.token-selector-header .close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.token-selector-search {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-primary);
}

.token-selector-search input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.token-selector-search input:focus {
  border-color: var(--contrast-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.token-selector-search input::placeholder {
  color: var(--text-muted);
}

.token-selector-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.token-selector-list::-webkit-scrollbar {
  width: 6px;
}

.token-selector-list::-webkit-scrollbar-track {
  background: transparent;
}

.token-selector-list::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 3px;
}

.token-selector-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

.token-list-section {
  margin-bottom: 12px;
}

.section-label {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.token-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.token-list-item:hover {
  background: var(--bg-hover);
}

.token-list-item:active {
  transform: scale(0.98);
}

.token-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.token-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-secondary);
}

.token-logo-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-secondary);
  margin-right: 8px;
}

.token-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.token-item-symbol {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.token-item-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.token-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.token-item-balance {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.token-item-value {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Swap Widget Main Container - 1inch/Uniswap Style */
.modern-swap-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
}

.swap-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.swap-widget-container {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  padding: 20px;
  margin: 20px auto;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

/* Swap Tabs and Controls */
.swap-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-primary);
}

.swap-tab {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.2s;
}

.swap-tab.active {
  background: var(--bg-hover);
}

.swap-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-icon {
  background: transparent;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.control-icon:hover {
  background: var(--bg-hover);
  border-color: var(--contrast-green);
  color: var(--text-primary);
}

.swap-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.swap-widget-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.swap-settings-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
}

.swap-settings-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Token Input Containers - 1inch/Uniswap Style */
.token-input-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.token-input-container:hover {
  border-color: var(--border-secondary);
}

.token-input-container:focus-within {
  border-color: var(--contrast-green);
  box-shadow: 0 0 0 1px var(--contrast-green);
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.input-header label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.balance {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.token-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.amount-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 500;
  font-family: var(--font-mono);
  outline: none;
  width: 100%;
}

.amount-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.amount-input:read-only {
  cursor: default;
}

.token-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.token-selector-btn:hover {
  background: var(--bg-hover);
  border-color: var(--contrast-green);
}

.token-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.token-symbol {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.usd-value {
  font-size: 14px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: left;
}

.swap-input-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.swap-input-section:focus-within {
  border-color: var(--contrast-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.swap-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.swap-input-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.swap-input-balance {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.swap-input-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.swap-amount-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 500;
  font-family: var(--font-mono);
  outline: none;
}

.swap-amount-input::placeholder {
  color: var(--text-muted);
}

.swap-token-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.swap-token-selector:hover {
  background: var(--bg-tertiary);
  border-color: var(--contrast-green);
}

.swap-token-selector span {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.swap-token-selector i {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Swap Direction Button */
.swap-direction {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -8px auto;
  position: relative;
  z-index: 10;
}

.swap-flip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: 4px solid var(--bg-primary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.swap-flip-btn:hover {
  background: var(--bg-hover);
  border-color: var(--bg-primary);
  color: var(--text-primary);
  transform: rotate(180deg);
}

.swap-flip-btn svg {
  width: 20px;
  height: 20px;
}

.swap-reverse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -20px auto;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
  position: relative;
}

.swap-reverse-btn:hover {
  background: var(--contrast-green);
  border-color: var(--contrast-green);
  transform: rotate(180deg);
}

.swap-reverse-btn i {
  color: var(--text-secondary);
  font-size: 16px;
}

.swap-reverse-btn:hover i {
  color: var(--text-primary);
}

/* Swap Details - Price Info */
.swap-details {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0;
  border: 1px solid var(--border-primary);
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border-primary);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row span:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-row span:last-child {
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

.detail-row .low-impact {
  color: var(--contrast-green);
}

.detail-row .medium-impact {
  color: var(--contrast-orange);
}

.detail-row .high-impact {
  color: var(--contrast-red);
}

.swap-price-info {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 0;
}

.price-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

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

.price-info-row span:last-child {
  color: var(--text-primary);
  font-weight: 500;
  font-family: var(--font-mono);
}

.price-info-row .warning {
  color: var(--contrast-orange);
}

/* Swap Button */
.swap-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--contrast-green), var(--contrast-green-dark));
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.swap-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.swap-btn:active:not(:disabled) {
  transform: translateY(0);
}

.swap-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.swap-btn i {
  margin-right: 8px;
}

.swap-button {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--contrast-green), var(--contrast-green-dark));
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
}

.swap-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.swap-button:active:not(:disabled) {
  transform: translateY(0);
}

.swap-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.swap-button i.fa-spinner {
  margin-right: 8px;
}

/* Powered By Section */
.powered-by {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-primary);
}

.powered-by span {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.powered-by span::before {
  content: '⚡';
  font-size: 14px;
}

/* Loading States */
.swap-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 11, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  z-index: 100;
}

.swap-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-primary);
  border-top-color: var(--contrast-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.swap-loading-text {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Notifications/No Results */
.no-results {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Trade Page Specific Styles */
.trade-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.trade-mode-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--contrast-green);
  border-color: var(--contrast-green);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
  background: white;
}

/* Responsive */
@media (max-width: 768px) {
  .modern-swap-container {
    padding: 12px;
  }

  .swap-widget {
    padding: 12px;
  }

  .amount-input {
    font-size: 24px;
  }

  .swap-widget-container {
    margin: 12px;
    padding: 16px;
  }

  .swap-amount-input {
    font-size: 20px;
  }

  .token-selector-container {
    width: 95%;
    max-height: 90vh;
  }

  .trade-mode-header {
    padding: 16px;
  }

  .trade-mode-header h1 {
    font-size: 24px;
  }
}
