/**
 * ===============================================================================================
 * LOFI ENHANCED SWAP MODAL STYLES
 * ===============================================================================================
 * 
 * Premium swap modal styling following LOFI design system.
 * Features smooth animations, LOFI branding, and mobile-first responsive design.
 * 
 * Design Principles:
 * - Dark theme with electric green (#00ff88) accent
 * - Gluten font family for brand consistency
 * - Smooth transitions and hover effects
 * - High contrast for accessibility
 * - Mobile-first responsive approach
 * 
 * ===============================================================================================
 */

/* ===============================================================================================
 * MODAL OVERLAY & BASE STRUCTURE
 * ===============================================================================================
 */

#lofi-swap-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lofiSwapFadeIn 0.3s ease-out;
}

#lofi-swap-modal.show {
  display: flex;
}

@keyframes lofiSwapFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(20px);
  }
}

.lofi-swap-container {
  background: linear-gradient(180deg, #2a2d5e 0%, #1a1d3e 100%);
  border: 2px solid rgba(138, 138, 237, 0.2);
  border-radius: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6), 0 0 30px rgba(138, 138, 237, 0.3);
  animation: lofiSwapSlideIn 0.4s ease-out;
  position: relative;
  overflow: visible;
}

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

/* Glow effect on container */
.lofi-swap-container::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    transparent 30%, 
    rgba(168, 184, 237, 0.1) 50%, 
    transparent 70%);
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.lofi-swap-container:hover::before {
  opacity: 1;
  animation: lofiGlowRotate 3s linear infinite;
}

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

/* ===============================================================================================
 * MODAL HEADER
 * ===============================================================================================
 */

.lofi-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 14px 20px;
  border-bottom: 1px solid rgba(138, 138, 237, 0.2);
}

.lofi-modal-header h2 {
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #4F76FF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lofi-modal-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 8px rgba(168, 184, 237, 0.5));
}

.lofi-modal-logo {
  width: 32px;
  height: 32px;
  margin-right: 4px;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(168, 184, 237, 0.4));
}

.lofi-modal-close {
  background: none;
  border: none;
  color: #a8b8ed;
  cursor: pointer;
  padding: 6px;
  transition: all 0.2s ease;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -4px -4px 0 0;
}

.lofi-modal-close:hover {
  background: rgba(138, 138, 237, 0.2);
  color: #ff4444;
  transform: rotate(90deg);
}

/* ===============================================================================================
 * SWAP CONTENT CONTAINER
 * ===============================================================================================
 */

.lofi-swap-content {
  padding: 24px;
}

/* ===============================================================================================
 * TOKEN SECTIONS
 * ===============================================================================================
 */

.lofi-swap-token-section {
  background: rgba(42, 45, 94, 0.9);
  border: 2px solid rgba(138, 138, 237, 0.2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lofi-swap-token-section:hover {
  border-color: rgba(138, 138, 237, 0.4);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 20px rgba(138, 138, 237, 0.2);
}

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

.lofi-swap-token-header label {
  color: #a8b8ed;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
}

/* ===============================================================================================
 * BALANCE DISPLAY
 * ===============================================================================================
 */

.lofi-balance-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #8898cd;
}

.lofi-balance-loader {
  display: flex;
  align-items: center;
}

.lofi-balance-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lofi-balance-value {
  color: #4F76FF;
  font-weight: 600;
}

.lofi-max-button {
  background: rgba(79, 118, 255, 0.1);
  border: 1px solid rgba(79, 118, 255, 0.3);
  color: #4F76FF;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  text-transform: uppercase;
}

.lofi-max-button:hover {
  background: rgba(79, 118, 255, 0.2);
  border-color: #4F76FF;
  box-shadow: 0 0 10px rgba(79, 118, 255, 0.3);
  transform: translateY(-1px);
}

/* ===============================================================================================
 * INPUT GROUPS
 * ===============================================================================================
 */

.lofi-swap-input-group {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.lofi-swap-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 28px;
  font-weight: 600;
  outline: none;
  padding: 0;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
}

.lofi-swap-input::placeholder {
  color: #5568a0;
}

.lofi-swap-input::-webkit-inner-spin-button,
.lofi-swap-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ===============================================================================================
 * TOKEN SELECTOR
 * ===============================================================================================
 */

.lofi-token-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(138, 138, 237, 0.1);
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(138, 138, 237, 0.2);
}

.lofi-token-selector:hover {
  background: rgba(138, 138, 237, 0.2);
  border-color: rgba(138, 138, 237, 0.4);
}

.lofi-token-selector img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.lofi-token-selector span {
  font-weight: 700;
  color: #ffffff;
  font-size: 16px;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
}

/* ===============================================================================================
 * USD VALUE DISPLAY
 * ===============================================================================================
 */

.lofi-input-value-usd {
  font-size: 13px;
  color: #8898cd;
  margin-top: 12px;
  height: 16px;
  font-style: italic;
}

/* ===============================================================================================
 * SWAP DIRECTION INDICATOR (Fixed - Always SUI → LOFI)
 * ===============================================================================================
 */

.lofi-swap-direction-indicator {
  display: flex;
  justify-content: center;
  margin: -8px 0;
  position: relative;
  z-index: 2;
}

.lofi-swap-direction-indicator svg {
  width: 24px;
  height: 24px;
  color: #a8b8ed;
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #a8b8ed;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Reverse button hover removed - fixed direction */
}

.lofi-swap-icon {
  width: 24px;
  height: 24px;
}

/* ===============================================================================================
 * SWAP DETAILS
 * ===============================================================================================
 */

.lofi-swap-details {
  background: rgba(42, 45, 94, 0.9);
  border: 1px solid rgba(138, 138, 237, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin: 24px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

.lofi-swap-detail-row:not(:last-child) {
  border-bottom: 1px solid rgba(138, 138, 237, 0.1);
}

.lofi-swap-detail-row span:first-child {
  color: #8898cd;
  font-weight: 500;
}

.lofi-swap-detail-row span:last-child {
  color: #ffffff;
  font-weight: 600;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
}

/* ===============================================================================================
 * PRICE DISPLAY
 * ===============================================================================================
 */

.lofi-price-value {
  position: relative;
  display: inline-block;
}

.lofi-price-text {
  transition: color 0.3s ease;
}

.lofi-price-flash {
  position: absolute;
  top: 0;
  left: -10px;
  right: -10px;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(168, 184, 237, 0.3), transparent);
  transform: translateX(-100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lofi-price-flash.flash {
  opacity: 1;
  animation: priceFlashSlide 0.3s ease-out;
}

@keyframes priceFlashSlide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* ===============================================================================================
 * SLIPPAGE CONTROLS
 * ===============================================================================================
 */

.lofi-slippage-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lofi-slippage-presets {
  display: flex;
  gap: 4px;
}

.lofi-slippage-preset {
  background: rgba(42, 45, 94, 0.9);
  border: 1px solid rgba(138, 138, 237, 0.2);
  color: #a8b8ed;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
}

.lofi-slippage-preset:hover {
  background: rgba(138, 138, 237, 0.2);
  color: #ffffff;
  border-color: rgba(138, 138, 237, 0.4);
}

.lofi-slippage-preset.active {
  background: rgba(79, 118, 255, 0.1);
  border-color: #4F76FF;
  color: #4F76FF;
  box-shadow: 0 0 10px rgba(79, 118, 255, 0.2);
}

/* ===============================================================================================
 * SLIPPAGE INPUT
 * ===============================================================================================
 */

.lofi-slippage-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lofi-slippage-input {
  background: rgba(42, 45, 94, 0.8);
  border: 1px solid rgba(138, 138, 237, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  width: 70px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  outline: none;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.lofi-slippage-input:focus {
  border-color: #4F76FF;
  box-shadow: 0 0 10px rgba(79, 118, 255, 0.2);
}

.lofi-slippage-input-group span {
  color: #a8b8ed;
  font-weight: 600;
}

/* ===============================================================================================
 * PRICE IMPACT
 * ===============================================================================================
 */

.lofi-price-impact {
  font-weight: 700;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
}

/* ===============================================================================================
 * SWAP BUTTON
 * ===============================================================================================
 */

.lofi-swap-button {
  width: 100%;
  padding: 18px;
  background: #4F76FF;
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.lofi-swap-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s ease;
}

.lofi-swap-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 118, 255, 0.4), 0 0 30px rgba(138, 138, 237, 0.3);
  background: #3a5ed8;
}

.lofi-swap-button:hover:not(:disabled)::before {
  left: 100%;
}

.lofi-swap-button:disabled {
  background: rgba(42, 45, 94, 0.5);
  color: #5568a0;
  cursor: not-allowed;
  transform: none;
}

.lofi-swap-button.loading {
  background: #3a5ed8;
  color: white;
}

.lofi-swap-button.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation: successPulse 0.5s ease;
}

.lofi-swap-button.error {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
  color: white;
  animation: errorShake 0.5s ease;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes errorShake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* ===============================================================================================
 * BUTTON STATES
 * ===============================================================================================
 */

.lofi-button-text {
  display: block;
}

.lofi-button-loader,
.lofi-button-success {
  display: none;
  align-items: center;
  justify-content: center;
}

.lofi-spinner {
  animation: spin 1s linear infinite;
}

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

/* ===============================================================================================
 * MESSAGES
 * ===============================================================================================
 */

.lofi-swap-message {
  padding: 12px 16px;
  border-radius: 10px;
  margin-top: 16px;
  font-size: 14px;
  text-align: center;
  font-weight: 600;
  animation: messageSlideIn 0.3s ease;
}

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

.lofi-swap-message-info {
  background: rgba(79, 118, 255, 0.1);
  border: 1px solid rgba(79, 118, 255, 0.3);
  color: #4F76FF;
}

.lofi-swap-message-warning {
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.3);
  color: #ffaa00;
}

.lofi-swap-message-error {
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  color: #ff4444;
}

.lofi-swap-message.shake {
  animation: messageShake 0.5s ease-in-out;
}

@keyframes messageShake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* ===============================================================================================
 * QUICK ACTIONS - REMOVED (Always SUI → LOFI)
 * ===============================================================================================
 */

.lofi-token-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===============================================================================================
 * QUOTE LOADER
 * ===============================================================================================
 */

.lofi-quote-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: rgba(42, 45, 94, 0.95);
  border-radius: 8px;
  padding: 0 10px;
}

.lofi-quote-skeleton {
  width: 100%;
}

/* ===============================================================================================
 * SKELETON LOADING
 * ===============================================================================================
 */

.lofi-skeleton {
  background: linear-gradient(90deg, rgba(138, 138, 237, 0.1) 25%, rgba(138, 138, 237, 0.2) 50%, rgba(138, 138, 237, 0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.lofi-skeleton-text {
  height: 16px;
  width: 80px;
}

.lofi-skeleton-number {
  height: 32px;
  width: 120px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===============================================================================================
 * RECENT TRANSACTIONS
 * ===============================================================================================
 */

.lofi-recent-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(138, 138, 237, 0.1);
}

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

.lofi-recent-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  color: #ffffff;
}

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

.lofi-tx-nav {
  background: rgba(42, 45, 94, 0.9);
  border: 1px solid rgba(138, 138, 237, 0.2);
  color: #a8b8ed;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.lofi-tx-nav:hover:not(:disabled) {
  background: rgba(138, 138, 237, 0.2);
  color: #ffffff;
  border-color: rgba(138, 138, 237, 0.4);
}

.lofi-tx-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#lofi-tx-counter {
  color: #8898cd;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  min-width: 50px;
  text-align: center;
}

.lofi-clear-recent {
  background: none;
  border: none;
  color: #8898cd;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
  font-family: 'Gluten', 'Comic Sans MS', cursive;
  text-transform: uppercase;
  margin-left: 8px;
}

.lofi-clear-recent:hover {
  color: #ff4444;
}

/* Transaction styles moved to swap-modal-transaction-slider.css */

.lofi-no-transactions {
  text-align: center;
  color: #8898cd;
  padding: 30px;
  font-size: 14px;
  font-style: italic;
}

/* ===============================================================================================
 * FAVORITES
 * ===============================================================================================
 */

.lofi-favorites-dropdown {
  position: relative;
}

.lofi-favorites-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(42, 45, 94, 0.95);
  border: 1px solid rgba(138, 138, 237, 0.3);
  border-radius: 8px;
  margin-top: 4px;
  padding: 8px;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.lofi-favorites-dropdown:hover .lofi-favorites-list {
  display: block;
}

/* ===============================================================================================
 * MOBILE RESPONSIVE
 * ===============================================================================================
 */

@media (max-width: 640px) {
  #lofi-swap-modal {
    padding: 0;
  }
  
  .lofi-swap-container {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    animation: lofiSwapSlideUp 0.3s ease-out;
  }
  
  @keyframes lofiSwapSlideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  .lofi-modal-header {
    padding: 14px 16px 12px 16px;
  }
  
  .lofi-modal-header h2 {
    font-size: 18px;
  }
  
  .lofi-swap-content {
    padding: 20px;
  }
  
  .lofi-swap-input {
    font-size: 24px;
  }
  
  .lofi-swap-button {
    font-size: 16px;
    padding: 16px;
  }
  
  /* Quick actions removed - always SUI → LOFI */
}

/* ===============================================================================================
 * ANIMATIONS AND TRANSITIONS
 * ===============================================================================================
 */

.lofi-swap-container * {
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
  transition-duration: 200ms;
  transition-timing-function: ease;
}

/* Disable transitions for inputs to prevent lag */
.lofi-swap-input,
.lofi-slippage-input {
  transition: none;
}

/* ===============================================================================================
 * SCROLLBAR STYLING
 * ===============================================================================================
 */

.lofi-swap-container::-webkit-scrollbar {
  width: 8px;
}

.lofi-swap-container::-webkit-scrollbar-track {
  background: rgba(42, 45, 94, 0.5);
  border-radius: 4px;
}

.lofi-swap-container::-webkit-scrollbar-thumb {
  background: rgba(138, 138, 237, 0.3);
  border-radius: 4px;
}

.lofi-swap-container::-webkit-scrollbar-thumb:hover {
  background: rgba(138, 138, 237, 0.5);
}

/* ===============================================================================================
 * ACCESSIBILITY
 * ===============================================================================================
 */

.lofi-swap-button:focus,
.lofi-modal-close:focus,
/* .lofi-quick-action:focus, removed */
.lofi-slippage-preset:focus,
.lofi-max-button:focus {
  outline: 2px solid rgba(138, 138, 237, 0.8);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(138, 138, 237, 0.2);
}

.lofi-swap-input:focus,
.lofi-slippage-input:focus {
  outline: none;
}

/* ===============================================================================================
 * ROTATING ANIMATION
 * ===============================================================================================
 */

.rotating {
  animation: rotate360 0.3s ease-in-out;
}

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(180deg);
  }
}