/**
 * Mobile Enhancements CSS - Mountainside Aces Style
 * Shared styles for mobile-responsive improvements
 * Include this after nav-styles.css
 * @version 2.1.0 - Updated for new navigation system
 */

/* ========================================
   CSS VARIABLES (Match Style Guide)
   ======================================== */
:root {
  --primary-color: #2d5016;
  --secondary-color: #1a6b4a;
  --accent-color: #ffd700;
  --card-bg: #ffffff;
  --text-dark: #2d3748;
  --text-light: #718096;
  --border-color: #e2e8f0;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.16);
}

/* ========================================
   MOBILE NAVIGATION
   REMOVED - Now handled by nav-styles.css
   ======================================== */

/* Mobile Navigation Styles */
@media (max-width: 768px) {
  /* Hide desktop navigation on mobile */
  .back-nav {
    display: none !important;
  }
  
  /* Keep filter sections visible on mobile */
  .filters-nav .filters-section {
    display: flex !important;
  }
  
  /* Touch Target Improvements */
  .card {
    padding: 2rem 1.5rem !important;
    margin-bottom: 1rem;
  }
  
  .card-link {
    min-height: 120px;
  }
  
  /* Visual feedback on touch */
  .card:active {
    transform: scale(0.98) !important;
    opacity: 0.9;
  }
  
  /* Ensure card hover doesn't interfere on mobile */
  .card:hover {
    transform: translateY(0) !important;
  }
 
  /* News Banner Optimization */
  .news-banner {
    font-size: 0.9rem !important;
  }
  
  .news-content {
    animation-duration: 60s !important;
    will-change: transform;
  }
  
  /* Pause on tap, not just hover */
  .news-banner:active .news-content {
    animation-play-state: paused;
  }

  /* Sticky Search Bar */
  .global-search-container {
    position: sticky;
    top: 60px; /* Account for fixed mobile nav */
    z-index: 90;
    margin: 0 !important;
    border-radius: 0;
    box-shadow: var(--shadow-md);
    background: white;
  }
  
  .search-wrapper {
    border-radius: 0;
  }
  
  .search-results {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Card Grid Optimization */
  .cards-grid {
    gap: 1rem !important;
    padding: 0.5rem;
  }
  
  /* Simplify card decorations */
  .card::before {
    height: 3px !important;
  }
  
  .card-icon {
    font-size: 2rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  .card-title {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
  }
  
  .card-description {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.75rem !important;
    color: var(--text-light);
  }
  
  .card-stats {
    font-size: 0.8rem !important;
  }
  
  .card-stats div {
    margin-bottom: 0.25rem;
  }

  /* Quick Access Mobile Layout */
  .quick-access {
    padding: 1.5rem 1rem !important;
    margin: 1rem !important;
  }
  
  .quick-access h3 {
    margin-bottom: 1rem !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
  }
  
  .quick-nav {
    flex-direction: column !important;
    gap: 0.75rem !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .nav-btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 1rem !important;
    font-size: 0.95rem !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    font-weight: 600 !important;
  }

  /* Section Title Optimization */
  .section-title {
    font-size: 1.4rem !important;
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.4rem !important;
    font-weight: 700 !important;
  }
  
  .section-title::before {
    width: 4px !important;
    height: 24px !important;
    margin-right: 0.75rem !important;
  }

  /* Safe Area Insets for Notched Devices */
  .header,
  .global-search-container,
  .dashboard-container {
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
  }
  
  .header {
    padding-top: max(3rem, calc(3rem + env(safe-area-inset-top))) !important;
  }
}

/* ========================================
   RESPONSIVE TABLES
   ======================================== */

/* Swipe indicator for mobile tables */
.swipe-indicator {
  text-align: center;
  padding: 0.5rem;
  background: #fff3cd;
  color: #856404;
  font-size: 0.85rem;
  border-bottom: 1px solid #ffeaa7;
  display: none;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
}

@media (max-width: 768px) {
  /* Show swipe indicators on mobile */
  .swipe-indicator {
    display: block;
  }

  /* Make tables horizontally scrollable */
  .responsive-table-wrapper,
  .standings-table,
  .schedule-table,
  .bracket-table,
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 8px 8px;
  }

  /* Smaller font sizes for mobile tables */
  .standings-table,
  .schedule-table,
  .bracket-table {
    font-size: 0.75rem;
  }

  .standings-table th,
  .schedule-table th,
  .bracket-table th,
  .standings-table td,
  .schedule-table td,
  .bracket-table td {
    padding: 6px 4px;
    font-size: 0.75rem;
  }

  /* Ensure minimum column widths on mobile */
  .standings-table th,
  .standings-table td {
    min-width: 40px;
  }

  .team-name {
    min-width: 80px;
    font-weight: 600;
  }
}

/* ========================================
   MOBILE LAYOUT ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
  /* Header adjustments */
  .header h1 {
    font-size: 2.5rem !important;
    font-weight: 800 !important;
  }

  .header p {
    font-size: 0.95rem !important;
  }

  .page-header h1 {
    font-size: 2.5rem !important;
    font-weight: 800 !important;
  }

  /* Container padding */
  .container,
  .dashboard-container {
    padding: 1rem !important;
  }

  /* Section adjustments */
  .section,
  .section-content {
    padding: 1rem !important;
  }

  .section-header {
    padding: 1rem !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
  }

  /* Card grids - stack to 1 column */
  .cards-grid,
  .leaders-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Stats summary - 2 columns then 1 */
  .stats-summary {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .stat-card {
    padding: 0.75rem !important;
  }

  .stat-number {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
  }

  .stat-label {
    font-size: 0.8rem !important;
    color: var(--text-light);
  }

  /* Bracket visual - stack vertically */
  .bracket-visual {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .bracket-round {
    padding: 0.75rem !important;
  }

  .bracket-title {
    font-size: 1rem !important;
    padding: 0.6rem 0.75rem !important;
    font-weight: 700 !important;
  }

  /* Leader list adjustments */
  .leader-list li {
    font-size: 0.85rem !important;
    flex-wrap: wrap;
  }

  .leader-team {
    width: 100%;
    margin-left: 2rem;
    margin-top: 0.25rem;
    color: var(--text-light);
  }

  /* Comparison grids */
  .comparison-container,
  .career-comparison {
    grid-template-columns: 1fr !important;
  }

  .comparison-divider {
    display: none !important;
  }

  /* Milestone tables */
  .milestone-tables {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  /* Season containers */
  .seasons-container {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
}

/* ========================================
   EXTRA SMALL DEVICES (< 480px)
   ======================================== */

@media (max-width: 480px) {
  /* Further reduce text sizes */
  .header h1 {
    font-size: 2rem !important;
  }

  .page-header h1 {
    font-size: 2rem !important;
  }

  /* Single column for all grids */
  .stats-summary {
    grid-template-columns: 1fr !important;
  }

  /* Smaller table text */
  .standings-table,
  .schedule-table,
  .bracket-table {
    font-size: 0.7rem !important;
  }

  .standings-table th,
  .schedule-table th,
  .bracket-table th,
  .standings-table td,
  .schedule-table td,
  .bracket-table td {
    padding: 4px 2px !important;
    font-size: 0.7rem !important;
  }
}

/* ========================================
   TOUCH-FRIENDLY INTERACTIONS
   ======================================== */

@media (max-width: 768px) {
  /* Ensure all interactive elements are touch-friendly */
  button,
  .nav-btn,
  .mobile-button,
  a.card-link,
  .filter-select,
  input[type="text"],
  input[type="search"],
  select {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on mobile, use active states */
  .card:hover,
  .nav-link:hover {
    transform: none;
  }

  .card:active {
    opacity: 0.8;
  }

  /* Better tap highlighting - use brand color */
  * {
    -webkit-tap-highlight-color: rgba(45, 80, 22, 0.2);
  }
}

/* ========================================
   LOADING STATES
   ======================================== */

@media (max-width: 768px) {
  .loading {
    padding: 2rem 1rem !important;
    font-size: 0.9rem !important;
    color: var(--text-light);
  }

  .no-data {
    padding: 1.5rem 1rem !important;
    font-size: 0.9rem !important;
    color: var(--text-light);
  }
}

/* ========================================
   SEARCH BAR MOBILE
   ======================================== */

@media (max-width: 768px) {
  .global-search-container,
  .mobile-search-container {
    margin: 1rem !important;
  }

  .global-search-input,
  .mobile-search-input {
    font-size: 1rem !important;
    padding: 1rem 3rem 1rem 3rem !important;
    font-family: 'Inter', sans-serif;
  }
}

/* ========================================
   ACCESSIBILITY & PERFORMANCE
   ======================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Special handling for news banner */
  .news-content {
    animation: none !important;
    display: block;
    overflow-x: auto;
    white-space: normal;
    padding: 12px 20px;
  }
  
  .news-banner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Remove transform effects */
  .card:hover,
  .card:active {
    transform: none !important;
  }
  
  .nav-btn:hover {
    transform: none !important;
  }
  
  /* Keep essential functionality, remove decorative animations */
  .mobile-nav-menu {
    transition: none !important;
  }
}

/* Dark mode support with brand colors */
@media (prefers-color-scheme: dark) {
  .swipe-indicator {
    background: #4a5568;
    color: #e2e8f0;
    border-bottom-color: var(--text-light);
  }
}

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

/* Hide on mobile */
.hide-mobile {
  display: block;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .show-mobile {
    display: block !important;
  }
}

/* Mobile text sizes */
@media (max-width: 768px) {
  .mobile-text-sm {
    font-size: 0.875rem !important;
  }

  .mobile-text-xs {
    font-size: 0.75rem !important;
  }
}

/* Mobile padding utilities */
@media (max-width: 768px) {
  .mobile-p-0 {
    padding: 0 !important;
  }

  .mobile-p-1 {
    padding: 0.5rem !important;
  }

  .mobile-p-2 {
    padding: 1rem !important;
  }

  .mobile-m-0 {
    margin: 0 !important;
  }

  .mobile-m-1 {
    margin: 0.5rem !important;
  }

  .mobile-m-2 {
    margin: 1rem !important;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .mobile-nav-container,
  .hamburger-menu,
  .back-nav,
  .swipe-indicator {
    display: none !important;
  }

  .mobile-nav-menu {
    display: none !important;
  }

  /* Ensure tables print properly */
  .standings-table,
  .schedule-table,
  .bracket-table {
    overflow: visible !important;
    white-space: normal !important;
  }
}