/* Football11 Final Plugin - Comprehensive Responsive Design System */
/* Modern, mobile-first approach with consistent breakpoints */

/* ===== MOBILE FIRST BASE STYLES ===== */
/* All styles below are mobile-first and will be enhanced for larger screens */

/* ===== SMALL MOBILE (320px - 480px) ===== */
@media (max-width: 480px) {
  /* Header & Navigation */
  .header {
    padding: 10px 0;
  }
  
  .brand-row {
    flex-direction: column;
    gap: 15px;
    padding: 0 15px;
  }
  
  .brand-name h1 {
    font-size: 20px;
  }
  
  .brand-name h2 {
    font-size: 12px;
  }
  
  .search-box-container {
    width: 100%;
    max-width: 280px;
  }
  
  .search-box-container input {
    width: 100%;
    font-size: 14px;
  }
  
  /* Main Container */
  .livescore-container {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 0 10px;
    margin: 10px auto;
  }
  
  .livescore-left-box,
  .livescore-right-box {
    order: 3;
  }
  
  .match-list {
    order: 1;
  }
  
  /* Filters */
  .filter-items {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 15px;
  }
  
  .filter-item {
    justify-content: center;
    padding: 12px 15px;
    font-size: 13px;
    min-width: auto;
    width: 100%;
  }
  
  /* Match Rows */
  .match-row {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    padding: 15px 10px;
  }
  
  .team-container {
    justify-content: center;
    flex-direction: column;
    gap: 10px;
  }
  
  .home-team {
    justify-content: center;
    order: 1;
  }
  
  .away-team {
    justify-content: center;
    order: 3;
  }
  
  .score {
    order: 2;
    margin: 10px 0;
    font-size: 18px !important;
    padding: 6px 12px !important;
    min-width: 70px !important;
  }
  
  .teamname {
    font-size: 13px;
    margin: 5px 0;
  }
  
  .team-logo {
    width: 30px !important;
    height: 30px !important;
  }
  
  .country-flag-img {
    width: 16px;
    height: 12px;
  }
  
  /* Football Field - Mobile Optimized */
  .football-field {
    margin: 15px 0;
  }
  
  .formation-info {
    font-size: 14px;
    margin-bottom: 10px;
  }
  
  .field {
    max-width: 100%;
    height: 250px;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 3px;
    padding: 8px;
  }
  
  .player-circle {
    width: 32px;
    height: 32px;
  }
  
  .player-circle .player-number {
    font-size: 12px;
  }
  
  .player-name {
    font-size: 8px;
    max-width: 50px;
  }
  
  .player-position {
    font-size: 7px;
  }
  
  /* Lineup Buttons */
  .lineup-buttons {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
  }
  
  .team-lineup-button {
    min-width: auto;
    width: 100%;
    padding: 15px 20px;
  }
  
  .team-lineup-button .team-name {
    font-size: 16px;
  }
  
  .team-lineup-button .formation-info {
    font-size: 12px;
  }
  
  /* Match Details Sidebar */
  .match-details-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: white;
    overflow-y: auto;
    overflow-x: auto; /* Enable horizontal scroll on mobile */
  }
  
  .match-details-container {
    position: static;
  }
  
  .match-details-content {
    max-height: none;
    overflow: visible;
    overflow-x: auto; /* Ensure horizontal scroll works on mobile */
    padding: 20px 15px;
    /* Enable touch scrolling */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Mobile horizontal scroll indicators */
  .match-details-content::before,
  .match-details-content::after {
    content: '';
    position: sticky;
    top: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.8) 0%, transparent 100%);
    pointer-events: none;
    z-index: 10;
  }
  
  .match-details-content::before {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.8) 0%, transparent 100%);
  }
  
  .match-details-content::after {
    right: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.8) 100%);
  }
  
  /* Ensure content sections are scrollable horizontally on mobile */
  .match-details-content .tab-content {
    min-width: 100%;
    overflow-x: auto;
    padding: 15px 10px;
  }
  
  .match-details-content .info-section,
  .match-details-content .events-section,
  .match-details-content .lineups-section,
  .match-details-content .teams-section,
  .match-details-content .stats-section {
    min-width: 280px; /* Slightly smaller on mobile */
    padding: 15px 10px;
  }
  
  /* Mobile-optimized horizontal scroll for specific containers */
  .stats-container,
  .lineups-container,
  .teams-container,
  .events-timeline {
    min-width: 100%;
    overflow-x: auto;
    padding-bottom: 15px;
    /* Add scroll snap for better mobile experience */
    scroll-snap-type: x mandatory;
  }
  
  /* Scroll snap points for mobile */
  .stats-container > *,
  .lineups-container > *,
  .teams-container > *,
  .events-timeline > * {
    scroll-snap-align: start;
  }
  
  /* Mobile scroll indicators */
  .match-details-content .scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .match-details-content .scroll-indicator.left {
    left: 10px;
  }
  
  .match-details-content .scroll-indicator.right {
    right: 10px;
  }
  
  .match-details-content:hover .scroll-indicator {
    opacity: 1;
  }
  
  /* Enhanced mobile horizontal scroll */
  .match-details-content .tab-content {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .match-details-content .tab-content > * {
    scroll-snap-align: start;
  }
  
  /* Mobile-optimized content sections */
  .match-details-content .info-section,
  .match-details-content .events-section,
  .match-details-content .lineups-section,
  .match-details-content .teams-section,
  .match-details-content .stats-section {
    scroll-snap-align: start;
    min-width: 280px;
    padding: 15px 10px;
  }
  
  /* Mobile touch-friendly scroll areas */
  .stats-container,
  .lineups-container,
  .teams-container,
  .events-timeline {
    touch-action: pan-x;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Mobile scroll momentum */
  .match-details-content {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Mobile scrollbar styling */
  .match-details-content::-webkit-scrollbar {
    height: 4px;
    width: 4px;
  }
  
  .match-details-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 2px;
  }
  
  .match-details-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
  }
  
  .match-details-content::-webkit-scrollbar-thumb:hover {
    background: #1a6bb8;
  }
  
  .teams-section {
    max-height: none;
    overflow: visible;
  }
  
  /* League Headers */
  .header-row {
    flex-direction: column;
    gap: 15px;
    padding: 12px;
  }
  
  .league-info {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    margin-right: 0;
  }
  
  .league-details {
    order: 1;
  }
  
  .country-flag {
    order: 2;
    width: 35px;
    height: 25px;
  }
  
  .league-logo {
    order: 3;
    width: 45px;
    height: 45px;
  }
  
  .league-name {
    font-size: 16px;
  }
  
  .league-country {
    font-size: 13px;
  }
  
  .league-round {
    font-size: 11px;
  }
}

/* ===== MEDIUM MOBILE (481px - 768px) ===== */
@media (min-width: 481px) and (max-width: 768px) {
  /* Header & Navigation */
  .header {
    padding: 12px 0;
  }
  
  .brand-row {
    padding: 0 20px;
  }
  
  .search-box-container {
    max-width: 300px;
  }
  
  /* Main Container */
  .livescore-container {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 0 15px;
  }
  
  .livescore-left-box,
  .livescore-right-box {
    order: 3;
  }
  
  .match-list {
    order: 1;
  }
  
  /* Filters */
  .filter-items {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .filter-item {
    justify-content: center;
    padding: 12px 20px;
    min-width: auto;
    width: 100%;
  }
  
  /* Match Rows */
  .match-row {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    padding: 20px 15px;
  }
  
  .team-container {
    justify-content: center;
    flex-direction: column;
    gap: 10px;
  }
  
  .home-team {
    justify-content: center;
    order: 1;
  }
  
  .away-team {
    justify-content: center;
    order: 3;
  }
  
  .score {
    order: 2;
    margin: 10px 0;
  }
  
  .teamname {
    font-size: 14px;
    margin: 5px 0;
  }
  
  .team-logo {
    width: 35px !important;
    height: 35px !important;
  }
  
  .country-flag-img {
    width: 18px;
    height: 13px;
  }
  
  /* Football Field - Medium Mobile */
  .field {
    max-width: 350px;
    height: 280px;
  }
  
  .player-circle {
    width: 36px;
    height: 36px;
  }
  
  .player-circle .player-number {
    font-size: 13px;
  }
  
  .player-name {
    font-size: 9px;
    max-width: 55px;
  }
  
  .player-position {
    font-size: 7px;
  }
  
  /* Lineup Buttons */
  .lineup-buttons {
    gap: 15px;
    margin-bottom: 25px;
  }
  
  .team-lineup-button {
    min-width: 160px;
    padding: 18px 25px;
  }
  
  /* Match Details Sidebar */
  .match-details-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: white;
    overflow-y: auto;
  }
  
  .match-details-container {
    position: static;
  }
  
  .match-details-content {
    max-height: none;
    overflow: visible;
  }
  
  .teams-section {
    max-height: none;
    overflow: visible;
  }
  
  /* League Headers */
  .header-row {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  
  .league-info {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    margin-right: 0;
  }
  
  .league-details {
    order: 1;
  }
  
  .country-flag {
    order: 2;
    width: 40px;
    height: 30px;
  }
  
  .league-logo {
    order: 3;
    width: 50px;
    height: 50px;
  }
}

/* ===== TABLET (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Header & Navigation */
  .search-box-container input {
    width: 200px;
  }
  
  /* Main Container */
  .livescore-container {
    grid-template-columns: 220px 1fr 220px;
    gap: 15px;
  }
  
  /* Match Rows */
  .match-row {
    padding: 18px 20px;
  }
  
  .team-logo {
    width: 45px !important;
    height: 45px !important;
  }
  
  .score {
    font-size: 22px !important;
    padding: 10px 18px !important;
  }
  
  /* Football Field - Tablet */
  .field {
    max-width: 380px;
    height: 290px;
  }
  
  .player-circle {
    width: 38px;
    height: 38px;
  }
  
  .player-circle .player-number {
    font-size: 13px;
  }
  
  .player-name {
    font-size: 9px;
    max-width: 58px;
  }
  
  .player-position {
    font-size: 8px;
  }
  
  /* Lineup Buttons */
  .team-lineup-button {
    min-width: 170px;
    padding: 18px 25px;
  }
  
  /* Match Details Sidebar */
  .match-details-sidebar {
    width: 280px;
    min-width: 280px;
    display: none; /* Hidden by default on tablet until match is clicked */
  }
  
  /* Enhanced horizontal scroll for tablet */
  .match-details-content {
    overflow-x: auto;
    scroll-behavior: smooth;
  }
  
  .match-details-content .tab-content {
    min-width: 100%;
    overflow-x: auto;
  }
  
  /* Tablet-optimized content sections */
  .match-details-content .info-section,
  .match-details-content .events-section,
  .match-details-content .lineups-section,
  .match-details-content .teams-section,
  .match-details-content .stats-section {
    min-width: 300px;
  }
  
  /* Tablet scroll indicators */
  .scroll-indicator {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
}

/* ===== SMALL DESKTOP (1025px - 1200px) ===== */
@media (min-width: 1025px) and (max-width: 1200px) {
  /* Main Container */
  .livescore-container {
    grid-template-columns: 250px 1fr 250px;
    gap: 15px;
  }
  
  /* Football Field - Small Desktop */
  .field {
    max-width: 400px;
    height: 300px;
  }
  
  .player-circle {
    width: 40px;
    height: 40px;
  }
  
  .player-circle .player-number {
    font-size: 14px;
  }
  
  .player-name {
    font-size: 10px;
    max-width: 60px;
  }
  
  .player-position {
    font-size: 8px;
  }
  
  /* Match Details Sidebar */
  .match-details-sidebar {
    width: 280px;
    min-width: 280px;
  }
}

/* ===== LARGE DESKTOP (1201px+) ===== */
@media (min-width: 1201px) {
  /* Main Container */
  .livescore-container {
    max-width: 1600px;
    grid-template-columns: 320px 1fr 320px;
    gap: 20px;
  }
  
  /* Match Rows */
  .match-row {
    padding: 25px 30px;
  }
  
  .team-logo {
    width: 50px !important;
    height: 50px !important;
  }
  
  .score {
    font-size: 24px !important;
    padding: 12px 20px !important;
  }
  
  /* Football Field - Large Desktop */
  .field {
    max-width: 450px;
    height: 320px;
  }
  
  .player-circle {
    width: 42px;
    height: 42px;
  }
  
  .player-circle .player-number {
    font-size: 15px;
  }
  
  .player-name {
    font-size: 11px;
    max-width: 65px;
  }
  
  .player-position {
    font-size: 9px;
  }
  
  /* Lineup Buttons */
  .team-lineup-button {
    min-width: 200px;
    padding: 20px 30px;
  }
  
  .team-lineup-button .team-name {
    font-size: 20px;
  }
  
  .team-lineup-button .formation-info {
    font-size: 14px;
  }
}

/* ===== LANDSCAPE MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .livescore-container {
    grid-template-columns: 200px 1fr 200px;
    gap: 10px;
  }
  
  .header {
    padding: 8px 0;
  }
  
  .brand-row {
    flex-direction: row;
    gap: 20px;
  }
  
  .search-box-container {
    max-width: 200px;
  }
  
  /* Football Field - Landscape Mobile */
  .field {
    height: 200px;
    max-width: 300px;
  }
  
  .player-circle {
    width: 28px;
    height: 28px;
  }
  
  .player-circle .player-number {
    font-size: 11px;
  }
  
  .player-name {
    font-size: 7px;
    max-width: 45px;
  }
  
  .player-position {
    font-size: 6px;
  }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
  /* Larger Touch Targets */
  .filter-item,
  .match-row,
  .league-item,
  .country-item {
    min-height: 44px;
  }
  
  /* Better Button Feedback */
  .team-lineup-button:active {
    transform: scale(0.98);
  }
  
  /* Improved Swipe Gestures */
  .match-details-sidebar {
    touch-action: pan-y;
  }
  
  /* Enhanced Touch Scrolling */
  .top-tab-list {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  
  .top-tab-list .tab {
    scroll-snap-align: start;
  }
}

/* ===== HIGH DPI DISPLAY SUPPORT ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .team-logo,
  .country-flag-img,
  .league-logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #4a9eff;
    --secondary-color: #2d3748;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --border-color: #4a5568;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  
  body {
    background-color: #1a202c;
  }
  
  .box-shadow,
  .match-list,
  .match-details-sidebar {
    background: #2d3748;
    color: var(--text-primary);
  }
  
  /* Football Field Dark Mode */
  .field {
    background: linear-gradient(135deg, #2d5a2d 0%, #1e3a1e 100%);
    border-color: #1e3a1e;
  }
  
  .player-circle {
    background: #4a9eff;
    border-color: #e2e8f0;
  }
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .match-details-sidebar {
    transition: none;
  }
  
  .team-lineup-button:hover {
    transform: none;
  }
}

/* ===== PRINT OPTIMIZATIONS ===== */
@media print {
  .livescore-container {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .match-row {
    break-inside: avoid;
    border-bottom: 1px solid #000;
  }
  
  .score {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
  
  .team-logo {
    filter: grayscale(100%);
  }
  
  /* Football Field Print */
  .football-field {
    page-break-inside: avoid;
  }
  
  .field {
    background: #fff !important;
    border: 2px solid #000 !important;
  }
  
  .player-circle {
    background: #000 !important;
    border-color: #000 !important;
  }
  
  .player-name,
  .player-position {
    color: #000 !important;
    text-shadow: none !important;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000080;
    --accent-color: #006400;
    --danger-color: #8b0000;
    --border-color: #000;
  }
  
  .match-row:hover {
    background-color: #000;
    color: #fff;
  }
  
  .score {
    border: 3px solid #000;
  }
  
  /* Football Field High Contrast */
  .field {
    border: 3px solid #000;
  }
  
  .player-circle {
    border: 3px solid #000;
  }
}

/* ===== FOCUS STATES FOR KEYBOARD NAVIGATION ===== */
.match-row:focus,
.filter-item:focus,
.league-item:focus,
.country-item:focus,
.team-lineup-button:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== SKIP LINK FOR ACCESSIBILITY ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
}

.skip-link:focus {
  top: 6px;
}

/* ===== LOADING STATES ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== MESSAGE STATES ===== */
.error-message {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
}

.success-message {
  background: #efe;
  border: 1px solid #cfc;
  color: #363;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
}

.info-message {
  background: #eef;
  border: 1px solid #ccf;
  color: #336;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
}

/* ===== UTILITY CLASSES ===== */
.hidden-mobile {
  display: none;
}

@media (min-width: 769px) {
  .hidden-mobile {
    display: block;
  }
}

.hidden-desktop {
  display: block;
}

@media (min-width: 769px) {
  .hidden-desktop {
    display: none;
  }
}

/* ===== FLEXBOX UTILITIES ===== */
.flex-mobile-column {
  flex-direction: column;
}

@media (min-width: 769px) {
  .flex-mobile-column {
    flex-direction: row;
  }
}

/* ===== GRID UTILITIES ===== */
.grid-mobile-single {
  grid-template-columns: 1fr;
}

@media (min-width: 769px) {
  .grid-mobile-single {
    grid-template-columns: 220px 1fr 220px;
  }
}

@media (min-width: 1025px) {
  .grid-mobile-single {
    grid-template-columns: 250px 1fr 250px;
  }
}

@media (min-width: 1201px) {
  .grid-mobile-single {
    grid-template-columns: 320px 1fr 320px;
  }
}
