/**
 * Mobile Action Bar Fix - Ensure action bar doesn't overlap cards
 * - Fixed at bottom of screen
 * - Game content scrolls if needed
 * - No obstruction of player cards/values
 */

@media (max-width: 900px) and (orientation: landscape) {
  
  /* ===========================
     BODY & CONTAINER - Full height management
     =========================== */
  
  body {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
  }
  
  #game-container {
    display: grid !important;
    grid-template-columns: 95px 1fr 95px !important;
    grid-template-rows: 34px 1fr !important;
    height: calc(100vh - 60px) !important;
    height: calc(100dvh - 60px) !important;
    max-height: calc(100vh - 60px) !important;
    max-height: calc(100dvh - 60px) !important;
    overflow: hidden !important;
  }
  
  /* ===========================
     GAME TABLE - Scrollable content area
     =========================== */
  
  .game-table {
    grid-column: 2 !important;
    grid-row: 2 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 4px 6px 10px 6px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }
  
  /* Hide scrollbar but keep functionality */
  .game-table::-webkit-scrollbar {
    width: 3px;
  }
  
  .game-table::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
  }
  
  .game-table::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.4);
    border-radius: 2px;
  }
  
  /* ===========================
     DEALER AREA - Compact
     =========================== */
  
  .dealer-area {
    flex-shrink: 0 !important;
  }
  
  /* ===========================
     PLAYERS AREA - Flexible with scroll
     =========================== */
  
  .players-area {
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 4px !important;
  }
  
  .players-area::-webkit-scrollbar {
    height: 3px;
  }
  
  .players-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
  }
  
  .players-area::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.4);
    border-radius: 2px;
  }
  
  /* ===========================
     ACTION BAR - Fixed bottom, no overlap
     =========================== */
  
  .action-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    z-index: 1000 !important;
    background: rgba(15, 15, 15, 0.98) !important;
    border-top: 2px solid rgba(255, 215, 0, 0.3) !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 6px 8px !important;
    flex-wrap: wrap !important;
  }
  
  /* ===========================
     BETTING CONTROLS - Same fixed bottom
     =========================== */
  
  .betting-controls:not(.hidden),
  #betting-controls:not(.hidden) {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: auto !important;
    max-height: 60px !important;
    z-index: 1001 !important;
  }
  
  /* ===========================
     SMALL SCREENS - Adjust heights
     =========================== */
  
  @media (max-width: 568px) {
    #game-container {
      grid-template-columns: 85px 1fr 85px !important;
      grid-template-rows: 32px 1fr !important;
      height: calc(100vh - 56px) !important;
      height: calc(100dvh - 56px) !important;
      max-height: calc(100vh - 56px) !important;
      max-height: calc(100dvh - 56px) !important;
    }
    
    .action-bar {
      height: 56px !important;
      min-height: 56px !important;
      max-height: 56px !important;
      padding: 6px !important;
      gap: 4px !important;
    }
    
    .betting-controls:not(.hidden),
    #betting-controls:not(.hidden) {
      max-height: 56px !important;
    }
  }
  
  /* ===========================
     VERY SMALL SCREENS - Maximum compact
     =========================== */
  
  @media (max-width: 480px) {
    #game-container {
      grid-template-columns: 80px 1fr 80px !important;
      height: calc(100vh - 54px) !important;
      height: calc(100dvh - 54px) !important;
      max-height: calc(100vh - 54px) !important;
      max-height: calc(100dvh - 54px) !important;
    }
    
    .action-bar {
      height: 54px !important;
      min-height: 54px !important;
      max-height: 54px !important;
      padding: 5px !important;
    }
    
    .betting-controls:not(.hidden),
    #betting-controls:not(.hidden) {
      max-height: 54px !important;
    }
  }
}

