* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0a0e1a 100%);
  color: #ffffff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: white;
}

.logo img {
  width: 80px;
  height: 80px;
  border-radius: 16px;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 1.1rem;
  color: #a0aec0;
  margin-bottom: 32px;
  font-weight: 400;
}

/* Network Badge */
.supported-networks {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.network-icon {
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
}

/* Wallet Connection */
.wallet-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.wallet-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.wallet-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
}

.wallet-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.wallet-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
  color: white;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.farcaster-info {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #ffc107;
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
  text-align: center;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.add-to-collection-btn {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.4);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.add-to-collection-btn:hover {
  background: rgba(255, 193, 7, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.add-to-collection-btn:disabled {
  background: rgba(255, 193, 7, 0.1);
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

/* Farcaster Mini App specific styles */
.farcaster-mode #walletButtonContainer {
  display: none !important;
}

.farcaster-mode #shareButtonContainer {
  display: flex !important;
  justify-content: center;
}

.farcaster-mode #shareXBtn {
  display: none !important;
}

.farcaster-mode #shareFarcasterBtn {
  display: flex !important;
}

.farcaster-mode .header {
  padding-top: 60px;
}

.farcaster-mode .container {
  max-width: 100%;
  padding: 0 16px;
}

.farcaster-mode .main-form {
  margin-top: 20px;
}

.farcaster-mode .recipients-section {
  margin-top: 20px;
}

.farcaster-mode .csv-section {
  margin-top: 30px;
}

/* Prevent content reflow */
.farcaster-mode * {
  box-sizing: border-box;
}

/* Optimize for mobile touch */
.farcaster-mode button {
  min-height: 44px;
  touch-action: manipulation;
}

.farcaster-mode input {
  min-height: 44px;
  touch-action: manipulation;
}

/* Fix logo positioning in Farcaster Mini App */
.farcaster-mode .logo {
  position: relative;
  z-index: 10;
  margin-bottom: 20px;
}

.farcaster-mode .logo img {
  max-width: 120px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Ensure header content doesn't overlap */
.farcaster-mode .header h1 {
  margin-top: 10px;
  margin-bottom: 10px;
}

.farcaster-mode .header p {
  margin-bottom: 20px;
}

/* Main Form */
.main-form {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.form-select, .form-input {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #ffffff !important;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  opacity: 1;
}

.form-input:focus::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

/* Mobile browser autocomplete/autofill override */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
  transition: background-color 5000s ease-in-out 0s;
  -webkit-text-fill-color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1) !important;
  box-shadow: inset 0 0 20px 20px rgba(255, 255, 255, 0.1) !important;
}

/* Firefox autofill override */
.form-input:-moz-autofill {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* Selection color override */
.form-input::selection {
  background: rgba(102, 126, 234, 0.3);
  color: #ffffff;
}

.form-input::-moz-selection {
  background: rgba(102, 126, 234, 0.3);
  color: #ffffff;
}

.form-select option {
  background: #1a1f2e;
  color: #ffffff;
}

/* Recipients Section */
.recipients-section {
  margin: 32px 0;
}

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

.recipients-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e2e8f0;
}

.recipients-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* Recipient Rows */
.recipient-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  margin-bottom: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  transition: all 0.3s ease;
  align-items: center;
}

.recipient-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.recipient-row .form-input {
  margin: 0;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Extra enforcement for recipient inputs */
.recipient-row .form-input:focus,
.recipient-row .form-input:active,
.recipient-row .form-input:-webkit-autofill {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: inset 0 0 20px 20px rgba(255, 255, 255, 0.15) !important;
}

.recipient-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipient-action-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  backdrop-filter: blur(10px);
}

.add-recipient-btn {
  background: rgba(72, 187, 120, 0.2);
  border: 1px solid rgba(72, 187, 120, 0.3);
  color: #48bb78;
}

.add-recipient-btn:hover {
  background: rgba(72, 187, 120, 0.3);
  transform: translateY(-1px);
}

.remove-recipient-btn {
  background: rgba(245, 101, 101, 0.2);
  border: 1px solid rgba(245, 101, 101, 0.3);
  color: #f56565;
}

.remove-recipient-btn:hover {
  background: rgba(245, 101, 101, 0.3);
  transform: translateY(-1px);
}

.remove-recipient-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Token Info */
.token-info {
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  color: #667eea;
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
  text-align: center;
  backdrop-filter: blur(10px);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* Status */
.status {
  text-align: center;
  margin: 24px 0;
  padding: 16px;
  border-radius: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.status.success {
  background: rgba(72, 187, 120, 0.1);
  border: 1px solid rgba(72, 187, 120, 0.3);
  color: #48bb78;
}

.status.error {
  background: rgba(245, 101, 101, 0.1);
  border: 1px solid rgba(245, 101, 101, 0.3);
  color: #f56565;
}

.status.info {
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.3);
  color: #667eea;
}

/* CSV Import Section */
.csv-section {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.csv-section h3 {
  color: #e2e8f0;
  margin-bottom: 16px;
  font-size: 1.2rem;
  font-weight: 600;
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-bottom: 16px;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.file-input-label:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Loading */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1b69 50%, #1a1a1a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 300px;
}

.loading-logo {
  margin-bottom: 24px;
}

.loading-logo img {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading h3 {
  color: #ffffff;
  margin-bottom: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.loading p {
  color: #e2e8f0;
  font-size: 1.1rem;
  margin-bottom: 16px;
  font-weight: 500;
}

.loading-subtitle {
  color: #a0aec0;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .main-form {
    padding: 24px 20px;
  }

  .recipient-row {
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
  }

  .wallet-selector {
    flex-direction: column;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .recipients-header {
    flex-direction: column;
    align-items: stretch;
  }

  .recipients-actions {
    justify-content: center;
  }

  h1 {
    font-size: 2rem;
  }

  .logo {
    width: 100px;
    height: 100px;
  }
}

@media (max-width: 480px) {
  .main-form {
    padding: 20px 16px;
  }

  .form-input, .form-select {
    padding: 14px;
    font-size: 16px; /* Prevents zoom on iOS */
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
  }
  
  /* Mobile specific input overrides */
  .form-input:focus,
  .form-input:active,
  .form-input:-webkit-autofill,
  .form-input:-webkit-autofill:hover,
  .form-input:-webkit-autofill:focus,
  .form-input:-webkit-autofill:active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: inset 0 0 20px 20px rgba(255, 255, 255, 0.15) !important;
  }
  
  /* Recipient row mobile fixes */
  .recipient-row .form-input {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
  }
  
  .recipient-row .form-input:focus,
  .recipient-row .form-input:active,
  .recipient-row .form-input:-webkit-autofill {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: inset 0 0 20px 20px rgba(255, 255, 255, 0.15) !important;
  }

  .btn {
    padding: 14px 20px;
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

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

.slide-up {
  animation: slideUp 0.4s ease-out;
}

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

/* RainbowKit Style Button */
#rainbowkitConnectBtn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(102, 126, 234, 0.7);
  background: linear-gradient(135deg, #7c8bfa 0%, #8a5fb8 100%);
}

#rainbowkitConnectBtn:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Make sure button is always visible */
#rainbowkitConnectBtn {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 9999 !important;
}
