/* ============================================
   Premium Theme Styles for Crypto Platform
   ============================================ */

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

/* Custom font declarations for premium typography */
@font-face {
  font-family: 'Cabinet Grotesk';
  src: url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
  font-display: swap;
}

/* ============================================
   Root Variables & Theme Configuration
   ============================================ */
:root {
  /* Semantic color tokens */
  --color-background: theme('colors.canvas.50');
  --color-surface: theme('colors.white');
  --color-surface-elevated: theme('colors.canvas.100');
  --color-border: theme('colors.stone.200');
  --color-border-subtle: theme('colors.stone.100');

  /* Text colors with hierarchy */
  --color-text-primary: theme('colors.stone.900');
  --color-text-secondary: theme('colors.stone.600');
  --color-text-tertiary: theme('colors.stone.500');
  --color-text-muted: theme('colors.stone.400');

  /* Interaction states */
  --color-hover: theme('colors.primary.50');
  --color-active: theme('colors.primary.100');
  --color-focus: theme('colors.primary.500');

  /* Semantic status colors */
  --color-success: theme('colors.sage.500');
  --color-warning: theme('colors.amber.500');
  --color-error: theme('colors.coral.500');
  --color-info: theme('colors.primary.500');

  /* Spacing rhythm */
  --spacing-unit: 0.25rem;

  /* Transition timing */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Border widths */
  --border-width: 1px;
  --border-width-thick: 2px;

  /* Z-index scale */
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-overlay: 1200;
  --z-modal: 1300;
  --z-popover: 1400;
  --z-tooltip: 1500;
}

/* ============================================
   Global Styles & Resets
   ============================================ */
* {
  box-sizing: border-box;
  border-color: var(--color-border);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  font-feature-settings:
    'kern' 1,
    'liga' 1,
    'calt' 1;
}

body {
  min-height: 100vh;
  background: var(--color-background);
  color: var(--color-text-primary);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Subtle noise texture overlay for depth */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.03' /%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

/* ============================================
   Typography Enhancements
   ============================================ */
.text-display {
  font-family: theme('fontFamily.display');
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.text-balance {
  text-wrap: balance;
}

.text-gradient {
  background: linear-gradient(
    135deg,
    theme('colors.primary.600') 0%,
    theme('colors.accent.lavender') 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-crypto-price {
  font-family: theme('fontFamily.mono');
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ============================================
   Glass Morphism Components
   ============================================ */
.glass-surface {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.glass-surface-dark {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ============================================
   Card Components
   ============================================ */
.card-elevated {
  @apply bg-white rounded-2xl;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.03),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 8px 16px -4px rgba(0, 0, 0, 0.08),
    0 24px 48px -12px rgba(0, 0, 0, 0.12);
  transition: all var(--transition-base);
}

.card-elevated:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.03),
    0 4px 8px rgba(0, 0, 0, 0.04),
    0 16px 24px -8px rgba(0, 0, 0, 0.1),
    0 32px 64px -16px rgba(0, 0, 0, 0.14);
}

.card-interactive {
  @apply bg-white rounded-xl p-6;
  border: 1px solid theme('colors.stone.200');
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card-interactive::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    theme('colors.primary.500') 0%,
    theme('colors.accent.lavender') 50%,
    theme('colors.accent.sky') 100%
  );
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.card-interactive:hover {
  border-color: theme('colors.primary.200');
  background: theme('colors.primary.50');
}

.card-interactive:hover::before {
  transform: scaleX(1);
}

/* ============================================
   Button Styles
   ============================================ */
.btn-premium {
  @apply relative inline-flex items-center justify-center px-6 py-3 rounded-xl font-medium;
  background: linear-gradient(
    135deg,
    theme('colors.primary.500') 0%,
    theme('colors.primary.600') 100%
  );
  color: white;
  box-shadow:
    0 2px 4px rgba(91, 155, 243, 0.24),
    0 8px 16px -4px rgba(91, 155, 243, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: all var(--transition-base);
  overflow: hidden;
}

.btn-premium::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-premium:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 8px rgba(91, 155, 243, 0.32),
    0 12px 24px -8px rgba(91, 155, 243, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn-premium:hover::before {
  transform: translateX(100%);
}

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

.btn-glass {
  @apply relative inline-flex items-center justify-center px-6 py-3 rounded-xl font-medium;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: theme('colors.stone.700');
  transition: all var(--transition-base);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-outline {
  @apply relative inline-flex items-center justify-center px-6 py-3 rounded-xl font-medium;
  background: transparent;
  border: 1.5px solid theme('colors.stone.300');
  color: theme('colors.stone.700');
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn-outline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: theme('colors.primary.50');
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.btn-outline:hover {
  border-color: theme('colors.primary.500');
  color: theme('colors.primary.600');
}

.btn-outline:hover::before {
  width: 300px;
  height: 300px;
}

/* ============================================
   Input & Form Styles
   ============================================ */
.input-elevated {
  @apply w-full px-4 py-3 rounded-xl;
  background: white;
  border: 1px solid theme('colors.stone.200');
  color: theme('colors.stone.900');
  font-size: theme('fontSize.base');
  transition: all var(--transition-fast);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.input-elevated:focus {
  outline: none;
  border-color: theme('colors.primary.500');
  box-shadow:
    0 0 0 3px theme('colors.primary.50'),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

.input-elevated::placeholder {
  color: theme('colors.stone.400');
}

/* ============================================
   Navigation Components
   ============================================ */
.nav-item-premium {
  @apply relative flex items-center px-4 py-2.5 rounded-xl;
  color: theme('colors.stone.600');
  transition: all var(--transition-fast);
  font-weight: 500;
}

.nav-item-premium:hover {
  color: theme('colors.stone.900');
  background: theme('colors.stone.50');
}

.nav-item-premium.active {
  color: theme('colors.primary.600');
  background: theme('colors.primary.50');
}

.nav-item-premium.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: theme('colors.primary.500');
  border-radius: 0 3px 3px 0;
}

/* ============================================
   Badge & Status Components
   ============================================ */
.badge-premium {
  @apply inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-semibold;
  background: linear-gradient(
    135deg,
    theme('colors.primary.50') 0%,
    theme('colors.accent.lavender/10') 100%
  );
  color: theme('colors.primary.700');
  border: 1px solid theme('colors.primary.200');
}

.status-indicator {
  @apply relative inline-flex h-3 w-3;
}

.status-indicator span {
  @apply absolute inline-flex h-full w-full rounded-full opacity-75;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-indicator.online span {
  @apply bg-sage-400;
}

.status-indicator.offline span {
  @apply bg-stone-400;
}

/* ============================================
   Market-Specific Components
   ============================================ */
.price-ticker {
  @apply font-mono text-lg font-semibold;
  font-variant-numeric: tabular-nums;
}

.price-ticker.up {
  @apply text-market-bullish;
}

.price-ticker.down {
  @apply text-market-bearish;
}

.price-ticker.neutral {
  @apply text-market-neutral;
}

.market-card {
  @apply relative overflow-hidden rounded-2xl p-6;
  background: linear-gradient(135deg, white 0%, theme('colors.canvas.100') 100%);
  border: 1px solid theme('colors.stone.200');
}

.market-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, theme('colors.primary.500/5') 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
}

/* ============================================
   Chart & Data Visualization
   ============================================ */
.chart-container {
  @apply relative rounded-xl p-4;
  background: white;
  border: 1px solid theme('colors.stone.200');
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chart-grid {
  background-image:
    linear-gradient(0deg, theme('colors.stone.100') 1px, transparent 1px),
    linear-gradient(90deg, theme('colors.stone.100') 1px, transparent 1px);
  background-size: 20px 20px;
}

/* ============================================
   Loading & Skeleton States
   ============================================ */
.skeleton {
  @apply relative overflow-hidden bg-stone-200 rounded-lg;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    theme('colors.stone.100') 50%,
    transparent 100%
  );
  animation: shimmer 2s linear infinite;
}

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

/* ============================================
   Scrollbar Styling
   ============================================ */
.scrollbar-elegant {
  scrollbar-width: thin;
  scrollbar-color: theme('colors.stone.300') transparent;
}

.scrollbar-elegant::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scrollbar-elegant::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-elegant::-webkit-scrollbar-thumb {
  background: theme('colors.stone.300');
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.scrollbar-elegant::-webkit-scrollbar-thumb:hover {
  background: theme('colors.stone.400');
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 640px) {
  .hide-mobile {
    display: none;
  }
}

@media (min-width: 641px) {
  .show-mobile-only {
    display: none;
  }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */
.focus-visible:focus {
  outline: 2px solid theme('colors.primary.500');
  outline-offset: 2px;
}

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

/* ============================================
   Light Mode (Default)
   ============================================ */
:root {
  --color-background: #f5f5f5;
  --color-surface: #ffffff;
  --color-surface-elevated: #fafafa;
  --color-border: #e5e5e5;
  --color-border-subtle: #f5f5f5;

  --color-text-primary: #171717;
  --color-text-secondary: #525252;
  --color-text-tertiary: #737373;
  --color-text-muted: #a3a3a3;
}
