/* 
   THEME: NEBULA TRADER
   STYLE: AVANT-GARDE MINIMALISM 
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Colors */
  --bg-dark: #050507;
  --bg-panel: #0E0E12;
  --bg-card: rgba(20, 20, 25, 0.6);
  --bg-overlay: rgba(5, 5, 7, 0.95);

  --accent-primary: #3B82F6;
  --accent-secondary: #8B5CF6;
  --accent-gradient: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);

  --text-main: #FFFFFF;
  --text-muted: #9494A0;
  --text-dim: #5E5E6A;

  --success: #10B981;
  --danger: #EF4444;
  /* Standard Red */
  --danger-glow: rgba(239, 68, 68, 0.4);
  --success-glow: rgba(16, 185, 129, 0.4);

  --border-light: rgba(255, 255, 255, 0.08);
  --glass-shine: rgba(255, 255, 255, 0.03);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Animations */
  --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-panel) transparent;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Cosmic Background Effect */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.08), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08), transparent 30%);
  pointer-events: none;
  z-index: -1;
  animation: bg-pulse 20s ease-in-out infinite alternate;
}

@keyframes bg-pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }

  100% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Typography */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.font-mono {
  font-family: 'Space Mono', monospace;
}

/* Layout Utilities */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-4 {
  gap: 1rem;
}

/* Components */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s var(--ease-smooth), border-color 0.3s;
}

/* Hover effects only on desktop */
@media (hover: hover) {
  .glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
  }
}

.btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s var(--ease-smooth);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  justify-content: center;
}

.btn-primary {
  background: var(--accent-gradient);
  border: none;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
  transform: scale(1.02);
}

.btn:active {
  transform: scale(0.98);
}

/* Header & Nav */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
  z-index: 100;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 32px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-main);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  font-size: 24px;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
}

/* Mobile Sidebar Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  z-index: 999;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  pointer-events: none;
}

.mobile-nav-overlay.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-link {
  font-size: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  text-decoration: none;
  display: block;
  animation: slideInRight 0.4s ease forwards;
  opacity: 0;
}

@keyframes slideInRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Crypto Ticker (Horizontal Scroll) */
.ticker-wrap {
  position: relative;
  overflow: hidden;
  height: 48px;
  background: var(--glass-shine);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}

.ticker {
  display: flex;
  animation: ticker 30s linear infinite;
  white-space: nowrap;
}

.ticker-item {
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.text-up {
  color: var(--success);
}

.text-down {
  color: var(--danger);
}

@keyframes ticker {
  0% {
    transform: translate3d(0, 0, 0);
  }

  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* Trading Interface */
.trade-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  grid-template-rows: auto 1fr;
  gap: 16px;
  height: calc(100vh - 140px);
}

.order-book,
.trade-history,
.chart-view,
.order-entry {
  padding: 16px;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  overflow-y: auto;
}

.order-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 4px;
  cursor: pointer;
}

.order-row:hover {
  background: var(--bg-panel);
}

.price-up {
  color: var(--success);
}

.price-down {
  color: var(--danger);
}

.bar {
  height: 100%;
  opacity: 0.15;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 0;
}

.order-row .price,
.order-row .amount {
  position: relative;
  z-index: 1;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-field {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 12px;
  border-radius: 8px;
  font-family: 'Space Mono', monospace;
  outline: none;
  transition: border-color 0.2s;
  font-size: 16px;
  /* Prevents zoom on iOS */
}

.input-field:focus {
  border-color: var(--accent-primary);
}

.buy-btn,
.sell-btn {
  width: 100%;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s;
}

.buy-btn {
  background: var(--success);
}

.sell-btn {
  background: var(--danger);
}

/* Table Stuff */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  white-space: nowrap;
  /* Prevent awkward wrapping in cells */
}

/* ----- MOBILE RESPONSIVE OVERRIDES ----- */
@media (max-width: 900px) {

  /* Navigation */
  .nav-links {
    display: none;
  }

  /* Hide desktop nav */
  .mobile-menu-btn {
    display: block;
  }

  /* Show burger */

  /* Layouts */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .container {
    padding: 0 16px;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
  }

  /* Force Hero Section vertical */
  .hero-section {
    flex-direction: column;
    text-align: center;
    padding-top: 20px;
  }

  .hero-text {
    width: 100%;
  }

  /* Glass Panels responsive */
  .glass-panel {
    transform: none !important;
    /* Remove 3D effect on mobile */
    min-width: 0 !important;
    /* Override inline fixed widths */
    width: 100% !important;
    margin-top: 16px;
  }

  /* Trade Page specifics */
  .trade-layout {
    grid-template-columns: 1fr;
    height: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
  }

  .chart-view {
    min-height: 350px;
    order: 1;
  }

  .order-entry {
    order: 2;
    min-height: auto;
  }

  .order-book {
    order: 3;
    max-height: 400px;
  }

  /* Derivatives Page specifics */
  .derivatives-layout {
    grid-template-columns: 1fr !important;
    /* Override inline grid */
    height: auto !important;
    gap: 24px !important;
  }

  /* Profile Sidebar */
  body:has(.profile-sidebar) .container>div {
    grid-template-columns: 1fr !important;
  }

  .profile-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .profile-nav-item {
    padding: 8px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    flex-shrink: 0;
  }

  /* Typography Adjustments */
  h1 {
    font-size: 32px !important;
  }

  .hero-text p {
    font-size: 15px !important;
  }

  /* Buttons */
  .btn {
    white-space: nowrap;
  }

  .wallet-actions {
    /* Flex container in wallet page */
    flex-direction: column;
  }

  .action-item {
    flex-direction: row;
    background: var(--bg-panel);
    padding: 12px;
    border-radius: 12px;
    width: 100%;
    gap: 16px;
  }

  .action-circle {
    margin-bottom: 0;
  }
}