/* ══════════════════════════════════════════════════════════════════
   AIFIM — AI Financial Intelligence Market
   Consumer-facing product catalog & purchase UI
   ══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables / Design Tokens ─────────────────────────────── */
:root {
  --bg-gradient-start: #0a0e27;
  --bg-gradient-mid: #1a1145;
  --bg-gradient-end: #0d1b3e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --surface-card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.65);
  --text-muted: rgba(240, 240, 245, 0.4);
  --accent-blue: #4f8cff;
  --accent-purple: #9b6dff;
  --accent-gradient: linear-gradient(135deg, #4f8cff 0%, #9b6dff 50%, #e06dff 100%);
  --accent-gradient-hover: linear-gradient(135deg, #6da0ff 0%, #b080ff 50%, #ea80ff 100%);
  --success: #00d68f;
  --warning: #ffaa00;
  --danger: #ff4d6a;
  --card-blur: 20px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-glow: 0 0 40px rgba(79, 140, 255, 0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-gradient-start);
}

/* ── Animated Gradient Background ──────────────────────────────── */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    135deg,
    var(--bg-gradient-start) 0%,
    var(--bg-gradient-mid) 35%,
    #1e0e45 55%,
    var(--bg-gradient-end) 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

/* Floating orbs for depth */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  z-index: -1;
  animation: orbFloat 15s ease-in-out infinite;
}

.bg-orb--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4f8cff 0%, transparent 70%);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.bg-orb--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #9b6dff 0%, transparent 70%);
  bottom: -50px;
  left: -50px;
  animation-delay: -5s;
}

.bg-orb--3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #e06dff 0%, transparent 70%);
  top: 40%;
  left: 50%;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ── Header / Navbar ───────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: rgba(10, 14, 39, 0.7);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.navbar__logo {
  font-size: 1.5rem;
  line-height: 1;
}

.navbar__title {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar__subtitle {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.navbar__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 214, 143, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(0, 214, 143, 0); }
}

/* ── Hero Section ──────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 2rem 3rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-weight: 500;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.6s ease-out;
}

.hero__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.hero__title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero__title-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero__stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.hero__stat {
  text-align: center;
}

.hero__stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

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

/* ── Product Cards Section ─────────────────────────────────────── */
.products {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
}

.products__heading {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 2.5rem;
}

.products__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

/* ── Individual Product Card ───────────────────────────────────── */
.product-card {
  position: relative;
  background: var(--surface-card);
  backdrop-filter: blur(var(--card-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--card-blur)) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out both;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }

.product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, transparent 30%, rgba(79,140,255,0.2) 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: var(--transition);
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.product-card:hover::before {
  opacity: 1;
}

/* Featured card (pro) */
.product-card--featured {
  border-color: rgba(155, 109, 255, 0.25);
  background: rgba(155, 109, 255, 0.06);
}

.product-card--featured::after {
  content: 'MOST POPULAR';
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.6rem;
  border-radius: 100px;
  background: var(--accent-gradient);
  color: white;
}

.product-card__icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.product-card__name {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.product-card__name-ko {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.product-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex-grow: 0;
}

.product-card__features {
  list-style: none;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.product-card__features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
}

.product-card__features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  font-size: 0.75rem;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 214, 143, 0.1);
  flex-shrink: 0;
}

.product-card__divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 1.5rem;
}

.product-card__price-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.product-card__price {
  font-size: 2rem;
  font-weight: 800;
}

.product-card__currency {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.product-card__chain {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Quantity Selector ─────────────────────────────────────────── */
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.quantity-selector__label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.quantity-selector__controls {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.quantity-selector__btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.quantity-selector__btn:hover {
  background: var(--surface-hover);
}

.quantity-selector__btn:active {
  transform: scale(0.92);
}

.quantity-selector__value {
  width: 40px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0.4rem 0;
}

.quantity-selector__total {
  font-size: 0.8rem;
  color: var(--accent-blue);
  font-weight: 600;
  margin-left: auto;
}

/* ── Purchase Button ───────────────────────────────────────────── */
.btn-purchase {
  width: 100%;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  background: var(--accent-gradient);
  color: white;
  letter-spacing: 0.02em;
}

.btn-purchase::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient-hover);
  opacity: 0;
  transition: var(--transition);
}

.btn-purchase:hover::before {
  opacity: 1;
}

.btn-purchase:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.3);
}

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

.btn-purchase span {
  position: relative;
  z-index: 1;
}

.btn-purchase--secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-purchase--secondary::before {
  background: var(--surface-hover);
}

.btn-purchase--secondary:hover {
  border-color: var(--border-hover);
  box-shadow: none;
}

/* ── Modal / Overlay ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay--active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: linear-gradient(145deg, rgba(26, 17, 69, 0.95), rgba(13, 27, 62, 0.95));
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  padding: 2.5rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05);
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
}

.modal-overlay--active .modal {
  transform: translateY(0) scale(1);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal__title {
  font-size: 1.4rem;
  font-weight: 700;
}

.modal__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal__close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.modal__product-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.modal__product-icon {
  font-size: 2rem;
  line-height: 1;
}

.modal__product-name {
  font-size: 1rem;
  font-weight: 600;
}

.modal__product-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.modal__section {
  margin-bottom: 1.25rem;
}

.modal__section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.modal__summary {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.modal__summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.modal__summary-row--total {
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
}

.modal__summary-label {
  color: var(--text-secondary);
}

.modal__summary-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Wallet Connection ─────────────────────────────────────────── */
.wallet-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.wallet-status__icon {
  font-size: 1.2rem;
}

.wallet-status__info {
  flex: 1;
}

.wallet-status__label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.wallet-status__address {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
  font-family: 'Courier New', monospace;
}

.wallet-status__address--disconnected {
  color: var(--warning);
}

/* ── Transaction States ────────────────────────────────────────── */
.tx-status {
  text-align: center;
  padding: 2rem;
}

.tx-status__spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

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

.tx-status__title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.tx-status__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.tx-status__icon-success {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.tx-status__hash {
  display: inline-block;
  font-size: 0.75rem;
  font-family: 'Courier New', monospace;
  color: var(--accent-blue);
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: var(--transition-fast);
  word-break: break-all;
}

.tx-status__hash:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-blue);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Toast / Notification ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(26, 17, 69, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateX(120%);
  animation: toastIn 0.3s ease-out forwards;
  max-width: 360px;
}

.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--accent-blue); }

@keyframes toastIn {
  to { transform: translateX(0); }
}

.toast--exit {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0.8rem 1rem; }
  .hero { padding: 3rem 1.5rem 2rem; }
  .hero__stats { flex-wrap: wrap; gap: 1.5rem; }
  .products { padding: 1.5rem 1rem 4rem; }
  .products__grid { grid-template-columns: 1fr; }
  .modal { padding: 1.75rem; border-radius: var(--radius-lg); }
}

@media (max-width: 480px) {
  .hero__title { font-size: 1.75rem; }
  .hero__desc { font-size: 0.95rem; }
  .navbar__subtitle { display: none; }
}
