/* ══════════════════════════════════════════════════════════════
   Aurora Shared Styles — Dark theme base for all Aurora Pathways dApps
   
   Load after any dApp-specific styles. These provide base
   components used by AuroraUI (ui.js) and general dApp layout.
   ══════════════════════════════════════════════════════════════ */

/* ── CSS Variables (match existing dapp theme) ─────────────── */
:root {
  --bg: #0a0a0f;
  --surface: #0f0f16;
  --surface2: #15151f;
  --text: #e8e8ed;
  --text2: #8a8a9a;
  --accent: #7c5cfc;
  --accent2: #4ec9b0;
  --accent3: #ff6b9d;
  --gradient: linear-gradient(135deg, #7c5cfc 0%, #4ec9b0 50%, #3b82f6 100%);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

/* ── Reset overrides for shared components ─────────────────── */
.aurora-toast-container *,
.aurora-confirm-overlay *,
.aurora-error-container *,
.aurora-network-banner * {
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.aurora-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.aurora-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.aurora-btn-primary {
  background: var(--gradient);
  color: #fff;
}

.aurora-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(124, 92, 252, 0.3);
}

.aurora-btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary */
.aurora-btn-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

.aurora-btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

/* Danger */
.aurora-btn-danger {
  background: rgba(255, 107, 157, 0.15);
  color: var(--accent3);
  border: 1px solid rgba(255, 107, 157, 0.25);
}

.aurora-btn-danger:hover:not(:disabled) {
  background: rgba(255, 107, 157, 0.25);
}

/* Ghost */
.aurora-btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid transparent;
}

.aurora-btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--glass);
  border-color: var(--glass-border);
}

/* Small variant */
.aurora-btn-sm {
  padding: 8px 18px;
  font-size: 0.82rem;
  border-radius: 100px;
}

/* Large variant */
.aurora-btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
  border-radius: 100px;
}

/* Loading state */
.aurora-btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

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

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

/* ══════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════ */
.aurora-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.aurora-card:hover {
  border-color: rgba(124, 92, 252, 0.2);
}

.aurora-card-interactive {
  cursor: pointer;
}

.aurora-card-interactive:hover {
  border-color: rgba(124, 92, 252, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   FORM INPUTS
   ══════════════════════════════════════════════════════════════ */
.aurora-input,
.aurora-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.aurora-input:focus,
.aurora-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
}

.aurora-input::placeholder,
.aurora-textarea::placeholder {
  color: var(--text2);
  opacity: 0.6;
}

.aurora-input:disabled,
.aurora-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aurora-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.aurora-input-error {
  border-color: var(--accent3) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1) !important;
}

/* ══════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════ */
.aurora-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.aurora-badge-success {
  background: rgba(78, 201, 176, 0.15);
  color: var(--accent2);
}

.aurora-badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.aurora-badge-warning {
  background: rgba(255, 180, 60, 0.15);
  color: #ffb43c;
}

.aurora-badge-danger {
  background: rgba(255, 107, 157, 0.15);
  color: var(--accent3);
}

.aurora-badge-neutral {
  background: var(--glass);
  color: var(--text2);
  border: 1px solid var(--glass-border);
}

/* ══════════════════════════════════════════════════════════════
   STATUS INDICATOR (connected dot)
   ══════════════════════════════════════════════════════════════ */
.aurora-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aurora-status-dot-inner {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.aurora-status-connected .aurora-status-dot-inner {
  background: var(--accent2);
  box-shadow: 0 0 8px rgba(78, 201, 176, 0.5);
  animation: aurora-pulse-dot 2s ease-in-out infinite;
}

.aurora-status-disconnected .aurora-status-dot-inner {
  background: var(--text2);
  opacity: 0.5;
}

@keyframes aurora-pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(78, 201, 176, 0.5); }
  50% { box-shadow: 0 0 16px rgba(78, 201, 176, 0.8); }
}

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.aurora-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
  width: 100%;
}

.aurora-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.45;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  word-break: break-word;
}

/* Color-coded left border per type */
.aurora-toast-info { border-left: 3px solid #3b82f6; }
.aurora-toast-success { border-left: 3px solid var(--accent2); }
.aurora-toast-error { border-left: 3px solid var(--accent3); }
.aurora-toast-warning { border-left: 3px solid #ffb43c; }

.aurora-toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.aurora-toast-hiding {
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 1, 1),
              opacity 0.2s ease;
}

.aurora-toast-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  margin-top: 1px;
}

.aurora-toast-msg {
  flex: 1;
  min-width: 0;
}

.aurora-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.aurora-toast-close:hover {
  opacity: 1;
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════════
   SKELETON LOADING (shimmer animation)
   ══════════════════════════════════════════════════════════════ */
.aurora-skeleton {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.aurora-skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%,
    transparent 100%
  );
  animation: aurora-shimmer 1.8s ease-in-out infinite;
}

/* Skeleton lines */
.aurora-skeleton-line {
  height: 14px;
  background: var(--surface2);
  border-radius: 6px;
  margin-bottom: 12px;
  width: 100%;
}

.aurora-skeleton-line:last-child {
  margin-bottom: 0;
}

.aurora-skeleton-line-short {
  width: 60%;
}

/* Circle skeleton (avatar placeholder) */
.aurora-skeleton-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
}

/* Rect skeleton (image placeholder) */
.aurora-skeleton-rect {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-sm);
  padding: 0;
}

@keyframes aurora-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(50%); }
}

/* ══════════════════════════════════════════════════════════════
   CONFIRM DIALOG OVERLAY
   ══════════════════════════════════════════════════════════════ */
.aurora-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 16px;
}

.aurora-confirm-visible {
  opacity: 1;
}

.aurora-confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.aurora-confirm-dialog-visible {
  transform: scale(1) translateY(0);
}

.aurora-confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.aurora-confirm-msg {
  font-size: 0.92rem;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 22px;
}

.aurora-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════════════
   ERROR DISPLAY
   ══════════════════════════════════════════════════════════════ */
.aurora-error-container {
  margin: 16px 0;
}

.aurora-error-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 107, 157, 0.08);
  border: 1px solid rgba(255, 107, 157, 0.2);
  border-radius: var(--radius-sm);
  position: relative;
}

.aurora-error-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.aurora-error-msg {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.aurora-error-retry {
  flex-shrink: 0;
  align-self: center;
}

.aurora-error-dismiss {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.aurora-error-dismiss:hover {
  opacity: 1;
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════════
   NETWORK WARNING BANNER
   ══════════════════════════════════════════════════════════════ */
.aurora-network-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 180, 60, 0.12);
  border-bottom: 1px solid rgba(255, 180, 60, 0.25);
  color: #ffb43c;
  font-size: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

.aurora-network-banner-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.aurora-network-banner-text {
  flex: 1;
  min-width: 200px;
  text-align: center;
}

.aurora-network-banner-text strong {
  color: #ffcc70;
}

.aurora-network-switch-btn {
  flex-shrink: 0;
}

.aurora-network-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #ffb43c;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.aurora-network-dismiss:hover {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════════════════════ */
.aurora-text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.aurora-mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.aurora-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aurora-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.aurora-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .aurora-toast-container {
    top: 8px;
    right: 8px;
    left: 8px;
    max-width: none;
  }

  .aurora-toast {
    font-size: 0.85rem;
    padding: 12px 14px;
  }

  .aurora-confirm-dialog {
    padding: 22px 18px;
    margin: 0 8px;
  }

  .aurora-confirm-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .aurora-confirm-actions .aurora-btn {
    width: 100%;
  }

  .aurora-network-banner {
    flex-direction: column;
    text-align: center;
    padding: 12px 16px;
    gap: 8px;
  }

  .aurora-network-banner-text {
    min-width: 0;
  }

  .aurora-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .aurora-card {
    padding: 18px;
  }

  .aurora-error-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .aurora-error-retry {
    align-self: stretch;
    text-align: center;
  }
}

/* ══════════════════════════════════════════════════════════════
   CHAIN SELECTOR (multichain.js)
   ══════════════════════════════════════════════════════════════ */
.aurora-chain-selector {
  position: relative;
  z-index: 100;
  font-family: var(--font, 'Inter', sans-serif);
}

.aurora-chain-current {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  transition: all var(--transition);
  user-select: none;
  white-space: nowrap;
  min-width: 120px;
}

.aurora-chain-current:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

.aurora-chain-current:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.aurora-chain-icon {
  font-size: 1rem;
  line-height: 1;
}

.aurora-chain-name {
  font-weight: 600;
}

.aurora-chain-arrow {
  font-size: 0.7rem;
  color: var(--text2);
  margin-left: auto;
  transition: transform 0.2s ease;
}

.aurora-chain-current[aria-expanded="true"] .aurora-chain-arrow {
  transform: rotate(180deg);
}

.aurora-chain-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 101;
  animation: aurora-chain-dropdown-in 0.15s ease;
}

@keyframes aurora-chain-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.aurora-chain-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--glass-border);
}

.aurora-chain-option:last-child {
  border-bottom: none;
}

.aurora-chain-option:hover {
  background: rgba(124, 92, 252, 0.08);
}

.aurora-chain-option.aurora-chain-active {
  background: rgba(124, 92, 252, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.aurora-chain-option.aurora-chain-not-deployed {
  opacity: 0.55;
}

.aurora-chain-option.aurora-chain-not-deployed:hover {
  opacity: 0.75;
}

.aurora-chain-option-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.aurora-chain-option-name {
  flex: 1;
}

.aurora-chain-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--glass);
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.aurora-chain-check {
  color: var(--accent2);
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .aurora-toast {
    border-radius: 8px;
  }

  .aurora-card {
    border-radius: var(--radius-sm);
  }

  .aurora-btn-sm {
    padding: 7px 14px;
    font-size: 0.78rem;
  }
}