/* Elata Biosciences - Card-Based Authentication Flow
   Viewport-locked cards with glassmorphism and Elata branding
*/

:root {
  /* Elata Official Brand Colors */
  --cream-off: #F8F5EE;
  --cream-1: #F3EEE2;
  --cream-2: #E5E0D3;
  --elata-green: #607274;
  --white: #FDFDFD;
  --off-white: #F7F7F7;
  --gray-1: #DDDDDD;
  --gray-2: #CCCCCC;
  --gray-3: #6D6D6D;
  --off-black: #171717;
  --black: #0A0A0A;
  --accent-red: #FF797B;

  /* Derived tokens */
  --bg: var(--cream-off);
  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --text: var(--off-black);
  --text-secondary: var(--gray-3);
  --muted: #9ba1a5;
  --primary: var(--elata-green);
  --primary-hover: #708789;
  --primary-dark: #4f5c5e;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --error: var(--accent-red);
  --error-bg: rgba(255, 121, 123, 0.1);
  --discord-blue: #5865F2;
  --discord-hover: #4752C4;

  --radius: 24px;
  --radius-sm: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.12);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(0, 0, 0, 0.12);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --backdrop-blur: blur(20px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Neural pattern background */
.neural-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(96, 114, 116, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(96, 114, 116, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgba(96, 114, 116, 0.02) 0%, transparent 70%),
    var(--bg);
  z-index: -1;
}

/* ==========================================
   CARD CONTAINER - Viewport Locked
   ========================================== */
.card-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

/* ==========================================
   AUTHENTICATION CARD - Glassmorphism
   ========================================== */
.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  position: absolute;
}

.auth-card.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.auth-card.exit-left {
  opacity: 0;
  transform: translateX(-100px) scale(0.95);
}

.auth-card.exit-right {
  opacity: 0;
  transform: translateX(100px) scale(0.95);
}

/* Card Header */
.card-logo {
  width: 120px;
  height: auto;
  margin-bottom: 24px;
}

.card-icon {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}

.card-title {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
  letter-spacing: -0.5px;
}

.card-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 32px 0;
  line-height: 1.5;
}

/* Card Step Indicator */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-1);
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--primary);
  width: 24px;
  border-radius: 4px;
}

.step-dot.completed {
  background: var(--success);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(96, 114, 116, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(96, 114, 116, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(96, 114, 116, 0.2);
}

.btn-discord {
  background: var(--discord-blue);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.25);
}

.btn-discord:hover {
  background: var(--discord-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.35);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--off-white);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--error);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #e56365;
}

.btn-lg {
  padding: 18px 36px;
  font-size: 17px;
}

.btn-icon {
  font-size: 20px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Skip Link */
.skip-link {
  display: block;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.skip-link:hover {
  color: var(--text-secondary);
}

/* ==========================================
   CONNECTED STATE / SUCCESS CARD
   ========================================== */
.success-icon {
  width: 80px;
  height: 80px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px auto;
  font-size: 40px;
  animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Connection Info Display */
.connection-info {
  background: var(--off-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}

.connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

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

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

.connection-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.connection-value.truncated {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status-badge.connected {
  background: var(--success-bg);
  color: var(--success);
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

/* ==========================================
   TRASH / UNLINK BUTTON
   ========================================== */
.unlink-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.unlink-btn:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.unlink-btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================
   WALLET TYPE BADGES
   ========================================== */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--off-white);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
}

.wallet-badge-icon {
  width: 20px;
  height: 20px;
}

/* ==========================================
   LOADING STATES
   ========================================== */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================
   STATUS MESSAGE
   ========================================== */
.status-message {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.status-message.visible {
  opacity: 1;
  pointer-events: auto;
}

.status-message.success {
  border-color: var(--success);
  color: var(--success);
}

.status-message.error {
  border-color: var(--error);
  color: var(--error);
}

.status-message.warning {
  border-color: #f59e0b;
  color: #92400e;
}

/* Hide the floating toast - we use inline status now */
.status-message {
  display: none !important;
}

/* ==========================================
   INLINE STATUS (replaces floating toast)
   ========================================== */
.inline-status {
  min-height: 20px;
  margin-top: 16px;
  padding: 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
  transition: all 0.3s ease;
}

.inline-status:empty {
  min-height: 0;
  margin-top: 0;
}

.inline-status.visible {
  padding: 10px 16px;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.inline-status.success {
  color: var(--success);
  background: var(--success-bg);
  border-color: rgba(34, 197, 94, 0.2);
}

.inline-status.error {
  color: var(--error);
  background: var(--error-bg);
  border-color: rgba(255, 121, 123, 0.2);
}

.inline-status.info {
  color: var(--primary);
  background: rgba(96, 114, 116, 0.08);
  border-color: rgba(96, 114, 116, 0.2);
}

.inline-status.warning {
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.2);
}

/* ==========================================
   HELP TEXT & LINKS
   ========================================== */
.help-text {
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.5;
}

.help-text strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.help-link {
  color: var(--primary);
  text-decoration: none;
}

.help-link:hover {
  text-decoration: underline;
}

/* ==========================================
   FEATURE LIST (Benefits)
   ========================================== */
.feature-list {
  text-align: left;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.feature-item:last-child {
  border-bottom: none;
}

.feature-icon {
  width: 24px;
  height: 24px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--success);
  font-size: 14px;
}

.feature-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.feature-text strong {
  font-weight: 600;
}

/* ==========================================
   TOKEN REQUIREMENTS (Optional Panel)
   ========================================== */
.requirements-panel {
  background: var(--off-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}

.requirements-title {
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.requirements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.requirement-item {
  background: var(--panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
}

.requirement-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.requirement-amount {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================
   MOBILE RESPONSIVENESS
   ========================================== */

/* Tablet and small desktop */
@media (max-width: 768px) {
  .card-container {
    padding: 20px;
  }

  .auth-card {
    padding: 40px 32px;
  }

  .card-logo {
    width: 100px;
    margin-bottom: 20px;
  }

  .nav-footer {
    padding: 12px 20px;
  }
}

/* Mobile devices */
@media (max-width: 640px) {
  .card-container {
    padding: 10px;
    padding-bottom: 85px; /* More space for nav footer */
  }

  .auth-card {
    padding: 24px 18px;
    max-width: 100%;
    border-radius: 18px;
  }

  .card-logo {
    width: 70px;
    margin-bottom: 12px;
  }

  .step-indicator {
    margin-bottom: 16px;
  }

  .card-title {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .card-subtitle {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .btn {
    padding: 14px 20px;
    font-size: 15px;
  }

  .btn-lg {
    padding: 14px 24px;
    font-size: 15px;
  }

  .btn-icon {
    font-size: 18px;
  }

  .connection-info {
    padding: 14px;
    margin: 16px 0;
  }

  .connection-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 0;
  }

  .connection-value.truncated {
    max-width: 160px;
    font-size: 14px;
  }

  .success-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
    margin-bottom: 16px;
  }

  .feature-list {
    margin: 16px 0;
  }

  .feature-item {
    padding: 10px 0;
    gap: 10px;
  }

  .feature-text {
    font-size: 13px;
  }

  .feature-icon {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .help-text {
    font-size: 12px;
    margin-top: 12px;
  }

  .skip-link {
    font-size: 13px;
    margin-top: 14px;
  }

  .requirements-grid {
    grid-template-columns: 1fr;
  }

  .status-message {
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
    top: 16px;
  }

  .nav-footer {
    padding: 10px 16px;
    gap: 16px;
  }

  .nav-link {
    font-size: 12px;
  }
}

/* Small mobile devices (wallet in-app browsers) */
@media (max-width: 480px) {
  .card-container {
    padding: 8px;
    padding-bottom: 80px;
  }

  .auth-card {
    padding: 20px 14px;
    border-radius: 14px;
  }

  .card-logo {
    width: 60px;
    margin-bottom: 10px;
  }

  .step-indicator {
    margin-bottom: 12px;
    gap: 5px;
  }

  .step-dot {
    width: 6px;
    height: 6px;
  }

  .step-dot.active {
    width: 20px;
  }

  .card-title {
    font-size: 20px;
  }

  .card-subtitle {
    font-size: 13px;
    margin-bottom: 20px;
  }

  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
  }

  .connection-info {
    padding: 12px;
  }

  .connection-label {
    font-size: 11px;
  }

  .connection-value {
    font-size: 13px;
  }

  .status-badge {
    padding: 4px 10px;
    font-size: 12px;
  }

  .unlink-btn {
    width: 36px;
    height: 36px;
  }

  .unlink-btn svg {
    width: 16px;
    height: 16px;
  }

  .nav-footer {
    padding: 8px 12px;
  }
}

/* Very small screens / wallet browsers with limited viewport */
@media (max-width: 380px) {
  .card-container {
    padding: 6px;
    padding-bottom: 75px;
  }

  .auth-card {
    padding: 16px 12px;
    border-radius: 12px;
  }

  .card-logo {
    width: 50px;
    margin-bottom: 8px;
  }

  .card-title {
    font-size: 17px;
  }

  .card-subtitle {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 13px;
    gap: 8px;
  }

  .btn-icon {
    font-size: 16px;
  }

  .feature-item {
    padding: 8px 0;
  }

  .feature-text {
    font-size: 12px;
  }

  .help-text {
    font-size: 11px;
  }

  .connection-info {
    padding: 10px;
    margin: 12px 0;
  }

  .connection-row {
    padding: 8px 0;
  }

  .success-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
    margin-bottom: 12px;
  }
}

/* Viewport height handling for small screens */
@media (max-height: 700px) {
  .auth-card {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .card-logo {
    width: 70px;
    margin-bottom: 12px;
  }

  .step-indicator {
    margin-bottom: 16px;
  }

  .card-subtitle {
    margin-bottom: 20px;
  }

  .success-icon {
    width: 60px;
    height: 60px;
    font-size: 30px;
    margin-bottom: 16px;
  }

  .feature-list {
    margin: 16px 0;
  }

  .connection-info {
    margin: 16px 0;
  }
}

@media (max-height: 600px) {
  .card-logo {
    width: 60px;
    margin-bottom: 10px;
  }

  .step-indicator {
    margin-bottom: 12px;
  }

  .card-title {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .card-subtitle {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .success-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
    margin-bottom: 12px;
  }

  .feature-item {
    padding: 6px 0;
  }

  .btn {
    padding: 10px 16px;
  }
}

/* ==========================================
   HIDDEN UTILITY
   ========================================== */
.hidden {
  display: none !important;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.4s ease-out forwards;
}

/* ==========================================
   NAVIGATION (Footer Links)
   ========================================== */
.nav-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  gap: 24px;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
  z-index: 100;
}

.nav-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-secondary);
}

/* ==========================================
   WALLETCONNECT QR MODAL (Keep existing)
   ========================================== */
.wc-qr {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
}

.wc-qr.hidden {
  display: none !important;
}

.wc-qr-inner {
  width: 100%;
  max-width: 420px;
  background: var(--panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

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

.wc-qr-title {
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 18px;
}

.wc-qr-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.wc-qr-code {
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 240px;
}

.wc-qr-uri {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.wc-qr-uri input {
  flex: 1;
  background: var(--off-white);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.wc-qr-copy {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.wc-qr-hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.wc-qr-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.wc-retry-btn {
  background: var(--off-white);
  color: var(--text);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}
