/* 1USDT.Money Design System & Custom Styles */

/* ============================================
   CSS VARIABLES - Design System
   ============================================ */
:root {
  /* Colors - Primary */
  --color-primary-50: #eef2ff;
  --color-primary-100: #e0e7ff;
  --color-primary-500: #6366f1;
  --color-primary-600: #4f46e5;
  --color-primary-700: #4338ca;
  
  /* Colors - Accent */
  --color-accent-400: #22d3ee;
  --color-accent-500: #06b6d4;
  --color-accent-600: #0891b2;
  
  /* Colors - Success */
  --color-success-400: #34d399;
  --color-success-500: #10b981;
  --color-success-600: #059669;
  
  /* Colors - Danger */
  --color-danger-400: #fb7185;
  --color-danger-500: #f43f5e;
  --color-danger-600: #e11d48;
  
  /* Colors - Warning */
  --color-warning-400: #fbbf24;
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;
  
  /* Colors - Background */
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #334155;
  
  /* Colors - Surface */
  --color-surface-800: #1e293b;
  --color-surface-700: #334155;
  --color-surface-600: #475569;
  
  /* Colors - Text */
  --color-text-primary: #f1f5f9;
  --color-text-secondary: #cbd5e1;
  --color-text-tertiary: #94a3b8;
  --color-text-muted: #64748b;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-purple {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-cyan {
  background: linear-gradient(135deg, var(--color-accent-400) 0%, var(--color-primary-600) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gradient Backgrounds */
.gradient-bg-primary {
  background: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-bg-primary) 100%);
}

.gradient-bg-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #0f172a 100%);
}

.gradient-bg-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
}

/* Glassmorphism */
.glass {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-light {
  background: rgba(51, 65, 85, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Card Hover Effects */
.card-hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-2xl);
}

.card-lift:hover {
  transform: translateY(-4px) scale(1.02);
}

/* Animated Borders */
.border-gradient {
  position: relative;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  padding: 1px;
}

.border-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-accent-500));
  -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;
}

/* Status Indicators */
.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status-running {
  background: var(--color-success-500);
  box-shadow: 0 0 12px var(--color-success-400);
}

.status-stopped {
  background: var(--color-text-muted);
}

.status-error {
  background: var(--color-danger-500);
  box-shadow: 0 0 12px var(--color-danger-400);
}

.status-warning {
  background: var(--color-warning-500);
  box-shadow: 0 0 12px var(--color-warning-400);
}

/* Badge Styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success-400);
  border: 1px solid var(--color-success-600);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.2);
  color: var(--color-danger-400);
  border: 1px solid var(--color-danger-600);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning-400);
  border: 1px solid var(--color-warning-600);
}

.badge-info {
  background: rgba(6, 182, 212, 0.2);
  color: var(--color-accent-400);
  border: 1px solid var(--color-accent-600);
}

.badge-neutral {
  background: rgba(148, 163, 184, 0.2);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-surface-600);
}

/* Progress Bars */
.progress-bar {
  height: 0.5rem;
  background: var(--color-surface-700);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width var(--transition-base);
}

.progress-fill-success {
  background: linear-gradient(90deg, var(--color-success-600), var(--color-success-400));
}

.progress-fill-danger {
  background: linear-gradient(90deg, var(--color-danger-600), var(--color-danger-400));
}

.progress-fill-warning {
  background: linear-gradient(90deg, var(--color-warning-600), var(--color-warning-400));
}

.progress-fill-info {
  background: linear-gradient(90deg, var(--color-accent-600), var(--color-accent-400));
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  min-width: 300px;
  max-width: 420px;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.3s ease-out;
}

.toast-success {
  background: var(--color-success-600);
  color: white;
  border-left: 4px solid var(--color-success-400);
}

.toast-error {
  background: var(--color-danger-600);
  color: white;
  border-left: 4px solid var(--color-danger-400);
}

.toast-warning {
  background: var(--color-warning-600);
  color: white;
  border-left: 4px solid var(--color-warning-400);
}

.toast-info {
  background: var(--color-accent-600);
  color: white;
  border-left: 4px solid var(--color-accent-400);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-700) 0%,
    var(--color-surface-600) 50%,
    var(--color-surface-700) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-xl);
}

/* Pulse Animation for Live Data */
.pulse-live {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Number Counter Animation */
.counter {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-primary);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
  background: var(--color-surface-600);
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-surface-700);
}

/* Selection */
::selection {
  background: var(--color-primary-500);
  color: white;
}

::-moz-selection {
  background: var(--color-primary-500);
  color: white;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Animated Background Particles */
@keyframes particle-float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.3;
  }
  33% {
    transform: translate(30px, -30px) rotate(120deg);
    opacity: 0.6;
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
    opacity: 0.4;
  }
}

.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(99, 102, 241, 0.5);
  border-radius: 50%;
  animation: particle-float 8s infinite ease-in-out;
}

.particle:nth-child(2) {
  animation-delay: -2s;
  animation-duration: 10s;
  background: rgba(6, 182, 212, 0.4);
}

.particle:nth-child(3) {
  animation-delay: -4s;
  animation-duration: 12s;
  background: rgba(16, 185, 129, 0.3);
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Mobile First - Extra Small Devices (< 640px) */
@media (max-width: 639px) {
  html {
    font-size: 14px;
  }
  
  /* Toast Notifications */
  .toast {
    left: 0.75rem;
    right: 0.75rem;
    min-width: auto;
    max-width: none;
    font-size: 0.875rem;
    padding: 0.875rem 1rem;
  }
  
  /* Navigation - Mobile Hamburger */
  .mobile-menu-open {
    overflow: hidden;
  }
  
  /* Hero Section */
  .hero-bg-animated {
    padding-top: 5rem;
    padding-bottom: 3rem;
  }
  
  /* Hide particles on mobile for performance */
  .particles {
    display: none;
  }
  
  /* Metric Cards - Stack on mobile */
  .metric-card {
    padding: 1.25rem;
  }
  
  /* Buttons - Larger touch targets */
  button,
  .btn,
  a[class*="btn"] {
    min-height: 44px; /* iOS recommended touch target */
    padding: 0.75rem 1.25rem;
  }
  
  /* Form Inputs - Larger for mobile */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zoom on focus */
    padding: 0.75rem 1rem;
  }
  
  /* Tables - Horizontal scroll */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px; /* Force scroll on small screens */
  }
  
  /* Modal - Full screen on mobile */
  .modal-content,
  .glass[role="dialog"] {
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Sidebar - Hidden by default on mobile */
  aside {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: 16rem; /* 64 * 4px = 256px */
  }
  
  /* Overlay for mobile sidebar */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    display: none;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
  
  /* Chart containers */
  .chart-container {
    height: 250px;
  }
  
  /* Grid adjustments */
  .grid {
    gap: 1rem;
  }
  
  /* Spacing adjustments */
  section {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  
  /* Text sizes */
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  h3 {
    font-size: 1.5rem;
  }
  
  h4 {
    font-size: 1.25rem;
  }
  
  /* Badge adjustments */
  .badge {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* Card padding */
  .glass,
  .metric-card {
    padding: 1rem;
  }
  
  /* Status indicators - Larger on mobile */
  .status-dot {
    width: 0.625rem;
    height: 0.625rem;
  }
}

/* Small Devices (640px - 767px) */
@media (min-width: 640px) and (max-width: 767px) {
  html {
    font-size: 15px;
  }
  
  .chart-container {
    height: 280px;
  }
}

/* Tablet Devices (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  html {
    font-size: 15px;
  }
  
  /* Two-column grids */
  .grid-cols-1.md\\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  /* Chart height */
  .chart-container {
    height: 300px;
  }
  
  /* Sidebar - Show but narrower */
  aside {
    width: 240px;
  }
  
  /* Left panel on auth pages - Show on tablet */
  .two-panel-layout .left-panel {
    display: flex;
    padding: 2rem;
  }
}

/* Landscape phones */
@media (max-width: 767px) and (orientation: landscape) {
  /* Reduce vertical padding in landscape */
  section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .hero-bg-animated {
    padding-top: 4rem;
    padding-bottom: 2rem;
  }
  
  /* Sidebar - Scroll in landscape */
  aside {
    overflow-y: auto;
  }
}

/* Large Tablets and Small Desktops (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
  html {
    font-size: 16px;
  }
  
  /* Three-column layouts */
  .grid-cols-1.lg\\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .chart-container {
    height: 320px;
  }
}

/* Desktop (1280px+) */
@media (min-width: 1280px) {
  .chart-container {
    height: 350px;
  }
  
  /* Max width for very large screens */
  .container-max {
    max-width: 1536px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  button,
  a,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover states on touch devices */
  .card-hover:hover {
    transform: none;
  }
  
  /* Disable hover tooltips on touch */
  .tooltip:hover .tooltip-text {
    display: none;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders */
  .glass,
  .metric-card {
    border-width: 0.5px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .particles,
  .animate-pulse,
  .animate-spin {
    animation: none !important;
  }
}

/* ============================================
   COMPONENT-SPECIFIC STYLES
   ============================================ */

/* Hero Animated Background */
.hero-bg-animated {
  position: relative;
  overflow: hidden;
}

.hero-bg-animated::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: float 20s linear infinite;
}

/* Metric Cards with Glow */
.metric-card {
  position: relative;
  background: var(--color-surface-800);
  border: 1px solid var(--color-surface-700);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: all var(--transition-base);
}

.metric-card:hover {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.metric-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.3), transparent);
  -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;
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

/* Password Strength Meter */
.password-strength-meter {
  height: 4px;
  background: var(--color-surface-700);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.password-strength-fill {
  height: 100%;
  transition: width var(--transition-base), background-color var(--transition-base);
  border-radius: 9999px;
}

.password-strength-weak {
  background: var(--color-danger-500);
}

.password-strength-fair {
  background: var(--color-warning-500);
}

.password-strength-good {
  background: var(--color-accent-500);
}

.password-strength-strong {
  background: var(--color-success-500);
}

/* Side Panel Layout */
.two-panel-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

@media (max-width: 1024px) {
  .two-panel-layout {
    grid-template-columns: 1fr;
  }
  
  .two-panel-layout .left-panel {
    display: none;
  }
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 300px;
  background: var(--color-surface-800);
  border-radius: var(--radius-xl);
  padding: 1rem;
}

/* Custom Checkbox/Radio */
.custom-checkbox {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-surface-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.custom-checkbox:checked {
  background: var(--color-primary-500);
  border-color: var(--color-primary-500);
}

.custom-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-fast);
  border: 1px solid var(--color-surface-700);
  box-shadow: var(--shadow-lg);
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-surface-700);
  border-top-color: var(--color-primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 6px;
}
