/* 
 * Mobile-First Responsive CSS for RealWin AI Sports Platform
 * This file provides comprehensive responsive styles for all devices
 * Mobile-first approach with progressive enhancement
 */

/* Reset and base styles */
* {
  box-sizing: border-box;
}

/* Base mobile styles (320px and up) */
body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

/* Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* Container responsive behavior */
.container,
.custom_continer {
  width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}

/* Navigation responsive */
.nav {
  padding: 10px 0;
}

.nav .logo img {
  max-width: 220px;
  object-fit: contain;
  height: auto;
}

/* Button and link touch targets */
a, button, .btn, .cta {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Form elements */
input, select, textarea {
  width: 100%;
  padding: 12px;
  font-size: 16px; /* Prevents zoom on iOS */
  border-radius: 8px;
  border: 1px solid #333;
  background-color: #1a1a1a;
  color: white;
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #ccff00;
  outline-offset: 2px;
}

/* Images responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Tables responsive */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 600px;
}

/* Grid layouts responsive */
.grid-responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.flex-responsive {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Text responsive */
h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  font-size: 18px;
  line-height: 1.4;
}

p {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 15px;
}

/* Card layouts */
.card-responsive {
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  background-color: #1a1a1a;
}

/* Small mobile devices (320px - 480px) */
@media (max-width: 480px) {
  .container,
  .custom_continer {
    padding: 0 10px;
  }
  
  .nav .logo img {
    max-width: 120px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  h2 {
    font-size: 18px;
  }
  
  h3 {
    font-size: 16px;
  }
  
  p {
    font-size: 14px;
  }
  
  .card-responsive {
    padding: 12px;
  }
  
  input, select, textarea {
    padding: 10px;
    font-size: 16px;
  }
}

/* Medium mobile devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .container,
  .custom_continer {
    padding: 0 20px;
  }
  
  .nav .logo img {
    max-width: 180px;
  }
  
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .flex-responsive {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .flex-responsive > * {
    flex: 1;
    min-width: 250px;
  }
}

/* Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .container,
  .custom_continer {
    max-width: 750px;
    padding: 0 10px;
  }
  
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
  
  h1 {
    font-size: 32px;
  }
  
  h2 {
    font-size: 28px;
  }
  
  h3 {
    font-size: 24px;
  }
}

/* Desktop (1025px and up) */
@media (min-width: 1025px) {
  .container,
  .custom_continer {
    max-width: 1200px;
    padding: 0 40px;
  }
  
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
  }
  
  h1 {
    font-size: 36px;
  }
  
  h2 {
    font-size: 32px;
  }
  
  h3 {
    font-size: 28px;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .nav {
    padding: 8px 0;
  }
  
  .nav .logo img {
    max-width: 100px;
  }
  
  h1 {
    font-size: 22px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .card-responsive {
    padding: 10px;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  /* Optimizations for retina displays */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* Already handled in base styles */
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus visible for better accessibility */
@media (hover: none) and (pointer: coarse) {
  /* Touch devices */
  a:focus,
  button:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline: 3px solid #ccff00;
    outline-offset: 2px;
  }
}

/* Print styles */
@media print {
  * {
    background: white !important;
    color: black !important;
    text-shadow: none !important;
    box-shadow: none !important;
  }
  
  a {
    text-decoration: underline;
  }
  
  .nav,
  .footer,
  .sidebar {
    display: none !important;
  }
}

/* Utility classes for responsive design */

/* Hide/show based on screen size */
.hide-mobile {
  display: none;
}

.show-mobile {
  display: block;
}

@media (min-width: 769px) {
  .hide-mobile {
    display: block;
  }
  
  .show-mobile {
    display: none;
  }
  
  .hide-desktop {
    display: none;
  }
  
  .show-desktop {
    display: block;
  }
}

/* Responsive spacing utilities */
.p-xs { padding: 0.5rem; }
.p-sm { padding: 1rem; }
.p-md { padding: 1.5rem; }
.p-lg { padding: 2rem; }

.m-xs { margin: 0.5rem; }
.m-sm { margin: 1rem; }
.m-md { margin: 1.5rem; }
.m-lg { margin: 2rem; }

/* Responsive text alignment */
.text-center-mobile {
  text-align: center;
}

@media (min-width: 769px) {
  .text-center-mobile {
    text-align: left;
  }
}

/* Responsive flex utilities */
.flex-mobile-column {
  display: flex;
  flex-direction: column;
}

@media (min-width: 769px) {
  .flex-mobile-column {
    flex-direction: row;
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
}

/* Error states */
.error {
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.success {
  color: #51cf66;
  border-color: #51cf66;
}

/* Smooth scrolling for supported browsers */
@supports (scroll-behavior: smooth) {
  html {
    scroll-behavior: smooth;
  }
}

/* Custom scrollbar for webkit browsers */
@media (min-width: 769px) {
  ::-webkit-scrollbar {
    width: 8px;
  }
  
  ::-webkit-scrollbar-track {
    background: #1a1a1a;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #888;
  }
}
