/**
 * ===============================================================================================
 * LOFI WALLET MODAL STYLES
 * ===============================================================================================
 * 
 * Premium wallet connection modal styling following LOFI design system.
 * Features official wallet branding, smooth animations, 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
 * 
 * ===============================================================================================
 */

/* ===============================================================================================
 * WALLET MODAL OVERLAY & CONTAINER
 * ===============================================================================================
 */

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

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

.lofi-modal-container {
  background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 24px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 
    0 0 0 1px rgba(0, 255, 136, 0.1),
    0 20px 80px rgba(0, 0, 0, 0.8),
    0 0 120px rgba(0, 255, 136, 0.15),
    inset 0 0 40px rgba(0, 255, 136, 0.03);
  animation: lofiModalSlideIn 0.4s ease-out;
  position: relative;
  overflow: visible;
}

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

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

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

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

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

.lofi-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  position: relative;
}

.lofi-modal-header h2 {
  font-family: 'Gluten', 'Arial Black', sans-serif;
  font-weight: 800;
  font-size: 32px;
  color: #00ff88;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 
    0 0 20px rgba(0, 255, 136, 0.5),
    0 0 40px rgba(0, 255, 136, 0.3);
  animation: lofiTextGlow 2s ease-in-out infinite alternate;
}

@keyframes lofiTextGlow {
  from {
    text-shadow: 
      0 0 20px rgba(0, 255, 136, 0.5),
      0 0 40px rgba(0, 255, 136, 0.3);
  }
  to {
    text-shadow: 
      0 0 30px rgba(0, 255, 136, 0.7),
      0 0 60px rgba(0, 255, 136, 0.4);
  }
}

.lofi-modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.lofi-modal-close::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 68, 68, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.lofi-modal-close:hover {
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.5);
  color: #ff4444;
  transform: rotate(90deg);
}

.lofi-modal-close:hover::before {
  width: 100%;
  height: 100%;
}

/* ===============================================================================================
 * WALLET OPTIONS CONTAINER
 * ===============================================================================================
 */

.lofi-wallet-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Wallet Option Button */
.lofi-wallet-option {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(45, 45, 45, 0.3) 0%, rgba(26, 26, 26, 0.3) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

/* Shimmer effect */
.lofi-wallet-option::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(0, 255, 136, 0.1) 50%,
    transparent 70%
  );
  transform: rotate(45deg) translateX(-100%);
  transition: transform 0.6s ease;
}

.lofi-wallet-option:hover::before {
  transform: rotate(45deg) translateX(100%);
}

.lofi-wallet-option:hover {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.08) 0%, rgba(0, 255, 136, 0.03) 100%);
  border-color: rgba(0, 255, 136, 0.3);
  transform: translateX(8px);
  box-shadow: 
    0 4px 20px rgba(0, 255, 136, 0.2),
    inset 0 0 20px rgba(0, 255, 136, 0.05);
}

/* Active/pressed state */
.lofi-wallet-option:active {
  transform: translateX(4px) scale(0.98);
  transition: transform 0.1s ease;
}

/* ===============================================================================================
 * WALLET BRANDING
 * ===============================================================================================
 */

.lofi-wallet-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.lofi-wallet-option:hover .lofi-wallet-icon {
  transform: scale(1.05);
  border-color: rgba(0, 255, 136, 0.3);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.lofi-wallet-icon img,
.lofi-wallet-icon svg {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* Wallet-specific icon styling */
.lofi-wallet-option[data-wallet="phantom"] .lofi-wallet-icon {
  background: linear-gradient(135deg, #534BB1 0%, #6E5EC1 100%);
}

.lofi-wallet-option[data-wallet="okx"] .lofi-wallet-icon {
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
}

.lofi-wallet-option[data-wallet="slush"] .lofi-wallet-icon {
  background: linear-gradient(135deg, #FF6B00 0%, #FF8800 100%);
}

/* ===============================================================================================
 * WALLET INFO
 * ===============================================================================================
 */

.lofi-wallet-info {
  flex: 1;
  text-align: left;
}

.lofi-wallet-name {
  font-family: 'Gluten', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

.lofi-wallet-option:hover .lofi-wallet-name {
  color: #00ff88;
}

.lofi-wallet-status {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Status indicators */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #666;
  transition: all 0.3s ease;
}

.status-dot.detected {
  background: #00ff88;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
  animation: lofiPulse 2s ease-in-out infinite;
}

.status-dot.not-detected {
  background: #ff8800;
  box-shadow: 0 0 10px rgba(255, 136, 0, 0.5);
}

@keyframes lofiPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

/* ===============================================================================================
 * WALLET ARROW INDICATOR
 * ===============================================================================================
 */

.lofi-wallet-arrow {
  font-size: 24px;
  color: rgba(0, 255, 136, 0.6);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.lofi-wallet-option:hover .lofi-wallet-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ===============================================================================================
 * NOT INSTALLED STATE
 * ===============================================================================================
 */

.lofi-wallet-option.not-installed {
  background: linear-gradient(135deg, rgba(45, 45, 45, 0.2) 0%, rgba(26, 26, 26, 0.2) 100%);
  border-style: dashed;
  opacity: 0.8;
}

.lofi-wallet-option.not-installed:hover {
  opacity: 1;
  background: linear-gradient(135deg, rgba(255, 136, 0, 0.08) 0%, rgba(255, 136, 0, 0.03) 100%);
  border-color: rgba(255, 136, 0, 0.3);
}

.lofi-wallet-option.not-installed .lofi-wallet-status {
  color: #ff8800;
}

/* ===============================================================================================
 * LOADING STATE
 * ===============================================================================================
 */

.lofi-wallet-loading {
  text-align: center;
  padding: 60px 20px;
}

.lofi-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(0, 255, 136, 0.1);
  border-top-color: #00ff88;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: lofiSpin 1s linear infinite;
}

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

.lofi-loading-text {
  font-family: 'Gluten', sans-serif;
  font-size: 18px;
  color: #00ff88;
  margin-bottom: 8px;
}

.lofi-loading-subtext {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

/* ===============================================================================================
 * CONNECTED STATE
 * ===============================================================================================
 */

.lofi-connected-info {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.1) 0%, rgba(0, 255, 136, 0.05) 100%);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.lofi-connected-wallet {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.lofi-connected-wallet img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.lofi-connected-wallet-name {
  font-family: 'Gluten', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #00ff88;
}

.lofi-wallet-address {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  word-break: break-all;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===============================================================================================
 * ACTION BUTTONS
 * ===============================================================================================
 */

.lofi-modal-actions {
  display: flex;
  gap: 12px;
}

.lofi-action-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-family: 'Gluten', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.lofi-copy-btn {
  background: linear-gradient(135deg, rgba(68, 68, 255, 0.2) 0%, rgba(68, 68, 255, 0.1) 100%);
  color: #8888ff;
  border: 1px solid rgba(68, 68, 255, 0.3);
}

.lofi-copy-btn:hover {
  background: linear-gradient(135deg, rgba(68, 68, 255, 0.3) 0%, rgba(68, 68, 255, 0.2) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(68, 68, 255, 0.3);
}

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

.lofi-copy-btn.copied {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.2) 0%, rgba(0, 255, 136, 0.1) 100%);
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.3);
}

.lofi-disconnect-btn {
  background: linear-gradient(135deg, rgba(255, 68, 68, 0.2) 0%, rgba(255, 68, 68, 0.1) 100%);
  color: #ff4444;
  border: 1px solid rgba(255, 68, 68, 0.3);
}

.lofi-disconnect-btn:hover {
  background: linear-gradient(135deg, rgba(255, 68, 68, 0.3) 0%, rgba(255, 68, 68, 0.2) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255, 68, 68, 0.3);
}

/* ===============================================================================================
 * WALLET ICONS (INLINE SVG FALLBACKS)
 * ===============================================================================================
 */

/* Default wallet icon (generic) */
.lofi-wallet-icon.default-icon::after {
  content: '';
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #666 0%, #888 100%);
  border-radius: 8px;
}

/* ===============================================================================================
 * RESPONSIVE DESIGN
 * ===============================================================================================
 */

@media (max-width: 768px) {
  .lofi-modal-container {
    padding: 24px;
    margin: 20px;
  }
  
  .lofi-modal-header h2 {
    font-size: 28px;
  }
  
  .lofi-wallet-option {
    padding: 16px 20px;
  }
  
  .lofi-wallet-icon {
    width: 48px;
    height: 48px;
  }
  
  .lofi-wallet-icon img,
  .lofi-wallet-icon svg {
    width: 32px;
    height: 32px;
  }
  
  .lofi-wallet-name {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  #lofi-wallet-modal {
    padding: 0;
  }
  
  .lofi-modal-container {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 20px;
    margin: 0;
  }
  
  .lofi-modal-header {
    margin-bottom: 24px;
  }
  
  .lofi-modal-header h2 {
    font-size: 24px;
  }
  
  .lofi-modal-close {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .lofi-wallet-option {
    padding: 14px 16px;
    gap: 12px;
  }
  
  .lofi-wallet-icon {
    width: 44px;
    height: 44px;
  }
  
  .lofi-wallet-name {
    font-size: 16px;
  }
  
  .lofi-wallet-status {
    font-size: 13px;
  }
  
  .lofi-wallet-arrow {
    font-size: 20px;
  }
  
  .lofi-modal-actions {
    flex-direction: column;
  }
  
  .lofi-action-btn {
    width: 100%;
  }
}

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

/* Focus states for keyboard navigation */
.lofi-wallet-option:focus-visible,
.lofi-modal-close:focus-visible,
.lofi-action-btn:focus-visible {
  outline: 2px solid #00ff88;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lofi-modal-container {
    border-width: 2px;
  }
  
  .lofi-wallet-option {
    border-width: 2px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===============================================================================================
 * CUSTOM SCROLLBAR
 * ===============================================================================================
 */

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

.lofi-modal-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.lofi-modal-container::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 136, 0.3);
  border-radius: 4px;
  transition: background 0.3s ease;
}

.lofi-modal-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 136, 0.5);
}

/* Firefox scrollbar */
.lofi-modal-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 136, 0.3) rgba(255, 255, 255, 0.05);
}