/* NEXUS Commerce - Modern Futuristic Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg-dark: #090D16;
  --bg-surface: rgba(17, 24, 39, 0.75);
  --bg-surface-elevated: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(124, 58, 237, 0.4);
  
  --primary-purple: #7C3AED;
  --primary-purple-hover: #9333EA;
  --gradient-cyber: linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);
  --gradient-gold: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  --gradient-surface: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.8) 100%);
  
  --teal-accent: #06B6D4;
  --gold-accent: #F59E0B;
  --emerald-accent: #10B981;
  --rose-accent: #F43F5E;
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-glow: 0 0 25px rgba(124, 58, 237, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.12) 0%, transparent 40%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-purple);
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  transition: var(--transition-smooth);
}
.glass-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

/* Header & Nav */
.nexus-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #FFF;
  text-decoration: none;
}

.brand-badge {
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient-cyber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
}

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

.role-selector {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  border-radius: 30px;
  border: 1px solid var(--border-glass);
}

.role-btn {
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.role-btn.active {
  background: var(--primary-purple);
  color: #FFF;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.4);
}

.search-trigger-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  padding: 0.5rem 1.2rem;
  border-radius: 30px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 280px;
}
.search-trigger-bar:hover {
  border-color: var(--primary-purple);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--teal-accent);
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--rose-accent);
  color: #FFF;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* User Level Badge */
.user-tier-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  color: var(--gold-accent);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Discovery Feed Hero */
.feed-hero {
  padding: 3rem 2rem 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-banner {
  background: var(--gradient-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-title span {
  background: var(--gradient-cyber);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.hero-cta-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--gradient-cyber);
  color: #FFF;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-glow);
  transition: var(--transition-smooth);
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.8rem 1.6rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}
.btn-glass:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Category Pills Bar */
.category-tab-bar {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 1rem 0;
  margin-top: 1.5rem;
}
.category-tab-bar::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  padding: 0.5rem 1.25rem;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.cat-pill.active, .cat-pill:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary-purple);
  color: var(--text-main);
}

/* Product Card Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem 2rem 4rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-thumb-wrap {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0.6rem;
}

.product-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.product-card:hover .product-thumb {
  transform: scale(1.08);
}

.trust-badge-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-accent);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.groupbuy-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(245, 158, 11, 0.9);
  color: #000;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.product-details {
  padding: 0.85rem 1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-ai-reason {
  font-size: 0.78rem;
  color: var(--teal-accent);
  background: rgba(6, 182, 212, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  border-left: 2px solid var(--teal-accent);
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: auto;
}

.current-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.original-price {
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-decoration: line-through;
}

.card-action-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.btn-card-primary {
  flex-grow: 1;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid var(--primary-purple);
  color: #FFF;
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-card-primary:hover {
  background: var(--primary-purple);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content-container {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-card);
  padding: 2rem;
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #FFF;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  z-index: 1000;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}
.modal-close-btn:hover {
  background: #EF4444;
  color: #FFF;
  transform: scale(1.15) rotate(90deg);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.9);
}

/* 360 Viewer */
.viewer-360-container {
  position: relative;
  width: 100%;
  height: 340px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-glass);
}
.viewer-360-img {
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}
.rotator-pill {
  position: absolute;
  bottom: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-glass);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--teal-accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Trust Score Breakdown Gauge */
.trust-score-wrapper {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
}
.trust-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.trust-score-num {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--emerald-accent);
  font-family: 'Outfit', sans-serif;
}
.trust-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.trust-bar-fill {
  height: 100%;
  background: var(--emerald-accent);
  border-radius: 4px;
}

/* Live Stream Viewer */
.live-stream-box {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}
.live-video-sim {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}
.live-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background: var(--rose-accent);
  color: #FFF;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

.live-pinned-deal {
  position: absolute;
  bottom: 15px;
  left: 15px;
  right: 15px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Gamification & Quests */
.quest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 0.75rem;
}

/* Scratch Box */
.scratch-box {
  background: var(--gradient-cyber);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.scratch-box:hover {
  transform: scale(1.02);
}

/* Timeline visualizer */
.timeline-stepper {
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  position: relative;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  z-index: 1;
}
.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.4rem;
}
.timeline-step.completed .step-circle {
  background: var(--emerald-accent);
  border-color: var(--emerald-accent);
  color: #000;
}
.timeline-step.active .step-circle {
  border-color: var(--primary-purple);
  box-shadow: 0 0 15px var(--primary-purple);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--teal-accent);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  color: #FFF;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Floating Red Exit Button (ปุ่มปิด/ย้อนกลับสีแดง) */
.floating-exit-btn {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.18);
  border: 2px solid #F43F5E;
  color: #F43F5E;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 9999;
  text-decoration: none;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(244, 63, 94, 0.4);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.floating-exit-btn:hover {
  background: #F43F5E;
  color: #FFF;
  transform: scale(1.12) rotate(90deg);
  box-shadow: 0 6px 25px rgba(244, 63, 94, 0.7);
}

