/**
 * Premium Swap Card Styles
 * SOL ↔ VAL token swap interface - Premium Design
 */

.swap-card {
  max-width: 100%;
  width: 100%;
  border-radius: 12px !important;
  /* Match sidebar-box border-radius */
  overflow: visible;
  /* Changed from hidden to visible to allow icon container to extend */
  background: linear-gradient(180deg, var(--panel-top, rgba(20, 25, 40, 0.8)), var(--panel-bot, rgba(15, 20, 35, 0.8)));
  backdrop-filter: blur(8px);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  box-shadow: var(--shadow-1, 0 4px 12px rgba(0, 0, 0, 0.15));
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.swap-card:hover {
  box-shadow: var(--shadow-2, 0 8px 24px rgba(0, 0, 0, 0.2));
}

html.light .swap-card {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

html.light .swap-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Compact swap card (under VAL balance) - 20% smaller */
/* Styles applied via specific selectors below */

.swap-card-compact .card-body {
  padding: 9.6px 11.2px 11.2px 11.2px;
  /* 20% smaller: 12px → 9.6px, 14px → 11.2px */
  gap: 8px;
  /* 20% smaller: 10px → 8px */
}

/* Swap header and title removed to save space */

.swap-card-compact .swap-section {
  gap: 6.4px;
  /* 20% smaller: 8px → 6.4px */
}

.swap-card-compact .swap-section-label {
  font-size: 10.4px;
  /* 20% smaller: 13px → 10.4px */
}

.swap-card-compact .swap-balance-text {
  font-size: 10.4px;
  /* 20% smaller: 13px → 10.4px */
}

.swap-card-compact .swap-amount-container {
  padding: 11.2px;
  /* 20% smaller: 14px → 11.2px */
  gap: 9.6px;
  /* 20% smaller: 12px → 9.6px */
  border-radius: 12.8px;
  /* 20% smaller: 16px → 12.8px */
}

.swap-card-compact .swap-token-selector {
  padding: 4.8px 8px;
  /* 20% smaller: 6px → 4.8px, 10px → 8px */
  min-width: 56px;
  /* 20% smaller: 70px → 56px */
  gap: 4.8px;
  /* 20% smaller: 6px → 4.8px */
  border-radius: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

.swap-card-compact .swap-token-logo {
  width: 17.6px;
  /* 20% smaller: 22px → 17.6px */
  height: 17.6px;
}

.swap-card-compact .swap-token-symbol {
  font-size: 11.2px;
  /* 20% smaller: 14px → 11.2px */
}

.swap-card-compact .swap-amount-input,
.swap-card-compact .swap-amount-output {
  font-size: 16px;
  /* 20% smaller: 20px → 16px */
}


.swap-card-compact .swap-rate {
  padding: 6.4px 0;
  /* 20% smaller: 8px → 6.4px */
  font-size: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

.swap-card-compact .swap-details-toggle {
  padding: 8px 9.6px;
  /* 20% smaller: 10px → 8px, 12px → 9.6px */
  font-size: 9.6px;
  /* 20% smaller: 12px → 9.6px */
  border-radius: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

.swap-card-compact .swap-details {
  padding: 9.6px;
  /* 20% smaller: 12px → 9.6px */
  gap: 6.4px;
  /* 20% smaller: 8px → 6.4px */
  border-radius: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

.swap-card-compact .swap-detail-row {
  font-size: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

.swap-card-compact .swap-detail-label,
.swap-card-compact .swap-detail-value {
  font-size: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

.swap-card-compact .swap-execute-btn {
  padding: 11.2px;
  /* 20% smaller: 14px → 11.2px */
  font-size: 12.8px;
  /* 20% smaller: 16px → 12.8px */
  border-radius: 9.6px;
  /* 20% smaller: 12px → 9.6px */
}

/* Premium Header */
.swap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 20px 0;
  /* Match sidebar-box header spacing */
  border-bottom: none;
  /* Remove border to match sidebar-box */
  margin-bottom: 0;
}

.swap-title {
  font-size: 18px;
  /* Match sidebar-title font-size */
  font-weight: 800;
  /* Match sidebar-title font-weight */
  color: #ffffff !important;
  /* Match sidebar-title color */
  margin: 0;
  letter-spacing: -0.01em;
  /* Match sidebar-title letter-spacing */
  line-height: 1.4;
}

html.light .swap-title {
  color: var(--color-text, var(--text-primary)) !important;
}

.swap-card .card-body {
  padding: 12px 16px 16px 16px;
  /* Match sidebar-box padding */
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  /* Allow absolute positioning for icon container */
}

/* Swap Sections (From/To) */
.swap-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  /* Ensure proper positioning context for icon container */
}

.swap-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.swap-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.swap-balance-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
}

/* Amount Container */
.swap-amount-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  transition: all 0.2s ease;
}

.swap-amount-container:focus-within {
  border-color: rgba(31, 221, 254, 0.4);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(31, 221, 254, 0.1);
}

/* Token Selector */
.swap-token-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: default;
  transition: all 0.2s ease;
  min-width: 80px;
}

.swap-token-selector:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.swap-token-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

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

/* Percentage Buttons */
.swap-percentage-buttons {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* Ensure minimum touch target for mobile accessibility */
.swap-percentage-btn {
  flex: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.swap-percentage-btn:hover {
  background: rgba(31, 221, 254, 0.15);
  border-color: rgba(31, 221, 254, 0.3);
  color: var(--color-primary-light, #67e8f9);
  /* Use lighter variant for better contrast on dark backgrounds */
  transform: translateY(-1px);
}

.swap-percentage-btn:active {
  transform: translateY(0);
  background: rgba(31, 221, 254, 0.2);
}

html.light .swap-percentage-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.7);
}

html.light .swap-percentage-btn:hover {
  background: rgba(31, 221, 254, 0.1);
  border-color: rgba(31, 221, 254, 0.3);
  color: var(--color-primary-dark, #0284c7);
  /* Use darker variant for better contrast on light backgrounds */
}

/* Compact swap card percentage buttons */
.swap-card-compact .swap-percentage-buttons {
  gap: 4.8px;
  /* 20% smaller: 6px → 4.8px */
  margin-top: 3.2px;
  /* 20% smaller: 4px → 3.2px */
}

.swap-card-compact .swap-percentage-btn {
  padding: 4.8px 6.4px;
  /* 20% smaller: 6px → 4.8px, 8px → 6.4px */
  font-size: 9.6px;
  /* 20% smaller: 12px → 9.6px */
  border-radius: 6.4px;
  /* 20% smaller: 8px → 6.4px */
}

/* Amount Input/Output */
.swap-amount-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-align: right;
  min-width: 0;
}

.swap-amount-input::placeholder {
  color: var(--text-tertiary);
  opacity: 0.4;
}

.swap-amount-output {
  flex: 1;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* Second definition - ensure no outline by default */
.swap-amount-input {
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  text-align: right;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  min-width: 0;
}

/* Focus state - only show outline when focused */
.swap-amount-input:focus {
  outline: 2px solid var(--color-primary, #1FDDFE);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(31, 221, 254, 0.15);
}

/* Swap Icon Button (Between From/To) - Centered relative to card outer edges */
.swap-icon-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: -8px calc(-16px);
  /* Dark theme: negative margin to center */
  width: calc(100% + 32px);
  padding: 0;
  position: relative;
}

/* Light theme: different margin needed for centering */
html.light .swap-icon-container {
  margin: -8px calc(149px) !important;
  /* Light theme: positive 149px margin to center (user tested value) */
  width: calc(100% + 32px) !important;
}

.swap-icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
}

.swap-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(31, 221, 254, 0.4);
  color: rgba(31, 221, 254, 1);
  transform: rotate(180deg) scale(1.05);
}

.swap-icon-btn:active {
  transform: rotate(180deg) scale(1);
}

.swap-icon-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  pointer-events: none;
  flex-shrink: 0;
  transition: stroke 0.2s ease;
  display: block;
  margin: auto;
}

/* Conversion Rate */
.swap-rate {
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Transaction Details Toggle */
.swap-details-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.swap-details-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.swap-details-arrow {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.swap-details-toggle.active .swap-details-arrow {
  transform: rotate(180deg);
}

/* Transaction Details */
.swap-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}

/* Hide swap details when it has the hidden class */
.swap-details.hidden {
  display: none !important;
}
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 8px;
  animation: slideDown 0.2s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.swap-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.swap-detail-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.swap-detail-value {
  color: var(--text-primary);
  font-weight: 600;
}


/* Swap Button */
.swap-execute-btn {
  width: 100%;
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  letter-spacing: 0.02em;
}

.swap-execute-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-tertiary);
}

.swap-execute-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.swap-execute-btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.swap-btn-text {
  position: relative;
  z-index: 1;
}

/* Status Display */
.swap-status {
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

.swap-status.loading {
  background: rgba(31, 221, 254, 0.1);
  border: 1px solid rgba(31, 221, 254, 0.3);
  color: #1FDDFE;
}

.swap-status.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.swap-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Light Mode */
html.light .swap-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.light .swap-header-icon {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}

html.light .swap-header-icon:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
}

html.light .swap-amount-container {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light .swap-amount-container:focus-within {
  border-color: rgba(14, 165, 233, 0.4);
  background: rgba(0, 0, 0, 0.03);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

html.light .swap-token-selector {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

html.light .swap-token-selector:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
}

/* Light theme - same structure, inverted colors */
html.light .swap-icon-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 2px solid rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.7);
}

html.light .swap-icon-btn svg {
  stroke: rgba(0, 0, 0, 0.7) !important;
  width: 24px !important;
  height: 24px !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin: auto !important;
}

html.light .swap-icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(31, 221, 254, 0.4);
  color: rgba(31, 221, 254, 1);
  transform: rotate(180deg) scale(1.05);
}

html.light .swap-icon-btn:hover svg {
  stroke: rgba(31, 221, 254, 1) !important;
}

html.light .swap-icon-btn:active {
  transform: rotate(180deg) scale(1);
}

html.light .swap-rate {
  border-top-color: rgba(0, 0, 0, 0.08);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

html.light .swap-details {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.05);
}

html.light .swap-execute-btn:disabled {
  background: rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
  .swap-card .card-body {
    padding: var(--spacing-sm) var(--spacing-md);
    gap: var(--spacing-sm);
    /* Optimized padding and gap for mobile */
  }

  .swap-card-compact .card-body {
    padding: var(--spacing-xs) var(--spacing-sm);
    gap: var(--spacing-xs);
    /* Even more compact on mobile */
  }

  .swap-header {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .swap-amount-input,
  .swap-amount-output {
    font-size: 20px;
    /* Slightly smaller on mobile */
  }

  .swap-execute-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 14px;
    /* More compact button on mobile */
  }

  /* Ensure swap card wraps properly */
  .swap-card {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* Mobile: Ensure button is accessible */
  .swap-icon-btn {
    width: 44px;
    height: 44px;
  }
}

/* Old deprecated styles removed - replaced by new premium design */
