/* 
 * Mobile-First Enhancement Stylesheet
 * Professional, modern design system for all HTML pages
 * Inspired by modern web applications with focus on mobile UX
 */

:root {
  /* Enhanced Color Palette - Professional & Modern */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --dark-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  
  /* Enhanced Spacing System */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Modern Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Enhanced 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), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.4);
  
  /* Border Radius System */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Mobile-First Base Enhancements */
.mobile-enhanced {
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  
  /* Enhance tap targets for mobile */
  -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
}

/* Enhanced Touch Targets - Minimum 44x44px for accessibility */
.mobile-enhanced button,
.mobile-enhanced a,
.mobile-enhanced input[type="button"],
.mobile-enhanced input[type="submit"],
.mobile-enhanced .btn,
.mobile-enhanced .button {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

/* Modern Button Enhancements */
.mobile-enhanced button:not(.no-enhance),
.mobile-enhanced .btn:not(.no-enhance),
.mobile-enhanced input[type="button"]:not(.no-enhance),
.mobile-enhanced input[type="submit"]:not(.no-enhance) {
  border-radius: var(--radius-lg);
  font-weight: 600;
  letter-spacing: 0.025em;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.mobile-enhanced button:hover:not(:disabled):not(.no-enhance),
.mobile-enhanced .btn:hover:not(:disabled):not(.no-enhance) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.mobile-enhanced button:active:not(:disabled):not(.no-enhance),
.mobile-enhanced .btn:active:not(:disabled):not(.no-enhance) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Ripple Effect for Touch Feedback */
.mobile-enhanced button:not(.no-enhance)::before,
.mobile-enhanced .btn:not(.no-enhance)::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width var(--transition-slow), height var(--transition-slow);
}

.mobile-enhanced button:active:not(.no-enhance)::before,
.mobile-enhanced .btn:active:not(.no-enhance)::before {
  width: 300px;
  height: 300px;
}

/* Enhanced Card Components */
.mobile-enhanced .card:not(.no-enhance),
.mobile-enhanced [class*="card"]:not(.no-enhance) {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

.mobile-enhanced .card:hover:not(.no-enhance),
.mobile-enhanced [class*="card"]:hover:not(.no-enhance) {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

/* Enhanced Input Fields */
.mobile-enhanced input:not([type="checkbox"]):not([type="radio"]):not(.no-enhance),
.mobile-enhanced select:not(.no-enhance),
.mobile-enhanced textarea:not(.no-enhance) {
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-size: 16px; /* Prevents zoom on iOS */
  padding: 0.75rem 1rem;
  border: 2px solid transparent;
}

.mobile-enhanced input:focus:not(.no-enhance),
.mobile-enhanced select:focus:not(.no-enhance),
.mobile-enhanced textarea:focus:not(.no-enhance) {
  outline: none;
  box-shadow: var(--shadow-glow);
  border-color: rgba(102, 126, 234, 0.5);
  transform: scale(1.02);
}

/* Enhanced Header/Navigation */
/* Removed sticky positioning to allow header to scroll naturally */
/* Only the LIVE FEED ticker should remain fixed at the top */
.mobile-enhanced header:not(.no-enhance) {
  backdrop-filter: blur(10px) saturate(180%);
  box-shadow: var(--shadow-md);
  position: relative;
  transition: all var(--transition-base);
}

/* Smooth Scrolling */
.mobile-enhanced {
  scroll-behavior: smooth;
}

/* Enhanced Tables for Mobile */
@media (max-width: 768px) {
  .mobile-enhanced table:not(.no-enhance) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }
  
  .mobile-enhanced table:not(.no-enhance) thead {
    display: none;
  }
  
  .mobile-enhanced table:not(.no-enhance) tr {
    display: block;
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md);
  }
  
  .mobile-enhanced table:not(.no-enhance) td {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .mobile-enhanced table:not(.no-enhance) td:last-child {
    border-bottom: none;
  }
  
  .mobile-enhanced table:not(.no-enhance) td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: var(--spacing-md);
  }
}

/* Enhanced Grid Layouts */
.mobile-enhanced .grid:not(.no-enhance),
.mobile-enhanced [class*="grid"]:not(.no-enhance) {
  display: grid;
  gap: var(--spacing-lg);
  transition: all var(--transition-base);
}

@media (max-width: 640px) {
  .mobile-enhanced .grid:not(.no-enhance),
  .mobile-enhanced [class*="grid"]:not(.no-enhance) {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-md);
  }
}

/* Loading States */
.mobile-enhanced .loading:not(.no-enhance) {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.mobile-enhanced .loading:not(.no-enhance)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: mobile-enhanced-spin 0.6s linear infinite;
}

@keyframes mobile-enhanced-spin {
  to { transform: rotate(360deg); }
}

/* Enhanced Modals/Dialogs */
.mobile-enhanced dialog:not(.no-enhance),
.mobile-enhanced .modal:not(.no-enhance) {
  border-radius: var(--radius-2xl);
  border: none;
  box-shadow: var(--shadow-2xl);
  backdrop-filter: blur(10px);
  max-width: min(90vw, 600px);
  max-height: 90vh;
  overflow: auto;
  padding: var(--spacing-xl);
}

.mobile-enhanced dialog::backdrop,
.mobile-enhanced .modal-backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
}

/* Enhanced Animations */
.mobile-enhanced .fade-in {
  animation: mobile-enhanced-fadeIn var(--transition-slow) ease-in;
}

.mobile-enhanced .slide-up {
  animation: mobile-enhanced-slideUp var(--transition-slow) ease-out;
}

.mobile-enhanced .scale-in {
  animation: mobile-enhanced-scaleIn var(--transition-bounce) ease-out;
}

@keyframes mobile-enhanced-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mobile-enhanced-slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes mobile-enhanced-scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Enhanced Utility Classes */
.mobile-enhanced .container:not(.no-enhance) {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
  .mobile-enhanced .container:not(.no-enhance) {
    padding: 0 var(--spacing-lg);
  }
}

@media (min-width: 1024px) {
  .mobile-enhanced .container:not(.no-enhance) {
    padding: 0 var(--spacing-xl);
  }
}

/* Enhanced Typography */
.mobile-enhanced h1,
.mobile-enhanced h2,
.mobile-enhanced h3 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.mobile-enhanced h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.mobile-enhanced h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.mobile-enhanced h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
}

/* Enhanced Link Styles */
.mobile-enhanced a:not(.btn):not(.button):not(.no-enhance) {
  position: relative;
  text-decoration: none;
  transition: all var(--transition-base);
}

.mobile-enhanced a:not(.btn):not(.button):not(.no-enhance)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width var(--transition-base);
}

.mobile-enhanced a:not(.btn):not(.button):not(.no-enhance):hover::after {
  width: 100%;
}

/* Enhanced Image Handling */
.mobile-enhanced img:not(.no-enhance) {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  transition: transform var(--transition-base);
}

.mobile-enhanced img:not(.no-enhance):hover {
  transform: scale(1.02);
}

/* Safe Area Insets for Mobile Devices */
@supports (padding: env(safe-area-inset-top)) {
  .mobile-enhanced {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Enhanced Focus Styles for Accessibility */
.mobile-enhanced *:focus-visible {
  outline: 3px solid rgba(102, 126, 234, 0.5);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .mobile-enhanced * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark Mode Enhancement (respects system preference) */
@media (prefers-color-scheme: light) {
  .mobile-enhanced {
    --shadow-color: rgba(0, 0, 0, 0.1);
  }
}

/* Enhanced Print Styles */
@media print {
  .mobile-enhanced button,
  .mobile-enhanced .btn,
  .mobile-enhanced input,
  .mobile-enhanced select,
  .mobile-enhanced textarea {
    box-shadow: none !important;
    transform: none !important;
  }
}
